Number Predictor using Tensorflow.js
The pre-trained model used by default was trained locally on a Mac machine using Keras and then converted to a Tensorflow.js format.
Browser Trained Model
The local model is trained locally in-browser using Tensorflow.js.
A Convolutional Neural Network (CNN) with 5 layers, 1 input 3 hidden and 1 for output. See code for more on activation function and other info on the model.
- Load the MNIST dataset if training the model in the browser.
- Load the pre-trained model or the browser trained model.
- Take the input from the canvas element and do some processing to the pixels.
- Take the input and run it throw the trained model.
- Take the predictions and determine which one has the higher probability.
- Display the highest predicted number.