[Study Notes] Week1_Convolutional Neural Networks_Padding

1. Padding

1. Disadvantages of image edge detection with convolution operation:

    1) Image edge detection with convolution operation will make the image Shrink (compressed)

        After one convolution, the image resolution is: n - f + 1 * n - f + 1         # The original image resolution is n * n; the convolution kernel size is f * f

        Image resolution becomes very small after multiple convolutional layers

    2) The pixels at the edge of the image are rarely used and lose a lot of information

    The solution is to refill the p = padding circle of pixels around the image (all with a gray value of 0 for convenience)

    After one convolution, the image resolution is: n + 2p - f + 1 * n + 2p - f + 1

    

2. How many circles of pixels to fill (two methods)

    1)Valid Convolutions

        not filled

        

    2)Same Convolutions

        Make the output image the same size as the input image

        p = (f - 1) / 2         # f is odd (in the field of computer vision, f is usually odd, if f is even, then asymmetric padding on both sides is required)

        

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325524029&siteId=291194637