What is Padding in Convolutional Neural Network’s(CNN’s) padding
(Multi-Class image classification step by step guide part 4)
So what is padding and why padding holds a main role in building the convolution neural net.
So when it come to convolving as we discussed on the previous posts the image will get shrinked and if we take a neural net with 100’s of layers on it.Oh god it will give us a small small image after filtered in the end.
And also if we just take a 3 by 3 filter on top of gray scale image and do the convolving what will happen.So I decided to put an image to make it easy for who ever reads this.
So if you take this gray scale image.The pixel in the corner will only get covers one time but if you take the middle pixel it will get covered more than once basically what does that means is we have more info on that middle pixel so these are the two main downsides
- Shrinking outputs
- Loosing information on corners of the image
To overcome this we can introduce Padding to an image.So what is padding
It’s an additional layer that we can add to the border of an image.For an example see the figure below there one more layer added to the 4*4 image and now it has converted in to 5*5 image
So now there is more frame that covers the edge pixels of an image cool.More info more accuracy that’s how neural net works so we have more info now we can get more accuracy doneeeeeee.But well apart from that now we are getting an end image that is larger than the original okays now still the shrinking will happen but we can get kind of a good image than going forward like before without the padding.Cool so that’s how padding works.