Skip to content

Image Classification using PyTorch. Model trained using Convolutional Neural Network

Notifications You must be signed in to change notification settings

Ruparna25/Image_Classification_CNN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image_Classification_CNN

Cats -

Dogs -

Overview

Image classification is the process of categorizing and labeling groups of pixels or vectors within an image based on specific rules. Image classification can be accomplished using Convolutional Neural Nets. It takes as input an array of images within a specific catagory and assign learnable weights and biases) to various aspects/objects in the image and be able to differentiate one from the other. Based on this setup, the algorithm learns which class the test images belong to, and can then predict the correct class of future image inputs, and can even measure how accurate the predictions are. The pre-processing required in a ConvNet is much lower as compared to other classification algorithms.

Dataset

This dataset was downloaded from the Kaggle platform, it contains images of 2 classes of animals - one being the CAT and another being DOG. There are 4000 training images of each class. Also, the test dataset having 1000 images of each class and we are expected to assign the correct class to the test images.

Architecture

Convolutional Neural Network - There are two main parts to a CNN architecture. A convolution tool that separates and identifies the various features of the image for analysis in a process called as Feature Extraction. A fully connected layer that utilizes the output from the convolution process and predicts the class of the image based on the features extracted in previous stages. Below is an architectural diagram of CNN.

Design

The images are converted into greyscale images and compressed. Below are some examples of how converted and compressed image looks like.

I used a 3 convolutional layer CNN model followed by 3 max-pool layers using PyTorch. At the end, there are 2-fully connected layer, the first layer is a neural net of the images after passing through convolutional layer and max-pool layers and the last one being the one which will be a binary classifier, which outputs the inmage to be either a cat or dog.

Performance

The evaluation metrics used for measuring the accuracy of the model is MSE(Mean Squared Error). Below is how the accuracy and loss varies between training and validation set -

Measured accuracy on test set is 71%

About

Image Classification using PyTorch. Model trained using Convolutional Neural Network

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published