Draw a digit. Three models read it as you write.

Trained on 60,000 handwritten digits from the MNIST dataset. The models run entirely in your browser, so nothing you draw leaves this page.

The CNN reads

Draw any digit from 0 to 9 on the page.

Compare models

Probability for each digit

    What the model sees: your drawing cropped, scaled and centred on a 28 × 28 pixel grid, the same format as the training images.

    Loading the models…

    How it works

    1. You write a digit

      Strokes are captured on a 560 × 560 canvas with mouse, touch or stylus.

    2. It becomes an MNIST image

      We crop to the ink, shrink the longest side to 20 pixels and centre it by its centre of mass inside a 28 × 28 grid, exactly how MNIST was built.

    3. The network computes

      784 pixel values flow through the trained layers. The CNN slides 96 small 3 × 3 filters over the image to find strokes, curves and loops.

    4. Softmax gives probabilities

      The last layer turns ten scores into ten probabilities that add up to 100%. The highest one is the answer.

    Results on 10,000 unseen test images

    All three models were trained in Python on the same 54,000 images and judged on the official MNIST test set, which they never saw during training.

    ModelArchitectureParametersAccuracyF1-scoreMistakes
    Loss and accuracy per epoch for the MLP and the CNN, on training and validation data.
    Loss and accuracy during training. Validation accuracy keeps rising with no sign of overfitting.
    Confusion matrix of the CNN on the test set. Almost all predictions lie on the diagonal.
    CNN confusion matrix. Its most common mistakes are a 9 read as a 4 (7 times) and 3 and 5 swapped (8 times).