The Convolution & Cross-Correlation Operation
The key operation performed in CNN layers is that of 2D convolution. In fact in practice they are 4D convolutions as we try to learn many filters and we also consider many input images (mini-batch) in the iteration of our SGD optimizer. We cover first the 1-dimensional case.1D Convolution
By definition the convolution between two functions in one dimension is given by:

2D Convolution
In 2D the same principle applies. First, the convolution operation in some frameworks is the flipped version - this is perfectly fine as the convolution operation is commutative. where is the input of the convolution and is the kernel or filter typically of smaller spatial dimensions.
Effects of 2D filtering operations
Moving Average
Lets go through the simplest possible 2D filtering operation as shown below. Note that these implement the convolution.

2D Gaussian
Using a Gaussian Blur filter before edge detection aims to reduce the level of noise in the image, which improves the result of the susually subsequent edge-detection algorithms. We will meet again this 2D Gaussian filter in the object detection section, where it is used to help in the initial segmentation in RCNN architectures.



