Cat Vs Dog CNN Classification
28 day of Online Training + Internship program organized by Oyesters Training, Diazonic Labs, and instructed by Mohammed Ameer Sir.
With in this 28 days, I am gain the knowledge in the fields like ML,Computer Vision,NLP,Deep Learning. By all this great sessions will give me the path towards the,how to go towards the A.I. platform.
After the intership ,I was done the project named as Cat vs Dog Classification in Deep Learning.Following part of the blog gives the brief about the Project.
The project is executed on JUPYTER by using Python.
We have to import the liabraries like,
Here, I actully import the dataset of training model & Convert them into numpy array.
Then the random values present inside the array should be shuffle properly. & after that appending all the values in the array. & By using pickle liablary we can save the numpy arrays.After that , i have to normalized that (x)training inputs.
Now ,for making model we have to import sum liablaries like Sequential &layers like Dense , Conv2D ,MaxPooling2D, Flatten.
CNNs architecture
We’ve established before that similarly to humans, computers are able to analyze visual imagery using deeply layered systems.
Let’s go step by step and analyze each layer in the Convolutional Neural Network.
Input
A Matrix of pixel values in the shape of [WIDTH, HEIGHT, CHANNELS]. Let’s assume that our input is [32x32x3].
Convolution
The ultimate purpose of this layer is to receive a feature map. Usually, we start with low number of filters for low-level feature detection. The deeper we go into the CNN, the more filters (usually they are also smaller) we use to detect high-level features.
Feature detection is based on ‘scanning’ the input with the filter of a given size and applying matrix computations in order to derive a feature map.
Let’s take a look at the following 3x3 filter with stride 1.
Assuming that we use 12 filters, we will end up with a [32x32x12] output.
Activation
Without going into further details, we will use ReLU activation function that returns 0 for every negative value in the input image while it returns the same value for every positive value.
Shape remains unchanged, it’s still [32x32x12]
Pooling
The goal of this layer is to provide spatial variance, which simply means that the system will be capable of recognizing an object as an object even when its appearance varies in some way.
Pooling layer will perform a downsampling operation along the spatial dimensions (width, height), resulting in output such as [16x16x12] for pooling_size=(2, 2).
(2,2) pooling
Fully Connected
In a fully connected layer, we flatten the output of the last convolution layer and connect every node of the current layer with the other node of the next layer. Neurons in a fully connected layer have full connections to all activations in the previous layer, as seen in regular Neural Networks and work in a similar way.
The last layer of our CNN will compute the class probability scores, resulting in a volume of size [1x1xNUMBER_OF_CLASSES].
Full CNN overview
Okay, now as we have some basic understanding of the underlying concepts of the CNNs, let’s get straight to the code!
BUILTING A MODEL:
It comes with 82% accuracy.
Testing The Model:
we have to import the any picture of cat or dog .& Predict it.
It will gives the output Dog.
Finally done with the project!!!
Thank You!!!