Program used to identify handwritten digits using dense and convolutional neural nets on digit image data.
Image credit: Koushik
data/
optdigits.tes
- testing dataoptdigits.tra
- training dataoptdigits.names
- info on how data is set up- Original data can be found here: https://archive.ics.uci.edu/dataset/80/optical+recognition+of+handwritten+digits
code/
conv_networks.py
- program used to create 2D convolutional networks from our datadense_networks.py
- program used to create dense neural networks from our data
models/
- place to store all exported dense and convolutional modelsresults_discussion.pdf
- discussion of model hyperparameters and results
-
Clone the repository:
git clone https://github.com/mctripp10/handwritten-digit-recognition.git
-
Navigate to project directory
cd handwritten-digit-recognition
-
Install libraries
pip install tensorflow pip install numpy
-
Configure code in the following sections within
conv_networks.py
anddense_networks.py
:- PARAMETERS/HYPERPARAMETERS: change parameters/hyperparameters as desired
- SAVE AND TEST MODEL: insert the file path of where you want each model saved, as well as what name you would like your model to be called
Currently, the model currently defined in the program will automatically be saved on run according to the path and file name defined in the "Save and Test Model" section. Comment out this code if you do not want it to save.
modelName = "model_name.h5"
filepath = "./models/model_type/" # Insert model file path here
model.save(f"{filepath}{modelName}")
Currently, the model currently defined in the program will also automatically be loaded and tested according to the path and file name defined in the "Save and Test Model"
section. If you wish to load a specific model you have already saved, simply replace the model_to_load
assignment with your file path:
model_to_load = "insert/your/file/path/here" # File path for desired model to load and test
Over the course of this project, I experimented with many different parameter/hyperparameter combinations
to find what values yielded the highest accuracies. In the end, I was able to create both dense and convolutional
networks yielding 99%+ classification accuracies on test data from optdigits.tes
. Both of these models are stored
in models/best/
. See results_discussion.pdf
for further discussion on how I went about choosing these
hyperparameters and how each model in models/
performed.