Train a neural network that recognises handwritten digits, then try it on digits you draw yourself. Start with the small 8×8 digits that ship with scikit-learn, then move to MNIST's 28×28 images.
Project idea · ungraded
Handwritten Digit Recogniser
You will use
Milestones
Build the smallest working version first. Ticks are saved in this browser only.
Stretch goals
- Add dropout and compare validation curves; save the best model with its state_dict.
- Replace the MLP with a small CNN (see the Computer Vision topic).
- Make a tiny web page or FastAPI endpoint where you draw a digit and get a prediction.
Data
- 1,797 8×8 digits bundled with scikit-learn (no download):
sklearn.datasets.load_digits. - MNIST, 70,000 28×28 digits, downloaded by
torchvision.datasets.MNIST.
Run it yourself
pip install torch torchvision scikit-learn matplotlib
python train_digits.py
A CPU is enough: an MLP on MNIST trains in a few minutes.