I wanted to write and implement a convolutional neural network using PyTorch that would be able to classify handwriting data using a train, valid, test approach. The following shows my exploration and process to implement this successfully. This was a fun exercise, and I got to learn a lot more about convolutional neural networks. I hope you enjoy!
Figure 1. Torchvision MNIST Dataset
I used the Torchvision MNIST Dataset for my model (sample seen above). The data consists of grayscale images of handwritten single digit numerical characters in the range 0 through 9. This dataset is from the MNIST (Modified National Institute of Standards and Technology) and is highly coveted as a machine-learning-friendly human handwriting dataset. To learn a little more about the dataset, see more.
I implemented a convolutional neural network with two hidden layers, L2 norm regularization, and a learning rate of 0.001 and got the following results. You can view the deployed model in a Jupyter Notebook here.
I will now present the results of my model:
Figure 2. Model Output
Figure 3. Prediction Accuracy Performance
Figure 4. Prediction Loss Performance
My model boasted test high accuracy that converged around 98 to 99 percent (Figure 2). This high test accuracy was coupled with low test cross-entropy loss that converged at around 0.025 to 0.035 (Figure 2). My model performed well on the unseen test and valid data, as seen in both accuracy and loss curves (Figures 3, 4), further showing the success of the model.
Seeing that I was able to implement a successful model using numerical data, I would now like to further expand into more complex data such as alphabetical.
Thanks for checking out my project!