Digit Decode is a Python-based handwritten digit recognition program that uses a trained ResNet-50V2 This project is a digit recognition application that uses a trained ResNet-50V2 model to predict handwritten digits. Users can draw a digit on a Pygame canvas, and the program will use the trained model to recognize and predict the digit. The predicted digit is printed in the terminal.
This project allows users to:
- Train a ResNet-50V2 model on the MNIST dataset for digit recognition.
- Interact with the trained model by drawing digits on a Pygame canvas.
- Obtain predictions from the model, which will be displayed in the terminal.
-
trainer.py- Trains a ResNet-50V2 model on the MNIST dataset.
- Saves the trained model as
resnet50v2_mnist_model.keras. - Handles model evaluation on the test dataset, providing test accuracy and loss metrics.
-
canvas.py- A Pygame-based interactive canvas where users can draw digits using their mouse/trackpad.
- Uses the trained ResNet-50V2 model (
resnet50v2_mnist_model.keras) to predict digits. - The predicted digit is printed directly to the terminal when the user presses the spacebar.
- Clear the canvas by clicking the
Ckey.
-
resnet50v2_mnist_model.keras- Pre-trained ResNet-50V2 model file for digit recognition using the following parameters:
- Epochs: 10
- Batch Size: 64
- Learning Rate: 0.001 (default for Adam optimizer)
- Loss Function: Sparse Categorical Crossentropy
- Validation Data: 10,000 test samples from the MNIST dataset
- Used by
canvas.pyto make predictions without retraining the model.
- Pre-trained ResNet-50V2 model file for digit recognition using the following parameters:
- [Short Term] Revamping Pygame Canvas to be more visually appealing
- [Short Term] Train model using Google Colab so that more epochs can be run during training
- [Short Term] Plot epoch times and accuracy using matplotlib
- [Long Term] Support for multi-digit numbers (i.e. recognizing '5' and '1' as '51')
I would like to thank my friend, Parshva, who introduced me to some of the key concepts used to make this project a possibility.