The Lost foundational concept we need to understand before we start building our CNN model in this orbit
is that of a pooling lid and since you know how conditional layers work pooling layer is going to be
easy to understand we use pooling layer in our network to reduce the computational load memory usage
and the number of parameters to be estimated.
Just like in conclusion earlier each neuron in appallingly it also has a small rectangular deceptive
field.
We have to define the size of this rectangular receptive field thus trade the type.
Just like before however pulling neurons have no weight.
All they do is aggregate the input using an aggregate function such as Max or mean.
In this image the layer on top is that of a pooling lid.
You can see that each new dawn is looking at a two by two set of neurons on the lower layer.
The first neuron is looking at these four cells which have a red boundary.
Next is looking at these four which are dotted blue boundary.
This means that this right here is to by default the straight in upwelling there is same as the width
of the receptive field.
Now if we use max function or Max pooling as it is called Only the maximum input value although the
four values in this receptive field makes it to the next layer the other three inputs are dropped.
For example if these are the four outputs of these four cells 1 5 3 2 then order these 4 5 is the largest
value so this neuron in the top layer will have 5 as output
so it is very simple.
No weights no filters to be trained just find the maximum value out of the forward values that it sees
and it outputs that
if you look at the TGIF at the bottom if this is the feature map at which are Max pooling layer is looking
at for the first squared off for neurons the largest value is 6.
So we ended six here in the first cell of the max pooling their similar to Max pooling.
That is average pulling an average pooling.
We find out the mean of the four values.
So if we are doing average pooling it will be the average of these four values six six four and five.
So that averages 5.2 two in the next trade.
We look at the next four cells and we find out there Max and their average value those are stored in
the next neuron now.
Also notice that since we are using a straight off to here the pooling layer has half the weight and
half the height of previously it you can now imagine how this will reduce the computations and memory
usage instead of a willing layer if we had the next convolution cleared straight away so that layer
would have six endured six as eight and eight as with.
So six into it forty eight input neurons so each neuron in the next layer would have forty eight parameters
to be trained but if we have this pooling layer on top then each neuron gets only three into four that
is 12 input neurons.
So only 12 parameters but neuron are to be trained so instead of forty eight we get well that I mean
train.
So the amount of computation goes down significantly so in this example we saw that we can do both Max
pulling and mean pulling but commonly Max pooling works better than the alternative options because
it highlights the main features instead of averaging them old so in our model most often we'll be using
max pooling only that this is the content we think Max pulling it is a tradeoff we give away some extra
information in the previous layer to reduce the computational load on our system I will highlight this
impact on computation when we write the code.