In this lecture, we are going to see the impact of bullying layer on the number of parameters we have
to train and the execution time on our CNN model.
First, we will run the CNN model that we discussed in our last lecture with the polling leader.
Then we will remove the polling layer from that model to see its impact on the execution time.
So this is the architecture of the model that we developed in the last lecture.
First we have then put layer, then on layer, then pulling layer.
Then we have to dense layer and then output layer.
We are going to remove this pulling layer to notice its impact on the execution day.
So the code will remain the same.
First we have the corn layer.
Then pulling layer.
Then like then layer.
Then Dennis Layer.
We are calling this model as model underscored a..
This is same as the model we develop in our last lecture.
And then we have a second model in which we are not taking this layer.
So first we have the corn layer, then flat and layer, then two dense layer and one output layer.
We are calling this model S model underscore B.
And later on we will compare the performance of Model A. versus performance of Model B.
Let's just try this.
Beacon also look at somebody to get an idea of how many parameters our model out optimizing.
So here you can see for the first dance, let we have our on one point six million parameters to train
if we compared with Model B values.
You can see in what second model that we do not have any pulling layer, the number of cranial parameters
is around six point five million.
So all you can say that there are four times more trainable parameter in your model without pulling
leer.
And we know that the execution time is directly dependent on the number of parameters that we are going
to train.
So obviously we can expect that Model B will take a lot more time than more delay.
Let's just combine both of these models and then we will run model eight four three box.
Then we will run Model B for three books.
And after that, we'll compare the execution time for both models.
Let's just first model A.
Now, we have drained our water.
And as you can see, for each boat, the execution time is on 31 seconds.
And after the completion of Pertti book, we are getting the validation accuracy of 82 percent.
And same as the accuracy for training data as well.
Now, let's run the model without the pulling layer.
Then this.
So now we have trained our second Märta lesbian.
And as you can see, the execution time for each epoch is around sixty two to sixty three seconds,
whereas for one model one, the execution time for each box was around 30 to 31 seconds.
So the execution time is almost double for our model B.
That is the model without the pulling layer as compared to a model with pulling layer.
You can also look at the accuracy scored on training set, the accuracy of over model BS more and on
the validation set.
The accuracy is almost the same for both the models.
This is because when we are pulling for pixels and the one pixel, there is some information loss and
that information loss is resulting in the lower accuracy.
So if you are using pulling layer, your execution time will be less and the accuracy will also be a
little less as compared to a model without pulling their.
In this case, we have only used one convolutional layer, but in real life scenario, you may have
to use multiple convolutional layer.
And in such cases, a use of pulling layer becomes much more important.
So using pulling layer, you can significantly reduce your execution time without impacting much accuracy.