Hi.
Now let's start looking at pulling.
We explore the Max Pouliot and its purpose in CNN's So let's get started.
So firstly, pulling is simply the process where we reduce the size or dimensionality of a feature map
as we progress to the network.
Now you may have recalled me seeing that reducing the size isn't always good because we we tend to lose
information.
However, pooling with the maximal operation that we used in CNN's allows us to actually keep most of
the information so we don't lose too much.
And this is important because now it allows us to reduce the number of parameters in one network, which
means that it's a much faster in training.
It's a much smaller size.
It can be influenced faster as well.
So it's a good thing that pooling is around, and this process is also called some sampling or doing
sampling.
So in the literature, if you might, you might come across something where it says we subsample the
feature map or don't sample.
Basically, pooling is what they're doing.
Pooling is the standard name, but mostly everyone uses.
But sometimes you will come across these terms.
So here's an example of max pooling.
Imagine this is a feature map output right here.
We use two parameters to control a maximal operation.
We use a kernel size and straight.
So Q2 by Tucano means that first instance of a sliding window covers this yellow portion here.
The second instance covers the blue portion and the turn of the red and the foot to green.
Now you may have already figured out by looking at this, but the max pool operation simply takes the
largest number in this block in this two by two grid.
So that's one hundred and twenty three.
The other one is going to be 253 and is actually 167 here.
So that's actually a mistake because there's no 167 here.
So sorry about that error in this one here, the largest number is 187, and in this one here it's 165.
So you can see effectively that's how max pooling works.
It's quite simple.
So here's a bit more on max pooling.
Typically, we use to buy two kernels with a straight of two by two that those values, those parameters
tend to give us fairly good results.
And it allows us to reduce the dimensionality by a factor of two to width and height.
Take a look at that.
This was a four by four feature map, and by applying the max boot with two by two and a two stride,
we get a two by two matrix and the output.
So it's half the size, so that means it reduced it by a skill factor of two.
Now, pooling also has the advantage, where it makes our model more invariant to minor transformations
and distortions in our image.
OK, I'll take I'll show you an example of that in the next slide.
And lastly, we can also use something called average pooling or some pooling, which you can imagine
from the name.
Average pooling would just take the average of these phone numbers then, and some pooling would to
see the sum of these phone numbers as well.
So how does max pooling achieve translation and variance?
Let's take a look at this slide so you can see this is let us see in this image here.
We can evolve it with this kernel here with this filter and we get the feature map output here with
this blue portion being represented here.
And then after playing max blue, we get this blue being the largest portion here.
So this is just a hypothetical output, by the way, because we don't have the values in this here.
But just imagine that this was the output of the feature map and this was the output of the max blue
operation.
Now what if we shift our C downward by shifting our C downward?
We can now see that the feature map actually has a different output now.
This pixel turned on as opposed to this one.
So by applying the max pool, though, because it's still in this two by two grid here, the maximal
output is still the same.
So this is how we achieve some translation and variance using the max pool.
So why does max pooling works?
Well, as we saw, the purpose of using max pooling is to reduce the feature map size by half in most
cases, and when I say half, that's when we're using the two by two and a stride of two.
So is that OK?
Well, I showed you before that.
It allows us to have translation and variance without losing information, which is a good thing.
So why is that?
Well, that's because neighboring pixels are usually strongly correlated in the lowest layers, especially
that strong correlation allows us to use a maximal operation to reduce feature size without losing much
information.
Remember, the Flitter part two pixels are less curly.
They are and exclusively are more correlated.
They are as well, and they tend to have a lot of similar associations because that's just how images
are one pixel and immediate pixels near might be the same color.
So which is?
Which is a good thing, which means an export operation doesn't inherently lose much information when
applying it to that image.
So that's what this line says.
Here we can apply reduce the size of the output by sub sampling a pooling, and we don't actually lose
much information.
However, though, just remember, by using a bigger stride and improving lives, it will lead to some
information loss.
You can't do this without having a cost at the end.
So in practice, researchers have found that stride of two and a could on size of to use it usually
works quite well without losing much information and allows the CNN to still learn a lot of information.
Now we'll move on to probably the second to last layer in the neural network on CNN, which is the fully
connected layer.
So I'll see you in the next lesson.
Thank you.