CNN Model to recognize Digits from Images from MNIST Data with accuracy of 99.46%.
MNIST Digit Recognition dataset is a great dataset with 60000 training examples and 10000 testing examples.
I have used a sequential model with following layers in order:
- 2D Convolution Layer with 32 filters and 3x3 kernal size.
- 2D Maximum Pooling Layer with 2x2 kernal size.
- 2D Convolution Layer with 64 filters and 2x2 kernal size.
- 2D Maximum Pooling Layer with 2x2 kernal size.
- 2D Convolution Layer with 256 filters and 2x2 kernal size.
- Flatten Layer.
- Dense Layer with 1024 neurons (activation units).
- Dense Layer with 256 neurons (activation units).
- Dense Layer with 10 neurons (activation units). This is the output layer.
The optimizer used is Stochastic Gradient Descent (SGD) with learning rate of 0.01 and momentum of 0.9.
I have trained it on Google Colab for 30 epochs with a batch size of 32.
- CNN Model is good to start with, for image recognition.
- Keras is great, easy-to-use library for implementing neural networks.
- Since the training accuracy is 1.0000 but test accuracy is 0.99460, so the model can be inproved by increasing its depth/ adding more layers. The little problem is high variance. (I will try to improve it.)
- I have trained the model using both GPU and TPU, and found that, TPU is faster for higher batch sizes(>256) whereas GPU is faster for lower batch sizes.