What is “padding” in Convolutional Neural Network?

Ting-Hao Chen
Machine Learning Notes
1 min readNov 7, 2017

Padding is to add extra pixels outside the image. And zero padding means every pixel value that you add is zero.

Let’s see some figures. The black color part is the original size of the image.

If zero padding = 1, there will be one pixel thick around the original image with pixel value = 0.

Every time we use the filter (a.k.a. kernel) to scan the image, the size of the image will go smaller and smaller. We don’t want that, because we wanna preserve the original size of the image to extract some low level features. Therefore, we will add some extra pixels outside the image!

--

--