Object Classifier Using CNN

Object Classifier Using CNN
Photo by Cabify Design on Dribbble

According to Wikipedia:

Contextual image classification, a topic of pattern recognition in computer vision, is an approach of classification based on contextual information in images. “Contextual” means this approach is focusing on the relationship of the nearby pixels, which is also called neighborhood. The goal of this approach is to classify the images by using the contextual information.

Object Classification is a process of classifying the images of objects according to their class labels with the help of computer vision and deep learning.

Table of Contents:

→Dataset

→Data Preparation

→Image Preprocessing

→Model Training

→Model Evaluation

→Graph Plot

→Model Prediction


Dataset:

The dataset is available on Kaggle which was given by Prashant Chaturvedi

https://www.kaggle.com/positivepc/object-detection

The data is divided into two types: test data and train data. The training set contains 1486 images, whereas the testing set contains 392. The images in the collection were largely clear and well-formatted.

There are in all 2 labels which we need to predict.

  1. Electric Bus
  2. Electric Car

Data Preparation:

The dataset already included the training and test sets. The validation set, however, was missing. As a result, we needed to divide the training data set into an 80:20 ratio, i.e. (1486 for training and 297 for validation).

Image Preprocessing:

By definition, Image Processing is a method to perform some operations on an image ,in order to get an enhanced image or to extract some useful information from it. It is a type of signal processing in which input is an image and output may be image or characteristics/features associated with that image.

Rescaling :

Because the image size has a maximum pixel of 255, i.e. it has a range of [0,255], the model will struggle to process such a large image, thus we must rescale it before feeding it to the model.

Data Preprocessing

Model Training :

We are using CNN for training the model,

epoch_size=10

optimizer=adam

Model Evaluation:

The model performed very well on the validation as well as on training set .The model was able to yield an overall accuracy of 98.4% and an accuracy of approximately 82% on validation set.

Graph Plot :

Train V/S Val (Loss)
Train V/S Val (Loss)

Train V/S Val (Accuracy)
Train V/S Val (Accuracy)

Model Prediction :

Link :

Click the below link to access the Notebook.

https://cainvas.ai-tech.systems/use-cases/vehicle-classification-app/

Credit: Tanmay

Also Read: 3D Shape Detection System