The model is trained with Tensorflow using Python and then saved as using simple_save. The saved model is then converted to a web format using tensorflowjs_converter.
Using tensorflowjs_converter the saved and converted model is loaded in JS and then used to recognize digits drawn in an image canvas. Images are preprocessed in the same way as was done for the images in the MNIST dataset:
- crop image from white background
- center in square canvas respecting aspect ratio
- resize to 20x20
- place on 28x28 canvas respecting center of mass
The model used consists of one input layer and one output layer which are fully connected: A*x + b
- display prediction scores for all digits
- add link to show example digits from mnist dataset
- add more models with more layers and option to switch model in the ui
tensorflowjs_converter --input_format=tf_saved_model --output_node_names=y --saved_model_tags=serve ./saved ./saved_web