This demonstrates a 3-layer MLP with ReLU activations and dropout, culminating in a 10-class softmax function which predicts the digit represented in a given 28x28 image. Offline, the architecture and weights of the model are serialized from a trained Keras model into a JSON file. Here, this file is loaded by the browser and used to run the neural network in the browser, on-the-fly with the loaded sample images (the predict function isn't called until sample images are loaded). Five sample images are randomly loaded per button-click below.
Offline, this trained model achieved 98.1% test accuracy. Of course, there are models that perform much better, such as those based on convolutional neural networks.
prediction: -
probability: -
prediction: -
probability: -
prediction: -
probability: -
prediction: -
probability: -
prediction: -
probability: -