kernel = filter
CNN的计算过程:
计算元素积
将权重矩阵中的每一个元素和6x6的矩阵中的元素做乘积,可以得到4x4矩阵中的目标值,比如第一个乘积是
3x1 + 0 + (-1x1) + 1x1 + 0x5 + (-1x8) + 2x1 + 0 + (-1x2) = -5, so the first block of the 4x4 matrix is -5
horizontal edge detection and vertical detection
sobel filter and scharr filter as well as the self-definded filter w1-w9
use 0 to pad the extra blanks
n + 2p - f + 1
n is the length/width of the original matrix
p is the extra blanks on the single edge
f is the length/width of the kernel
according to this equation, the size of final width / length of the matrix can be computed.
in order to keep input size same as the output size, p and f should be well computed.
common kernel size like 1x1,3x3,5x5,7x7
for the summary of convolutions
such as there is an image of 7x7, and the stride is 2, the filter is 3x3, the padding is 0
so (7+2x0-3)/2+1=3, the final matrix is 3x3
原文:https://www.cnblogs.com/yuyukun/p/12683137.html