A browser digit classifier with a twist: the model was trained on computerized, digital-display digits — not handwriting. So instead of asking "can the machine read your handwriting?", it asks the opposite:
How close can you draw to a digit the way a screen renders it?
Draw 0–9 on the canvas and the network reads you back in real time. A high match means your stroke landed in the shape the machine was taught to expect. Loose, cursive handwriting scores low — that's the game, not a bug.
Tip for a high score: straight strokes, square corners, even thickness. Think seven-segment display.
Serve the folder over HTTP (the model files are fetched with fetch, so opening
index.html from the filesystem won't work):
python3 -m http.server 8000
# then open http://localhost:8000- p5.js provides the 400×400 drawing canvas, downsampled to 28×28 before each classification.
- ml5.js (
neuralNetwork,imageClassification) runs the trained model frommodel/, classifying continuously as you draw. create_data.jscaptures 28×28 training samples from a drawing canvas;trainModel.jsloads 140 images per digit fromdata/(gitignored — grab it from the Kaggle link below) and trains for 200 epochs, then saves tomodel/. Both are commented out inindex.html; swap the active<script>tag to run one.
Press C or hit Clear to reset the canvas.
Trained on computerized digit images: https://www.kaggle.com/shreyasshrawage/digits
