Now this is the architecture we are going to use for our CNN model.
If you remember last time when we ran in and model on this problem we used this side of the network.
We first see those flat and layered then dense layered with 300 neuron then dense layer with 100 neurons
and then the output layer.
We are going to add CNN layers before this.
So this is our input vine beard by 28 pixel cross one so twenty 28 pixels as well 28 pixels as height
and 1 as the channel.
We are going to use a filter size of three by three with the straight off one and then this will be
our constitutional layer since we are using for their size of three by three and we are also using a
padding as valid.
We are ignoring one pixel from each side since our padding is valid.
So the convolution layer we are going to get is 26 by 26 and 32.
We are going to use 32 different filters for this constitutional layer after this.
We are going to use to wear to Max pooling.
So finally after this one layer we are going to get 13 by 13 and to 32 cells in our pooling layer.
Now we have to add some dense layer as well so we have to convert this 3D object into one dimensionality.
So we are using like 10 layer then we are going to use two dense layer first one with 300 neuron and
next one with hundred neurons and then we are going to use an output layer with 10 neurons.
Since we have identified 10 different classes
the code is almost similar.
First we have to create a model object.
Then we are going to add a convolution a layer will write more than dot Ed and then get us dot layers
dot com 2D and as parameters.
We want to do for readers we want to have over a reader of size three by three.
So we have to grow a kernel size has three common three.
If you want to print that size of four wherefore you can write four comma four by default the state
value is one.
We are going to use the same and we are going to use padding as valid the activation is always a loop
and the input shape is 28 across 28 Cross 1.
If you are dealing with any collateral images you have to give values for channel as well.
So for blurred images this should be three.
This should be the height weight and then the number of channels.
So this is our common layer for our pooling layer.
We can edit using this index model a lot and then get us dot layers dot Max pulling 2D.
And then here you have to give the dimensions of your window.
We are going to use this app if we love to cross through.
That's why we are giving to common to as a parameter here.
After this we want to convert our three dimensional matrix into one dimensional matrix.
So we have to use light then and after light and we can use our dense layers as we did in and then.
So we are adding another layer with 300 neurons and then another layer with hundred neurons.
And for both of these layers we want our activation function to be of three low and the next layer is
our output layer.
We want to classify 10 different categories.
That's why we are using 10 neurons and that activation as soft Max activation because this is a classification
problem.
Now let's run this
no similar to last time.
We can use dots somebody Medtech to get details of our model architecture.
Here you can get information of all the layers.
What is the shape of those layers and the number of parameters that you are going to screen using this
model architecture
now.
Important thing here you can notice is that the number of parameters we are going to train is in millions.
So in this dense layer we have around one point six million parameters to train.
Now if we have not used Max pulling layer 2 this would have been around 4 million or 5 million neurons
so so using max pulling has significantly reduced the number of but I might add that we are going to
train in the next lecture.
We will try to train a model without a pooling layer and there we can clearly see the difference in
number of parameters and execution time in the models with the pulling layer and without the bullying
layer
the next step is to compile the model.
Now since we have exclusive might be label classification problem we are going to use sparse categorical
and cross and copy.
And we want to use optimizer as a sturdy stochastic gradient descent.
And we want to calculate the accuracy since we are doing the classification problem.
Let's compile this model.