MNIST handwritten digit classification using CNN implemented using Keras.
- Download the datasets and fix the imports
- Pre-process the images of dataset
- Split the training and test images
- Compile the Convnet
- Fit the model
- Test the model on testing data
Accuracy achieved - 99.12%
Dataset used - digits dataset
- We can also access this data from the scikit-learn library. There are 506 samples and 13 feature variables in this dataset. The objective is to predict the value of prices of the house using the given features in the dataset.
The digits dataset consists of 8x8 pixel images of digits. The images attribute of the dataset stores 8x8 arrays of grayscale values for each image. We will use these arrays to visualize the first 4 images. The target attribute of the dataset stores the digit each image represents
-
To apply a classifier on this data, we need to flatten the images, turning each 2-D array of grayscale values from shape (8, 8) into shape (64,). Subsequently, the entire dataset will be of shape (n_samples, n_features), where n_samples is the number of images and n_features is the total number of pixels in each image.
-
We can then split the data into train and test subsets and fit a support vector classifier on the train samples. The fitted classifier can subsequently be used to predict the value of the digit for the samples in the test subset.
-Install the libraries
-Download the code from this repository
-Run the code using jupyter notebook
c82674245550762ecc8695be25f8f0001f3a93f3