It is known that the input image size is n, the convolution kernel size is f, the convolution step size is s, and the padding size is p. Solve the output image size.

Problem description: It is known that the input image size is n, the convolution kernel size is f, the convolution step size is s, and the padding size is p. Solve the output image size.

Questions and Answers:

The size of the output image can be determined using the following calculation formula:

output=\frac{n+2p-f}{s}+1

To illustrate, assume the following parameters:

  • Input image size n=10 (assuming a square image),
  • Convolution kernel size f=3,
  • Convolution step size s=2,
  • Pad size p=1.

Plug these values ​​into the formula:

output=\frac{10+2\times 1-3}{2}+1=5.5

When calculating pixel positions in image processing, rounding down is often used, so the output image size is 5

Guess you like

Origin blog.csdn.net/weixin_43501408/article/details/135412355