Skip to content

Identifies handwritten digits using dense and convolutional neural nets on digit image data.

Notifications You must be signed in to change notification settings

mctripp10/neural-network-handwritten-digit-recognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Handwritten Digit Recognition

Program used to identify handwritten digits using dense and convolutional neural nets on digit image data.

handwritten-digit-img

Image credit: Koushik

Project Layout

  • data/
  • code/
    • conv_networks.py - program used to create 2D convolutional networks from our data
    • dense_networks.py - program used to create dense neural networks from our data
  • models/ - place to store all exported dense and convolutional models
  • results_discussion.pdf - discussion of model hyperparameters and results

Installation

  1. Clone the repository:

    git clone https://github.com/mctripp10/handwritten-digit-recognition.git
    
  2. Navigate to project directory

    cd handwritten-digit-recognition
    
  3. Install libraries

    pip install tensorflow
    pip install numpy
  4. Configure code in the following sections within conv_networks.py and dense_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

Loading/Saving Models

Saving

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}")

Loading

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

Results

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.

About

Identifies handwritten digits using dense and convolutional neural nets on digit image data.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages