Padding Layer#
What do padding layers do?#
Padding layers pad special values to your input. Usually padding layers are used on images, to pad the edge pixels such that the convolution filters can move all the way to the edge of the image. There are several ways to pad. Most common ways include padding 0 values, or mirror padding. 0 padding is self-explanatory, and mirror padding is like having a little mirror on the edge of your image. The padded pixels ‘mirror’ the real pixels.
When to use padding layers?#
Almost always when you are using a convolution-based model. Due to the nature of sliding convolution filters, you don’t really have an alternative to padding layers if you want the convolution window to slide all the way to the edge.