Convolution layer and the difference between the padding layer cell parameter "SAME" and "VALID" in

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/zhou4411781/article/details/100541493

padding effect parameter is determined when performing the convolution operation or a pool, whether the input edge up image matrix 0, 'SAME' is zero padding, 'the VALID' is not complementary, since the filter is not possible during these operations the data in a certain direction just processed.

  • VALID mode
											     |dropped
inputs:         1  2  3  4  5  6  7  8  9  10 11 (12 13)
                |______________|                
                               |_______________|

For VALID method, the output size is calculated as follows:

out_width = out_height = ⌈ (s_input – s_filter + 1)/ s_stride ⌉

Wherein, s_input is the size of the input, s_filter the size of the filter, s_stride in steps, ⌈⌉ is rounded up.

  • SAME mode
                                                    |pading
inputs:      1  2  3  4  5  6  7  8  9  10 11 12 13 |0   0   0
           	 |______________|
                            |______________|
                                           |_________________|

For SAME, the output size is calculated as follows:

out_width = out_height = ⌈ s_input / s_stride ⌉

Wherein, s_input is the size of the input, s_stride in steps, ⌈⌉ is rounded up


Reference: https://www.cnblogs.com/White-xzx/p/9497029.html

Guess you like

Origin blog.csdn.net/zhou4411781/article/details/100541493