Multi-class image classification using Deep learning -implementation in TensorFlow keras.

A deep learning algorithm model mimics how the human brain functions and operates with the help of neural networks which is a structure to learn complex patterns. In Computer vision we use large image datasets to train a neural network which helps us classify unseen images/specifications by smallest amounts of computation time and much less resources today there are a lot of applications of deep learning classification in healthcare for example predicting covid in patients based on chest x-rays, early-stage melanoma detection given a large training dataset to learn on images for neural networks to predict melanoma in patients etc. 

Today, we will discuss about classifying multi-class images using deep learning models for that we will use python libraries like NumPy fornumerical computing, pandas for analysis and manipulating data, matplotlib for visualization and TensorFlow keras for neuralnetworks. A Sequential model is appropriate for a plain stack of layers where each layer has exactly one input tensor and one output tensor and the classic iris dataset (irisdataset link). Notebook Used – google collab 

First import the necessary modules and load the dataset using pandas data frame. 

To train the neural networks we will convert the species into vectors to recover the species names after predictions. 

Let’s look at the dataset – 

One part of the data will be used for training and testing the neural networks and the other part will be used for inputs for predictions. 

We will convert the names of species into numerical values, then into vectors for the output of the neural network because we have string format in columns classes necessary in multiclass classification. 

Building the model

The dimension in input is the number of features of the data frame (without the class to predict). We are on a multiclass classification situation, so the activation function for the last most suitable layer is “SoftMax”, and “categorical_crossentropy” for the loss.  

We can alter the learning rate by changing epochs and use a callback function in case the loss is increasing if necessary but for now our model is performing ok. 

Now, carry out the opposite operation to recover the name of the species which we did in the beginning so after that we can make predictions from the sample we have taken early. 


  Info and source – Kaggle

Leave a Comment

Your email address will not be published. Required fields are marked *