Convolutions are one of the key features behind Convolutional Neural Networks. For the details of working of CNNs, refer to Introduction to Convolution Neural Network.
Feature Learning
Feature Engineering or Feature Extraction is the process of extracting useful patterns from input data that will help the prediction model to understand better the real nature of the problem. A good feature learning will present patterns in a way that increase significantly the accuracy and performance of the applied machine learning algorithms in a way that would be impossible or too expensive by the machine learning itself. Feature learning algorithms find the common patterns that are important to distinguish between the wanted classes and extract them automatically. After this process, they are ready to be used in a classification or regression problem.
Let us consider a popular image classification problem, classification of images of a face and a non-face object. In the early days of computer vision, scientists tried to solve the problem by hand coding the detection algorithms of possible features of a human face like shape, eyes, nose, lips etc. This approach usually gave poor results because a face may appear in so many varieties, that it was not possible to account for even a significant fraction of the features. Just a simple change in lighting or orientation can bring about change in an image such that the algorithms were no longer able to detect faces.
In 1998, Yann Lecun introduced the concept of Convolutional Neural Networks which was capable of classifying images of handwritten characters with about 99% accuracy. The great advantage of Convolutional Neural Networks is that they are uncommonly good at finding features in images that grow after each level, resulting in high-level features in the end. The final layers (can be one or more) use all these generated features for classification or regression.
Convolution
Convolution is an operation that is performed on an image to extract features from it applying a smaller tensor called a kernel like a sliding window over the image. Depending on the values in the convolutional kernel, we can pick up specific patterns from the image. In the following example, we will demonstrate detection of horizontal and vertical edges in an image using appropriate kernels.
Python3
import numpy as np
import matplotlib.pyplot as plt
# let img1 be an image with no features
img1= np.array([np.array([200numpy as np0200numpy as np2200numpy as np0200numpy as np6
numpy as np7= np.array([np.array([200numpy as np0200numpy as np2import4numpy as np0import4numpy as np6
import8= np.array([np.array([200numpy as np0import4numpy as np2200numpy as np0import4numpy as np6
0= np.array([np.array([ 3numpy as np0 3numpy as np2 7 3numpy as np0 7 3numpy as np6
# let img1 be an image with no features3# let img1 be an image with no features4# let img1 be an image with no features5# let img1 be an image with no features6
# let img1 be an image with no features8= np.array([np.array([ 3numpy as np0 7 3numpy as np2 3numpy as np0 7 3numpy as np6