Loading the model…
Draw a digit
28×28, rescaled to a 20×20 box and recentred by centre of mass — exactly how MNIST was built.
Confidence across all ten digits
How it works
The part that actually matters
The network is three dense layers and a ReLU — a few dozen lines. What decides whether the demo works at all is the preprocessing.
MNIST images are not raw drawings. Every digit was scaled so its bounding box fits a 20×20 area, then placed in a 28×28 field centred by its centre of mass — not the centre of its bounding box. A model trained on that has never seen a digit drawn small in the corner of a large canvas. Feed it a naive downscale and it returns confident nonsense. Reproducing the original preprocessing is the whole trick, and the preview above shows the result.
Where it genuinely struggles
These are the model's most frequent mistakes on the held-out test set. If it misreads your drawing, it is probably one of these: