Multi-Class Image Classification using Alexnet Deep Learning Network implemented in Matlab

Until recently, students and researchers considered Matlab less desirable because of its dependence on the Research environment and the speed of Mathwork development. However, with DeepLearninig itself being the Black Box and the immediacy of research time required to paddle into RedOcean, we have come to believe that I no longer have to insist on not using Matlab. So, I decided to use it at least for the time being until we could improve my skills.

 

Here I am going to share building an Alexnet Convolutional Neural Network for 6 different classes built from scratch using Matlab.

In this article we will use the Image Generator to build the Classifier. Next we will import the data using Image Data Generator. Before that let’s understand the Data. The dataset can be found Kaggle intel-image-classification data.

This Data contains around 25k images of size 150x150 distributed under 6 categories, namely : ‘buildings’ , ‘forest’ , ‘glacier’ , ‘mountain’ , ‘sea’ , ‘street’ . There are 14K images in training set, 3K in test setand 7K in Prediction set.

As often used., the data images for all the categories are split into it’s respective directories, thus making it easy to infer the labels.

If the AlexNet input size is 227x227, it is usually necessary to resize the image as a data preprocessing step. To change the target size to (227, 227), the python code specifies target_size as an argument to ImageDataGenerator as follows

train_datagen = ImageDataGenerator(rescale=1. / 255, target_size=(227, 227))

With this modification, the flow_from_directory method and other data generation methods are used to read the image data while changing it to the specified target size.

 

However, this kind of hassle is also present in Matlab and is hardly a concern, and the results can be sought. The accuracy and certainty of the front-end annotations are more important for applications than the improvement in the number of significant digits of accuracy of the model.

Original MatlabSample : TransferLearningUsingGoogLeNetExample.mlx

Transformer model on Alex Net

calcuration

prediction