Interactive project · 03

Neural Network Playground

Draw a handwritten digit and watch a small neural network turn pixels into a prediction—entirely in your browser.

Runs locally in your browserInference and probabilities are real; the network diagram is simplified for readability.

01 · Input

Draw a digit

loading model
pointer / touch / stylus

Try an example

Live network

Activation flow

Reading pixels
INPUTHIDDEN 1HIDDEN 2OUTPUT0123456789

The network shows seven input regions and sampled hidden neurons. Connections are representative; the probabilities and hidden activations come from the full 784 → 64 → 32 → 10 model.

Stage 1 / 5

Draw a digit to begin.

Prediction

Model output

Most likely digit

—

Awaiting a drawing

0
0.0%
1
0.0%
2
0.0%
3
0.0%
4
0.0%
5
0.0%
6
0.0%
7
0.0%
8
0.0%
9
0.0%

Normalized input

Your drawing is cropped, centered, padded, and resized without stretching before inference.

04 · How it works

From pixels to probabilities

01

Normalize

The drawing becomes 784 grayscale values.

02

Combine

Neurons multiply inputs by learned weights and add biases.

03

Activate

ReLU adds nonlinearity so layers can learn patterns.

04

Score

The final layer produces one score per digit.

05

Compare

Softmax turns scores into probabilities.

Technical details

Architecture: 784 inputs → 64 ReLU units → 32 ReLU units → 10 linear outputs.

Model size: 480 KB JSON artifact, loaded once from /public/models.

Training source: scikit-learn's 8×8 handwritten-digits dataset, expanded and padded to 28×28.

Inference: Direct matrix math runs locally in this browser; no drawing leaves the page.

Timing: The displayed duration measures model math with performance.now(); visualization timing is separate.

Visualization: The 28×28 preview and ten outputs are real. Hidden nodes are sampled representatives, not every neuron or weight.