When analyzing complex data, especially images, artificial neural networks often require pre-processing steps known as feature extraction or feature engineering to perform well. For images, this refers to using hand-made filters, known as kernels, to extract patterns, properties, and shapes from a raw image.
Convolutional neural networks (CNNs), are designed to learn and perform feature extraction by themselves. Before reaching fully connected layers that complete a prediction at the end, data passes through sets of convolutional layers which are designed to perform feature extraction, and pooling layers that reduce the dimensions of the data to save computing power.
Convolutional Kernels
Convolutional layers perform feature extraction, detecting the most important components of the image, using a set of learnable filters known as kernels.
Kernels are small matrices of numbers that convolve, or “slide over'' each position on the input image. They perform an element-wise multiplication and summation at each position, resulting in a new image. Kernel convolutions are the core of all low level digital image filters. For instance, convolving a sharpening kernel across an image exaggerates the difference between each pixel and its surrounding pixels, resulting in a sharper image.
Kernels are used by neural networks for feature extraction. However kernels in neural networks are not designed by hand, but are rather learned by the network during training, through backpropagation and gradient descent.
Kernels in CNNs often also have three dimensions, with the depth matching the number of input feature maps, or channels, from the previous layer, because the kernel must convolve over the entire depth of the input volume in order to produce only one feature map per kernel. For example, if a layer has an input volume of 32 feature maps, then each kernel in that layer must have a height of 32. In turn, the number of feature maps passed down to the next layer is equal to the number of kernels in the current layer. The RGB colour channels in the coloured image can be represented as an input volume as well, with three separate layers.
Figure _. a convolutional kernel acting on an RGB input, with three input channels, and two kernels, resulting in two output channels. The subsampling stride is 2.
< Insert image of Kernel acting on 3 feature maps from Stanford notes>
Increasing subsampling stride may be used to save computation in convolutional layers by only sampling every few layers. The above example has a subsampling stride of 22, meaning it only convolves over every second pixel. With an initial 553 tensor, it also incorporates a one pixel zero-padding on each side so that the convolution can reach the edges of the original image. Overall, this results in a 553 tensor being transformed into a 332 tensor.
Pooling layers directly reduce the dimensionality of data, and save computational cost, similar to increasing stride in the convolutional layers. To do so, a standard max-pooling layer with 22 stride and filter dimensions keeps only the maximum value in its filter. This scales the map down to ¼ its original area.
Figure _: Max pooling layer - this is also from Stanford CS notes
These convolutional layers are put in series, such that each layer would be able to learn to pick up increasing levels of abstraction. For example, the first layer’s feature maps might highlight certain edges, the second one highlights curves, and the third one detects broader shapes. If the purpose of the CNN is to classify images, the dimensionality of the data is eventually reduced to a one dimensional list of possible answers.
The final layers in a CNN are often fully connected layers, which are the same as those in conventional multilayer perceptrons. They are used to make the final prediction.
One advantage of convolutional neural networks is that they should have much fewer parameters compared to a traditional fully connected neural network of the same complexity. This is because they have a smaller receptive field, which is the size of the kernel instead of the entire previous layer in a fully connected network.
Additionally, since kernels convolve over the entire area of an image, they are much more likely to be location-independent.
However, there remains the question of how neural networks learn the relationships between the inputs and correct outputs. Without fitting to data, a neural network is merely a series of randomly initialized matrix multiplications.
Can you take the above and edit it to minimize repetition, flow better, and be a bit more concise? Do not remove any information whatsoever.