Home
Loading Neural Network Models...

Handwritten Digit Recognition with JavaScript

Two seperate neural networks are pre-trained with MNIST dataset using Keras on top of Tensorflow. Forward-Pass logics of both networks are implemented in JavaScript and executes in browser. Draw a digit in the input area and click “recognize” button to see the results.

Preprocessing Options

Centering
Fit to Scale (px)
Smoothing
Downsizing

Input
Network Input (10x zoom)
Network Input Model Prediction
Deep FF Neural Network 1
Convolutional Neural Network 2

Network Architectures


Preprocessing

In MNIST dataset, samples are normalized as author described here.

The original black and white (bilevel) images from NIST were size normalized to fit in a 20x20 pixel box while preserving their aspect ratio. The resulting images contain grey levels as a result of the anti-aliasing technique used by the normalization algorithm. the images were centered in a 28x28 image by computing the center of mass of the pixels, and translating the image so as to position this point at the center of the 28x28 field.

To have similar inputs as MNIST dataset, you can adjust normalization by changing preprocessing options. Input images bounding box is calculated and following options are available for preprocessing of the bounding box image.

Bounding box

Code

Feedforward implementation for both networks can be seen here.