Convolution padding and strides


Convolution, padding, and strides are three important concepts in convolutional neural networks (CNNs).

  • Convolution is a mathematical operation that takes two functions and produces a third function that represents the result of sliding the first function over the second function and summing the products of the overlapping elements. In CNNs, convolution is used to extract features from images.
  • Padding is a technique used to add zeros around the edges of an image before it is convolved. This is done to prevent the output of the convolution from shrinking. There are two types of padding:
    • Zero padding: This is the most common type of padding. It adds zeros around the edges of the image.
    • Reflect padding: This type of padding reflects the edge pixels of the image to the opposite side.
  • Strides is the number of pixels that the filter is moved over the image during convolution. A stride of 1 means that the filter is moved one pixel at a time. A stride of 2 means that the filter is moved two pixels at a time, and so on.

Let's take an example of convolution with padding and strides. Let's say we have an image with dimensions 10x10 and a filter with dimensions 3x3.

If we use zero padding, the output of the convolution will have dimensions 12x12. If we use a stride of 2, the output of the convolution will have dimensions 6x6

Convolution padding and strides


Enroll Now

  • Python Programming
  • Machine Learning