Convolution Layer
Overview
A convolution layer in a convoluational neural network is a layer that performs a particular kind of
feature extraction. In particular, the layer performs a convolution (see below)
extracts certain features from the image prior to running the optimization.
Example
Starting with an image reprented by the the following matrix of pixel values.
Convolution takes a filter and convolves it with the image data. For this example, we use the Sobel filter given here
Convolving involves taking this filter, moving it over the image and multiplying the values in the filter by the value in the
image, then adding all the results to get the final value.
In this case, the first value is found by
{% value = 100\times 1 + 100 \times 0 + 100 \times -1 + %}
{% 100 \times 2 + 100 \times 0 + 100 \times -2 + %}
{% 100 \times 1 + 100 \times 0 + 100 \times -1 = 0 %}
Then the second value is found by moving the filter over by a single index and then recomputing.
{% value = 100\times 1 + 100 \times 0 + 0 \times -1 + %}
{% 100 \times 2 + 100 \times 0 + 0 \times -2 + %}
{% 100 \times 1 + 100 \times 0 + 0 \times -1 = 400 %}
The result of convolving the filter on the original image is
Padding
the result of a convolution is a matrix of smaller size than the original image. This means, that to recover an image of the same size
as the original typically involves padding the image by adding rows and columns to get back to the original image size. The typical value
used in the padding is zero (ie. black).
Padding the above result will give the following.
Filters