AI: ML/DL Convolutional Neural Network

Convolutional Neural Network:

Convolutional Neural Network is a specialized neural network designed for visual data, such as images & videos. But CNNs also work well for non-image data (especially in NLP & text classification).

Its concept is similar to that of a vanilla neural network (multilayer perceptron) – It follows the same general principle of forwarding & backward propagation.

What is Convolution?

Mathematically, convolution is the summation of the element-wise product of 2 matrices.

Let us consider an image ‘X’ & a filter ‘Y’ Both of them, i.e. X & Y, are matrices (image X is being expressed in the state of pixels). When we convolve the image ‘X’ using filter ‘Y’, we produce the output in a matrix, say’ Z’.

Let’s begin the journey!! Let’s start by familiarizing ourselves with the meaning of CNN (Convolutional Neural Network) along with its significance and the concept of convolution.

What is Convolutional Neural Network?

Convolutional Neural Network is a specialized neural network designed for visual data, such as images & videos. But CNNs also work well for non-image data (especially in NLP & text classification).

Its concept is similar to that of a vanilla neural network (multilayer perceptron) – It follows the same general principle of forwarding & backward propagation.

Why do we need Convolutional Neural Network?

Although vanilla neural networks (MLPs) can learn highly complex functions, their architecture does not exploit what we know about how the brain reads & processes images.

The architecture of Convolutional Neural Network uses many of the working principles of the animal visual system & it has been able to achieve extraordinary results in image-related learning tasks.

For this reason, MLPs haven’t been able to achieve any significant breakthroughs in the image processing domain.

What is Convolution?

Mathematically, convolution is the summation of the element-wise product of 2 matrices.

Let us consider an image ‘X’ & a filter ‘Y’ (More about filter will be covered later). Both of them, i.e. X & Y, are matrices (image X is being expressed in the state of pixels). When we convolve the image ‘X’ using filter ‘Y’, we produce the output in a matrix, say’ Z’.

What are Filters/Kernels?

A filter provides a measure for how close a patch or a region of the input resembles a feature. A feature may be any prominent aspect – a vertical edge, a horizontal edge, an arch, a diagonal, etc.

A filter acts as a single template or pattern, which, when convolved across the input, finds similarities between the stored template & different locations/regions in the input image.

Let us consider an example of detecting a vertical edge in the input image.

Each column of the 4×4 output matrix looks at exactly three columns & three rows (the


boxes show the output of the filter as it moves over the input image). The values in the output matrix represent the change in the intensity along the horizontal direction w.r.t the columns in the input image.

The output image has the value 0 in the 1st & last column. It means there is no change in intensity in the first three columns & the previous three columns of the input image. On the other hand, the output is 30 in the 2nd & 3rd column, indicating a change in the intensity of the corresponding columns of the input image.

Why do we do Padding?

Every time we apply a convolution operator, our image shrinks (in the above example, our vision shrunk from 6 x 6 to 4 x 4). If we convolve the output again with a filter, our image shrinks.

If we continue this process, we lose a lot of information because of image shrinking, which is one of the downsides of convolution.

During convolution, the pixels in the corners & the edges are considered only once. This is the 2nd downside of convolution. If we consider any pixel in the middle, many (fxf) regions overlap the pixel (we shift the filter & observe the image through it, i.e. convolve). Thus, the pixels on the corners or the edges are used much less in the output. So, we throw away a lot of information near the edge of the image.

What is Stride?

The stride indicates the pace by which the filter moves horizontally & vertically over the pixels of the input image during convolution.

What is Pooling?

A pooling layer is another essential building block of CNN. It tries to figure out whether a particular region in the image has the feature we are interested in or not.

The actual dictionary meaning of pooling is the act of sharing or combining two or more things. In CNN, the pooling layer does a similar job. It summarizes the featured map so that the model will not need to be trained on precisely positioned features, making a model more reliable and robust.

The pooling layer looks at more significant regions (having multiple patches) of the image & captures aggregate statistics (min, max, average & global). In other words, it makes the network invariant to local transformations.

The two most popular aggregate functions used in pooling are ‘max’ & ‘average’:

Max pooling – If any of the patches say something firmly about the presence of a particular feature, then the pooling layer counts that feature as ‘detected’.

Average pooling – If one patch says something very firmly, but the other ones disagree, the average pooling takes the average to find out.

Krish Naik SUNNY BHAVEEN CHANDRA

CNN



要查看或添加评论,请登录

Srikanth Reddy的更多文章

社区洞察

其他会员也浏览了