In this lecture we are going to see the impact of bullying later 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 earlier.
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 have loved in the last lecture.
First we have then put layer then on layer then pulling layer.
Then we have two dense layer and then output layer.
We are going to remove this pooling layer to notice its impact on the execution day.
So the code will remain the same.
First we have the con layer then pulling layer.
Then like then layer then Dennis layer we are calling this model as model underscored it.
This is same as the model we have loved in our last lecture and then we have a second model in which
we are not taking this layer.
So first we have the con layer then select and layer then to 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.
What is this performance of Model B.
Let's just run this.
We can also look at the summary to get an idea of how many parameters our models start optimizing.
So here you can see for the first dance layer we have got on one point six million parameters to train.
If we compare it with Model B values
you can see in our second model where we do not have any pooling layer the number of cranial parameters
is around six point five million.
So overall you can say that there are four times more trainable parameter in your model without pulling
layer.
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 really take a lot more time than more delay let's just combine
both of these models and then we will run model 8 for 3 bucks then we will run Model B for three books
and after that we will compare the execution paying for both models let's just first run model a
now we have trained over that and as you can see for each Bob the execution time is own 31 seconds and
after the completion of 30 book we are getting a validation accuracy of 82 were the same and same as
the accuracy for training data as well.
Now let's run the model without the pulling layer.
Stan this.
So now we have trained our second model as well and as you can see the execution time for each epoch
is around 62 to succeed three seconds whereas for the one model one the execution time for each epoch
was around 30 to 31 seconds.
So the execution time is almost double for our model be that is the model without the pulling Lear as
compared to a model with pulling Lear.
You can also look at the accuracy score on training set.
The accuracy of over model BS mode 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 lost 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 constitutional layer but in real life scenario you may have to use
multiple convolution layer and in such cases a use of pooling layer becomes much more important.
So using pulling earlier you can significantly reduce your execution time without impacting much accuracy.