Now we are beginning with the end to end CNN project in which we are going to import colored images
of dogs and cats, and we will try to classify which image contains a cat and which image contains the
dog.
For this, we are going to use cats and dogs dataset.
I have already created a small subset of the entire data.
The entire data is available at Google dot com.
If we want to look at the entire data, you can go check out a dot com and look for cats and dogs.
But I have created a small subset that is available in a zip line which is put on a Google tree.
You will get these Google Drive link in the course description.
You have to download that to it to get data.
Have downloaded deep, I create a folder called CNN in your working directory here at the location of
my working directory.
If you want to change the location of your working directory.
Click on this button and select the position where you want to go.
So if you want to have desktop at working directly, click on desktop, click on Open and they go into
mode and set that as your working directory in your working directory.
Create a folder called CNN.
You can do it.
The novel Windows Way out here and I have written record in art using which you can create this folder.
So if you run these two lines, it will create a new board in your working directory, which will be
titled TNN.
I'm not running this line because I already have.
This will live within this folder.
You have to unzip the zip file that you have downloaded when you unzip it.
You'll get three folders, one test, one three and one validation.
This all these three contain data in the train folder.
You have for their two folders, cats and dogs.
Cat four Look contains 1000 images which have gotten it.
Dogs contains 1000 images, the dogs in.
Similarly, in the validation dataset, also we have two folders.
But the number of injured images is 500 in cats and 500 in dogs and indeed test sick.
We again have 500 images of cats and 500 images of dogs.
So we are going to use this training data.
And this validation data set to fit our model.
So the first step was to create the CNN pedigree and we didn't diabetic medically, you have to underbelly
zip with which you will get all this data.
Much of the video data, we have to create some variables which was stored the location of these directories.
These will be used to pay our model that this is where you have to take your data from.
So there is a slight variation that we are doing this time.
Instead of loading all the data of images into a video, will really be giving the directory from which
the images are to be taken by our model.
So let us see how this is to be done.
First of all, we have to store these vertically locations in different variables.
So these IPTV rebels, we are going to create trained directory, which will have the position of training
data, validation directory for validation data and test retreat for testing.
So basically these three variables are actually pointing to these deep olders.
Now, the first step is to pre-process the images that we have in pre processing.
We have to convert these colored images into Tensas and that to the pixel value ranging from zero to
one.
So if you remember in M-Net also, we had values ranging from zero to 255.
We descale it to a value between zero and one.
So we have to do that rescaling.
We have to handily Tainos and we have to create one sense it instead of having three different dentals.
So all that thing is handled by this one function image data.
So two, pre-process the images that we are going to feed into a model, we use dysfunction, image,
data generated.
There is one more important feature of dysfunction.
This we will see later on.
The feature is that this function helps us generate artificial image data to which we will use to check
the impact of data augmentation or not model performance.
So that is part of the little picture in this picture.
We will just use data that we have in these deep waters.
And this data is being processed by this function to be done.
These two commands, I'm getting this error because I have not activated my kiraz celebrity because
I'm using a new project.
If you are using the same old project, you're get us to have it.
You will be already at it.
So you will not get this.
I'm going this again also doing the same pre processing for our validation dataset.
So now you can see that we have two data edibles on that I can take.
And these contain the tinted information of those colored images.
Next, we are going to bring in one more change.
Instead of feeding the training data all at once, not fit function.
We are going to give the data in batches of 20.
And those 20 batches of images will be generated by this function flow images directory.
What this function will do instead of loading the image into what?
Yes.
Straightaway taking that image from the directory and putting it to a model within this function.
We have several parameters to be specified.
The first barometer is the training directory.
This we stored earlier.
This is telling.
Where is the training data?
Situated at the next parameter.
Is this train DTG?
This is the function which will be these killing images, which will be preprocessing it so that those
images could be paid to output function.
Then there is a barometer which tells us what should be the size of images.
As I told you earlier, the image size in our dataset is not standard.
But the image size for our network should be standard.
So we need to reshape the images to a target size, which will be the standard size of images which
we are feeding our model.
So here we are converting all the images to a 150 150 pixel image.
So this is the size of image which we are putting up.
Next parameter is bat size.
That sizes number of images that will be leading to our model at one go.
So this is the same bad size which we specified in different function.
Earlier we specified a bad size of 60 foot.
This time, I'm giving a bad sales up.
Grindy.
And the last parameterize last mode, which is by.
This is because we are solving a binary classification problem.
And when this function looks into genetically, it sees two folders.
One will be titled Cat and well reedited dogs.
So it understands that the two folders represent two classes into which this binary classification is
to be done.
So we have to tell that it is a binary classification we are doing.
And the two classes are the two folders within this statically.
So this function will be giving us batches of 20 images which are being processed and having Tiger of
150 by 150.
And those are to be classified into two classes.
And these badges of 20 will keep on coming infinitely.
So it is a infinite loop in this function.
Keeps on sending 20 images all the time.
We tell it to stop.
So later on, remember this, that we will have to tell this function to stop giving 20 images.
So this is what this flow images form data is doing.
Instead of loading all the images, we are telling that the image data is to be taken from that, that
we were just doing it.
And at ago, when the images are to be fed to our modern.
You have done the same thing with validation to do it.
It is also giving us batches of grindy images.
Now, that underscore.
Poor ventilation generator also.
So this completes the data pre processing part.
We are ready to give the image information to our model.