By Shreya Singh
The project classifies images using CNN on Fashion MNSIT and CIFAR-10 dataset present in Tensorflow library in Python.
The project classifies images using CNN on Fashion MNSIT and CIFAR-10 dataset present in Tensorflow library in Python. It evaluates accuracy, predictions and confusion matrix is plotted to see the misclassified predictions made by the model. It trains a neural network model to classify images on Fasion MNIST dataset which consists of (28x28) greyscale images of different types of clothing and CIFAR-10 dataset which consists of (32x32x3) color pixel images.
For preprocessing the model expects a 3D input for convolution operations hence we need heightxwidthxcolor, in order to do this we add a superfluous one dimension in the last position with the help of expand_dims function.
Next, the CNN function was build using the Keras functional API, which consists of three convolutional layers which follow the pattern of increasing the number of feature maps at each subsequent convolutional layer. The flatten layer converts each image into a feature vector. The next step is to compile and fit which consists of loss function , optimizer, and metrics so that the fraction of the images that are correctly classified.
We end up getting descent accuracy of 89%. With the model trained, we can use it to make predictions about some images. A softmax layer is attached to convert the logits to probabilities, which are easier to interpret. The model predicts the label no. for each image entered for prediction.
We then plot the loss per iteration plot which shows that validation loss is going up slightly and the loss per accuracy plot which increases throughout showing the possibilities of incorrect predictions.
We then plot the confusion matrix and check where the model got confused in the predictions and then calculate some misclassified examples, wherein a coat was predicted as a shirt in the MNIST dataset.
Submitted by Shreya Singh (shreyasingh)
Download packets of source code on Coders Packet