The idea

  • Who it is for: students meeting neural networks for the first time.
  • Problem: most digit-recognition demos show a confident answer and hide everything else, so learners never see the preprocessing or the failure modes.
  • Main features: draw on a canvas; see the predicted digit, all ten probabilities, the 28 × 28 image the network receives, and a "not sure" answer under 60% confidence. Runs in the page; nothing is uploaded.

The AI

  • Method: a two-layer perceptron (784 → 256 → 10, 203,530 parameters) trained from scratch in NumPy with hand-written backpropagation and Adam on MNIST with augmentation (rotation, scale, shear, stroke thickness). Exported as 8-bit weights (204 KB) and run in plain JavaScript.
  • Role: it is the whole recogniser; the page shows its full output.
  • Representative inputs and outputs: a drawn 7 → "7, 100% sure"; drawn 0, 1, 2, 3, 4, 8 → correct at 100%; a loop with a straight tail → "9, 100%"; an asterisk → "8, 98% sure" (wrong).

How I tested it (real numbers, python scripts/evaluate.py)

  • MNIST test set, 10,000 digits: 98.11% (int8 model). Answers 98.85% of them, 98.64% correct when it answers. Most common mistake: 4 → 9 (18 times).
  • Digits placed anywhere on a 280 × 280 canvas: 98.37% with MNIST-style crop and centring, 22.83% without.
  • 8 pytest tests: gradients against finite differences, int8 export, preprocessing, and identical output from the Python and JavaScript code.
  • Hand checks on the live page with scripted mouse drawing (Playwright).

Limitations and a failure case

It cannot reject things that are not digits: on 1,000 random scribbles it said "not sure" only 31.1% of the time, and an asterisk is read as 8 at 98%. Accuracy on real people's screen drawings has not been measured.

Stack, data and components

Python, NumPy, SciPy (augmentation), Matplotlib (figure), Pillow (CLI), HTML/CSS/JavaScript, GitHub Pages. Dataset: MNIST (LeCun, Cortes and Burges). No model provider or paid API. Fonts: DM Serif Display, Manrope.

Pre-existing vs built during the event

No pre-existing code; everything, including the trained model, was made on 1 Dec 2026 (see the commit history).

AI assistance

Built with AI-assisted coding: an AI coding assistant helped write the code, tests and documentation. The README states this.

Share this project:

Updates

Submission history