To learn the ins and outs of PyTorch, this small project involved making a convolutional neural network that could recognize the correct digit drawn in the MNSIT dataset with over 95% accuracy. I enjoyed coding this because I was already somewhat familiar with PyTorch through my research, but learning all of its features and uses was very interesting.
For many attempts, my CNN reached 93%, then 94% accuracy. In order to reach over the 95% threshold, I had to make a much larger network. If I were to improve this further, I would reduce its size as much as I can.
Because the pixels of the MNSIT images are 28 x 28 pixels, my input layer had to consist of 784 nodes. After assigning weights and applying the ReLu activation function, I was given the freedom to add as many hidden layers as I wanted. Initially, I had 4 hidden layers of size 500, 300, 200, and 100. This structure was almost good enough, but hit an accuracy level of 93%. After attempting more hidden layers and seeing worse accuracy, I settled for a balance of X hidden layers of size Y. Although reaching a much larger size of my model, I was able to pass the accuracy threshold with the structure below.
I was happy to be familiar with neural networks already, but the previous project that had me program one (the sleep/study project) required me to code every part by hand. Therefore, it was fun to learn about PyTorch's available functions.
As seen here, the model reached a 96% accuracy threshold, so there are definitely ways to revise this code to cut its size.