The task of classifying the images into respective classes, the task has been divided into 5 steps:

STEP 1:

The first and the most important task in Machine Learning is to analyze the dataset before proceeding with any algorithms. This is important in order to understand the complexity of the dataset which will eventually help in designing the algorithm.

The distribution of images and the classes are as follows:

As already mentioned before, there are 12 classes and a total of 4750 images. However, as seen from the above, the distribution is not even and the class distribution varies from maximum of 654 images to a minimum of 221 images. This clearly demonstrates the data is imbalanced and the data need to be balanced in order to get the best results. We will come to that in STEP 3.

Image distribution per class

Now it is important to visualize the images in order to understand the data even better. So, some sample images from each class is displayed in order to see how the images differ from each other.

There is nothing much that can be understood from the images above as all the images looked pretty much same. So, I decided to see the distribution of the images using a visulaization techninque called t-Distributed Stochastic Neighbor Embedding (t-SNE).

t-Distributed Stochastic Neighbor Embedding (t-SNE) is a technique for dimensionality reduction that is particularly well suited for the visualization of high-dimensional datasets. The technique can be implemented via Barnes-Hut approximations, allowing it to be applied on large real-world datasets.[14]

t-SNE visualization of the dataset

Now after looking closely, we can hardly see the difference in the classes. So it is important to understand if the data is very difficult to distinguish only for humans or it is difficult for the machine learning model too. So, we will do a basic benchmark for it.

Training and Validation Set

Before starting with the model benchmark, we need to divide the data into training and validation dataset. Validation set plays the role of the test dataset before the model is tested on the original test set. So, basically a model is trained on the training dataset and is tested on the validation set and then the model can be improved over the validation set over time. Once we are satisfied with the results of validation set, we can apply the model on our real test dataset. This way, we can see the whether the model is overfitting or underfitting on our validation set which can help us in better fitting the model.

So we divide our dataset of 4750 images by keeping 80 percent images as training dataset and 20 percent as validation set.