This code trains a convolutional neural network (CNN) to classify hand written digits using the MNIST data set. The resulting weights of the CNN are saved in h5 format ("CNN_weights_digit_recognition.h5").
The key steps in the model are as follows:
- Training and test data sets are created from the MNIST dataset
- The training data is augmented by randomly rotating, zooming in, blurring and translating the images
- Examples training data images (following augmentation) are shown
- The CNN architecture, the optimiser and the learning rate are defined.
- The CNN is trained and the resulting weights are saved in h5 format.
- The training history of the model is shown.
- The accuracy of the model is calculated using the test set.