This is repository is created as a part of final project for Fundamentals of Machine Learning (EEL5840) under Prof Alina Zare in University of Florida for the Master's in Computer Science program. An implentation of Deep convolutional neural network inspired by the famous "Lenet"(http://yann.lecun.com/exdb/publis/pdf/lecun-01a.pdf) Architecture with Pytorch to recognize Handwritten Characters.
The detailed requirement of this project will be found out in the file project1.pdf
The Dataset is custom handwritten charecters provided by Prof Alina Zare created by her students of Electrical and Computer Engineering Department of the University of Florida.
The “easy” test set is composed of hand-written ‘a’ and ‘b’ characters. The code should produce the labels ’1’ for ’a’ and ’2’ for ’b’
The goal is to train the system to distinguish between handwritten characters. The “hard” data set consists of the following characters: ’a’, ’b’,’c’,’d’,’h’, ’i’, ’j’ and ’k’ and ’unknown’. There will be test data points from classes that do not appear in the training data. So, the system have come up with a way to identify when a test point class is “unknown” or what not in the training data. The label you should return for this case is -1. The code outputs a class label that matches the class value in the provided training data. These should be: 1,2,3,4,5,6,7,8, and -1 respectively.
We came up with three types of models -
- with Batch Normalization (https://arxiv.org/pdf/1502.03167.pdf)
- without Batch Normalization
- with Dropout (https://www.cs.toronto.edu/~hinton/absps/JMLRdropout.pdf)
We first split the dataset into train, test and validation set. Then we used different parameters(learning rates, epochs, batch sizes) to train our network and based on the results we found out the model without batch normalization produces highest accuracy(97.469%). So we selected that model as our final deliverable model.
skorch (0.7)
1.3.1
Training “easy” blind data set
- For (“easy” blind test data set) all the parameters(ex epoch, learning rate) are listed in ./Handwritten-Character-Recognition/train.py file.
- For specifying the paths for the files of the dataset and label set, please use the variables data_set_path and label_set_path.
- Please place the the files of the dataset and label set in the Handwritten-Character-Recognition folder.
- The model will be generated in the ./Handwritten-Character-Recognition/model folder.
- All the details of the models during training process will be genrated in the ./Handwritten-Character-Recognition/metrics folder.
Testing “easy” blind data set
- For (“easy” blind test data set) all the parameters(ex epoch, learning rate) are listed in ./Handwritten-Character-Recognition/test.py file.
- For specifying the paths for the files of the dataset, please use the variables data_set_path variable.
Training Hard Dataset
- For (“easy” blind test data set) all the parameters(ex epoch, learning rate) are listed in ./Handwritten-Character-Recognition/train_extra_credit.py file.
- For specifying the paths for the files of the dataset and label set, please use the variables data_set_path and label_set_path.
- Please place the the files of the dataset and label set in the Handwritten-Character-Recognition folder.
- The model will be generated in the ./Handwritten-Character-Recognition/model folder.
- All the details of the models during training process will be genrated in the ./Handwritten-Character-Recognition/metrics folder.
Testing Hard Dataset
- For (“easy” blind test data set) all the parameters(ex epoch, learning rate) are listed in ./Handwritten-Character-Recognition/test_extra_credit.py file.
- For specifying the paths for the files of the dataset, please use the variables data_set_path variable.
To generate a new model with new parameters, please run train.py and train_extra_credit.py file first. Existing models are found at the location Handwritten-Character-Recognition/model
- Training:
cd Handwritten-Character-Recognition
python train.py - Testing:
python test.py
- Training:
cd Handwritten-Character-Recognition
python train_extra_credit.py - Testing:
python test_extra_credit.py
The final output after running the ./Handwritten-Character-Recognition/test.py and ./Handwritten-Character-Recognition/test_extra_credit.py files will be found at the files easy_file.npy and hard_file.npy respectively. In these two files the predicted labels are stored as numpy arrays.
Project report is included in the FML_final.pdf
As per the teaching assistants, when they ran the model on the test data set, the model produces an accuracy of 97.3% and 86.5% on the easy and hard test dataset respectively.