Friends welcome to my youtube channel
Dhanesh here. So in the last video we discussed about
convolution layer
The convoluted neural network it consists of four layers
convolution layer
activation layer or raloo layer
Max pooling layer fully connected layer. So these are all the four layers a convolution layer
Convoluted neural network is having so in this video
I am going to discuss about the other layers that is activation layer max. Pooling layer and fully connected layer
C from the convolution layer the output we got is a map
It said if you see the last video you can you know see it here
The output we got is a map of 7x7 matrix itself. This is the matrix a matrix of
Seven by seven. That's what we got it from the light of 7 by 7 matrix
You got it 1 2 3 4 5
6 7
1 2 3 4 5 6 7 like 7 by 7 matrix 3 4
1 2 3 4 5 6
This is the matrix. You got it from them, you know convolution layer
See in this output
If you see the previous video you can see there in this after the convolution operation
The pixel values in this map in this
You know are two-dimensional matrix contains both positive and negative values
See in this activation layer the second it contains so positive values and negative values as well
So what is the purpose of this relu layer?
is to remove every negative value from the filtered images and
Replace it with zeros. So what is the purpose of the
regular relu stands for rectified linear
unit so, you know the lelou means a
rectified
Linear
Unit this is we call it as a real Lulu re
Lu is small letter
C it is an activation function raloo is an activation function
You know activation function determines whether a particular neuron or a naught should be activated or not
It determines the state of a neuron and it introduces
non-linearity in the neural network, you know about that now in this
Case our rally function D sub rectified linear unit what exactly it is doing is it?
removes all
Relu, it removes every negative value. It removes all
Negative values it is removing all
negative values
and
Replaces it with zero. So that's what the review in this convoluted neural network do
So value function if I can give you some more clarity on value function raloo activation function
It only activates a node if the input is above certain quantity
That's what a rectified linear unit desc
It only activates a function if the input is above
Certain quantity if the input is below zero the output is zero
so our
requirement meets here
see the
Relu function activates a node if the input is above certain
Quantity if the input is below zero the output is zero when the input rises above certain
Threshold. It has a linear
relationship with the dependent
variable so
That's what a relief function does if you see here of the relu function, this is the mathematical
Representation of the reuleaux function you can write it here like this FX
Is equal to zero if X
Is less than
X less than 0 FX is 0
if X is less than 0 and
FX is equal to X
if
X
greater than or equal to 0 from this you can understand it removes all
negative values and it replaced it with
zeros so our
requirement meets and if you plot a graph of, you know a relief function
It will look like this so you can see here if you plot a graph of value function
So here this is the graph of a prelude function. It would be like this. I know
here in the you know, if
X is you know less than 0 y is equal to
0 and if X is greater than 0 there is a linear relationship
here it is X and here it is y so you Y means f of X so, you know, this this is the you know
Mathema graphical representation of a reuleaux function. So once the our you know
Output see we have, you know, we used you know in the previous
Video, I used two three corners three kernels or filters as a filters
You can call it as kernels as then so I will tell you filters
or
Kernels, so that's what we used
you know, that is the small pieces or small patches of image and
That we will slide it across the image those
small patches we call it as filters or kernels, so
after the convolution operation
We got three Maps because we used three filters even at that time
I told you can use any number of filters
So we used three filters and we come up with a three
And all the those maps where 7x7?
matrices so when we apply the rail you operation what exactly happens here is I can
Tip I can tell you here. It is a a
Simple operation for example your map. Let's assume that our map is a small a smaller one
We got at that time seven by seven Here. I am taking him three by three by three one. It's over
Let's see our output is you know
Three by three even I you know, I have given an equation for the output
the output, you know, I know that I know what is the
size of the output it is represented by the equation n
Minus F plus one and is the you know image size F is the kernel size and plus one
So this equation we discussed at that time you remember that so let's assume that this is the map
Obtained from the first term, ah, you know a kernel first filtered
So, let's see. This is like, let's assume that this is you know
0.5
This is minus 1
This is a one point zero zero. This is zero point seven five
This is again. You know, you can take it as jump - sub zero point three
This is a one point two. This is three. This is
Minus one point one. This is a
zero point five
So what would be the output after the relu operations?
So we are doing a relict. I know we are doing a reloj operation here. So after the activation function
relu see once it is done with the relu what will happen it will replace all
The negative values with zero. So the map should be like this your map is like this
This is your output after the secondly so the
0.125 it remains same so the minus one should be replaced with zero
1.20 it remains same
0.75 we trip in same - 0.3 replaced in at zero
1.2 remain same here 3 it remains same
0.5 remains same - 1.1 should be replaced with Co
this is what happens after the
You know
the raloo operation the same thing is repeated for you know, the
4 3 kernels we used 2 3 filters or pre kernels the same operation is you know
repeated for all the maps because we got in the first a
Convolution operation we got the output as 3 7 by 7
um maps are no no based on the formula, you know Y n
minus F plus 1 so this is the
number of you know
the size of the image input image here F is the size of the kernel or filter and
1 n minus F plus 1 we discussed this formula as well in the previous
You know video now. I am going to discuss about the max. Pooling layer
So next layer the the we covered the convoluted, you know convolution operation
We covered the raloo operation. Now. We are going to discuss about the max pooling
Operation, so what exactly is happening?
In max pooling so next layer is a max
Pooling
Operation so max pooling layer. This is what we are going to discuss. So what is max pooling layer?
C pooling it is if you are a meniscus about pooling pooling is of three types one
is a pooling it is of
Three types one is max pooling
max pooling is their
Next one is min
Pooling is their then average pooling is also their I will tell you what exactly is pooling
So you have max polling you have min pooling you have average pooling
See pooling layers are used to reduce
Overfitting so what is the use of pooling layers in convoluted neural network it reduce
Overfitting this is the use of pooling layer
So in pooling layer, we shrink the image stack into a smaller size that's what we do
So in a pooling layer, we shrink the image size
Into a you know image stack in doing we are doing the shrinking shrinking of the you know output V
Whatever we got from the relu operation we are
shrinking
So we shrink the image
Stack into a smaller size. So that's what we do here for shrinking this you know, the
The output whatever we got
From the you know our value operation see after the rally operation. There is no negative values
All the negative values are replaced with zeros. So in pooling layer vish ring this image stack
By using here. Also, we use a filter or kernel the filter. We call it as the max pooling filter
Cv the filter we use here. It is a
max pooling
filter
This is the filter we use here by using a max bowling filter
Normally the size of the max bowling filter. We take it as 2 by 2
Or 3 by 3
This is the size of the max pooling filter
C and we take a stride stride of - the stride we are taking here it is 2
Stride means jump, you know when we discuss about the convolution operation
The filter has to jump there
we have taken a stride of 1 so that's why if the formula we got it is, you know Y n
minus F plus 1 but if we are considering the stride as well or
Padding this formula will be modified. We will discuss this later
So here the stride we are taking it as 2 so then we will move this
you know max bowling filter in our
across our filtered image and after that from each
Window we take the maximum intensity or the maximum value
from each window
so what we are going to do I will explain so here we considered a max pooling filter of
Size two by two and the stride is two and we are moving
this max pooling filter across the map
After we got it from the rail operation and we take the maximum intensity value
Or maximum pixel value from that so I will explain you what exactly it is. So
This is the let us assume that this is the you know
Output you got it from the this is a seven by seven map
I am going to you know, draw here 1 2 3
4
5
6 7 this is up 7 1 1 2 3 4 5 6 7 1 2 3
4
5
Six seven, so this map doesn't contain any negative value. You have only positive values
So this contains let's assume that the values are you know zero point seven, you know one
Two three like this or zero point five
six or one
See like this you are having value C if let's assume some random values I am taking here or you can take it
like this one and you know
0.2 all are positive and you know zero one the negative values be removed by the remove
Operation. So this is some random value some arbitrary values
I have taken so what exactly I am trying to explain here
What is the max pulling filter do so here the max pulling filter?
What it is doing here it is
our max pooling filter is of I am taking it as f size of two by two and astride of two so
Here the size of the filter is two by two and stride is to the jump is 2
Usually we take the stride as 2 so 2 by 2 beans. Our max pooling filter will be
Like this, this is our first we place like this. This is our max bowling filter
So what is the maximum value from this as he in this?
max pooling filter when you see here
You have four values zero point seven one zero point five and six
What is the maximum value here? It is six
So what you can do the operation is you will create a map
Again, you will you are shrinking the value C from this
You know four values for each pixel values
We are taking only one so we are again shrinking
So from this I will take six you will take six here
Again I will move so I am taking it stride of two so this you know this
Again, it will move to the next position. So the next position should be like this
This is the next position because it says tried of two
So from this also I can take the maximum value. That is three C
That is three means here 2 3 1 1 that is 3
Again, I am moving taking a stride of 2, so it will come to the next position the next position
Is this so let us assume some values 1 2 3 4 what is the maximum value for here?
So I have got 4 here I put 4 again. I have to move see I see I need one more, you know
Row and column here. I put it like this. So again, I am moving see here
I am putting some values here as well
Let us assume that this is 1 and 2 then my filter will be like this
Here my filter will be like this. So this is the filter so it is here
It would be like this. So here no value
So from this I have 1 & 2 I can take 2 this is the V
So I am taking as tried of 2 in the same way when it moves down as well
I have to take a stride of 2. So the next position will be here. It would be like this. So this
Is the gem next jump it will come like here
So here I will do one to these values then which is the maximum in this position
This is also in the downward
Also, we are taking a stride of - what - after - jump it came here. Then the maximum value is - I
Put it here. Then the next step, you know, I will jump to know this location the position of the map, you know, the
Max bowling kernel should be this so from this
Also, I will take a 1/2 means the maximum value is 2 like this. I am shrinking the input
Image, you know to a you know a smaller size after that
I may be getting you know, I may be getting up, you know, one two three
It would be I believe it would be one two, three a four it would be a four by four, you know
Size the size of the you know output will be four by four. So I am shrinking the
input image
You know into again by the max fooling filter, so why it is max pooling
I told there are three types of pooling on his max pooling
The second one is min pooling and the third one is average pooling in this four values here in the first
case I have taken the maximum value so this
Case we call it as the max pooling if you are taking the minimum intensity value that is 0.5
Then it is min pooling and if you are taking the average value from these
Four then it is the average pooling. So it depends on your requirement. You can take whether it is
Sorry max pooling or min pooling or average pooling
So this is what exactly happens in the max pooling firm layer, so we covered convolution layer
We covered, you know
The ray Lu layer or the activation layer. We covered the max. Pooling layer
So the next layer that is the fully connected layer will be discussing in the next video
So a thanks for watching
