I was wondering, when you convolve with a 2x2 kernel, where do you put the result of the operation ? With a symmetric mask the result is applied to the pixel corresponding to the center of the mask; so what happens when a mask doesn't have a center ? Besides, why would someone use an even sized kernel ?
Except for scaling, few works have implemented even-sized kernels as basic building blocks for their CNN models.
Save this answer. Show activity on this post. The kernel doesn't need to be odd.
A common choice is to keep the kernel size at 3x3 or 5x5. The first convolutional layer is often kept larger. Its size is less important as there is only one first layer, and it has fewer input channels: 3, 1 by color.
In image processing, a kernel, convolution matrix, or mask is a small matrix used for blurring, sharpening, embossing, edge detection, and more. This is accomplished by doing a convolution between the kernel and an image.
It doesn't really matter, but whichever approach you use you may get a 0.5 pixel shift in the resulting image. You can see why this might happen intuitively by considering your 2x2 example as 3x3 with zero padding, e.g.
k00 k01 0
k10 k11 0
0 0 0
As for why you might want to use an even size - one application of convolution is cross-correlation (flipping one of the images changes convolution to correlation and vice versa). Cross-correlation has many uses, including template matching (finding a target image within a larger image), so if your template has an even size then the resulting convolution/correlation will also involve an even sized "kernel".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With