Now, the next step is to create the structure of a watch CNN model.
For this, we will for this problem.
We will be using four different conv layers with Max pulling.
And after that we will apply our dense layer and then an output.
So for our first Lere.
We will have gone layer with 30 to 40 deaths and three by three with No.
And our input sizes, one four feet by four feet by three.
Remember, we mentioned our target size while data preprocessing as one four feet cross 150 feet.
And since this images are Collodi images, we have RGV, we will lose.
That's why we are providing a third dimension as three.
After this, we want to max pulling.
Here.
We will use a window of two way to.
After this, we'll use another layer which succeeded for four years and three by three window.
Then another pulling layer.
Then we will use another con there with 128 features and add another layer of way to window.
Then we will have another layer of 128 filters and a pulling their weight two by two window.
Then we will use flight then and then a single dense layer with 512 neuron and then a single output
layer with one neuron.
Since we only want to predict two classes.
One important thing here is to note the number of tweeters that we are using.
You can see as we are going on in our network, we are increasing the number of four years in what kindlier?
So this is a general practice with each con layer.
You have to double the number of filters you are going to use.
And another important thing is that if you remember with Max pool of window to way to.
You are reducing the size of your images.
So if you ever image of 150 by 150 after max pulling, you will have a made up of 75 but 75.
So after this, a step after this layer, we will have images in the dimension of so and if by 70 feet.
Then after this, another MECs bullying, we will have images of.
37 by 37.
Then after this, we will have images of it by 18 and then nine by nine.
So if you see the number of features are increasing as we go along on our network and the work and the
lens of forward images are decreasing.
This is a standard practice.
You are a mere size should decrease with each con layer and the feature map height should increase as
you go along the network.
So this is the structure we are following for this problem.
Let's just run this.
Another thing is that earlier we were using Keita's dot Lear.
So now we have imported Lears and we don't have to put guitars, dot layers and so on.
So another little thing.
Let's look at the somebody.
You can see we have for corn layer with four different pulling layers and then.
A dense layer and then output layer.
The total number of parameters that we are screening in our model is at over three million.
Now, the next step is to come by Lamartine.
And this time, instead of using a ZULI, we are going to use them as prop.
Oremus Propp have a little advantage or as Julie while performing image processing.
That's why we are going to use Artemus Prop.
And here we have also mentioned the learning rate of zero point zero zero one.
By default, the learning rate is point zero.
And we have mentioned learning data, pseudo point zero zero one.
That's it on this.
Now, the next step is to fit training data in our model.
And earlier we were using model law fit.
But now, since we have data in the form of green data, we are getting our data in the batches of 20
directly from over directory.
That's where instead of using dot fake, we are going to use dot fake gender.
For using homemade detergent, narrator as our input we have to use for gender.
The process is almost same instead of the Fed.
You have to use DOT for it.
Underscore the gender.
Then.
Then you have to provide the object that is generating the data.
In our case, that is green generator that we have created earlier.
Now.
Now, another difference is that this train generator is generating data continuously.
So we have to mention that stopping point.
And we are mentioning the stopping point in the form of number of steps.
As you remember here, while creating our train generator, we mentioned that the bed size should be
of 20.
So this train generator is generating data in the packets of 20 images.
Now, our screen dataset is of 2000 images.
So how many steps are required to cover all the two Holderness steps?
That is two tosing divided by the number of images in each bet, which is 20.
So that's where we want to step.
In the hundreds of steps we are going to cover all the 2000 images that we have in our train directory.
So just remember to use the steps, but epoch parameter.
And this you should provide by dividing the total number of images that you have by the number of images
you have in your head.
Each batch.
So 2000, they were led by 20, equal 200.
We want to create this model for 20 bucks.
That's why we are providing epochs equal to 20 and similar to fact.
We can provide our validation data as well.
Here, the validation data is in the form of validation generator.
We have clear trade regulation, gender to clear.
And here also we are using a bed size of 20.
And in our ventilation formula, we have our on polls, on images.
So then do either quite frankly, we need to run this for peace steps, so we have to provide whether
additional steps equally 250.
Let's run this.
So if you see this is very similar to fact function and food function will directly provide the data
here and sort of providing data directly.
We are providing the generator that is generating the data and we are mentioning the steps or the limit
on the number of times that generator is going to gender generator.
So the training may take several minutes.
So I am skipping the training part.