In this blog, we are going to look at the following topics.
- About CNN
- Image Kernels and filters
- Convolutions
- Pooling Layers
Convolutional Neural Networks (CNN) is a specific architecture of Neural Networks that are extremely effective at dealing with image data.
COMPUTER VISION — Computer Vision is a general term of using a computer program to access image data.
IMAGE KERNEL- Filters are essentially an image kernel, which is a small matrix applied to an entire image. For more details click here. Filters are referred to as convolution kernels.
Convolution– The process of passing them over an image is known as convolution.
Convolution is using a ‘kernel’ to extract certain ‘features’ from an input image. Let me explain. A kernel is a matrix, which is slid across the image and multiplied with the input such that the output is enhanced in a certain desirable manner
For example, the kernel used above is useful for sharpening the image. But what is so special about this kernel?? Consider the two input image arrangements as shown in the example below. For the first image, the center value is 3*5 + 2*-1 + 2*-1 + 2*-1 + 2*-1 = 7. The value 3 got increased to 7. For the second image, the output is 1*5+ 2*-1 + 2*-1 + 2*-1 + 2*-1 = -3. The value 1 got decreased to -3. Clearly, the contrast between 3 and 1 is increased to 7 and -3, which will, in turn, sharpen the image.
Instead of using manually made kernels for feature extraction, through Deep CNNs, we can learn these kernel values which can extract latent features.
Convolutional Layer — A convolutional layer is created when we apply multiple images to the input images. The layer will be trained to figure out the best filter weight values.
2. Using Artificial Intelligence to detect COVID-19
3. Real vs Fake Tweet Detection using a BERT Transformer Model in few lines of code
4. Machine Learning System Design
CNN also helps reduce parameters by focusing on local connectivity, not all neurons are fully connected. Instead, neurons are only connected to a subset of local neurons in the next layer.
CNN 1 Layer
CNN 2 Layers
ANN (I have already taught Artificial Neural Networks in deep in my last blog. Click here to read.
Note 2 Layers are enough for Grayscale images. For colour images, we need 3 Layers as Red Green Blue is 3 colours present in a colour image.
Note one thing that a computer won’t know a channel is red, it’s just known that there are 3 intensity channels. So to come up with this.
CNN layer is fed into another convolutional layer. This allows the networks to discover patterns within patterns, usually with more complexity for later convolutional layers.
When dealing with colour images and possibly 10s and 100s of filters we will have a large number of parameters. In order to reduce it, we use pooling layer.
Pooling layer accepts convolutional layers as input as shown in image.
- Taking Maximum values from 1, 3, 4 and 2 so the outcome is 4.
2. Taking Maximum values from 6, 8, 9 and 7 so the outcome is 9.
3 Similarly
Another way is taking the average of the filters. As shown below.
Pooling layer reduces the number of parameters. Pooling layer can reduce lots of small pooling kernels around 75% of the input data.
Dropout — Dropout can be thought of as a form of regularization to help prevent overfitting. During training, units are randomly dropped, along with their connections. This helps prevents units from “co-adapting” too much.
Credit: BecomingHuman By: Shreyak