Zac Stryker Home Projects Blog Resume About Contact GitHub
← Projects

Digit Recognition

Draw a digit and watch AI identify it in real-time

How to use: Draw a digit (0-9) on the black canvas above using your mouse or finger. Make it large and centered for best results.
Predicted Digit
Draw a digit to begin

Confidence Distribution

README.md

Interactive handwritten digit recognition using a neural network trained on the MNIST dataset. Draw a digit on the canvas and the model predicts it in real-time with per-class confidence scores.

How It Works

All inference runs client-side via TensorFlow.js -- no server calls required. A pre-trained Keras model is converted to TensorFlow.js format and loaded directly in the browser.

When you click Predict, the canvas drawing is scaled down to 28×28 grayscale pixels, normalized to [0, 1], and fed through the network. The output is a probability distribution over digits 0–9, displayed as confidence bars.

Model Architecture

LayerOutput ShapeDetails
Input28 × 28Grayscale pixel values
Flatten784Reshape to 1D vector
Dense128ReLU activation
Dense64ReLU activation
Dense10Softmax activation (one per digit)

Tech Stack

  • TensorFlow.js -- client-side neural network inference
  • Canvas API -- drawing input and image preprocessing
  • Flask -- serves the page (no backend inference)