Feature Extraction
In MNIST dataset, we have images of size 28*28 b/w (0-9), even without Feature extraction, we can predict the output.
In the real world, the data will be 2k, 4k video; 1024*1024 images, and much more high-resolution videos and images. In such cases, every pixel information is important. If an image is 1024*1024 size, it will have 10+ million features, these are a huge number and required a high amount of computational capacity. We have to minimize these many features by feature Elimination, which is followed in N.N. Feature elimination should be in such a way, that we don't lose any important information from the observation. Even though we might lose important feature information as shown below,
In the process of Feature elimination, my observation lost its important feature(his ear gone).
So before future elimination, we should do Feature extraction to overcome this type of challenge. this technique is called Convolution.
In general, Human eyes used Convolution in preserving any important information like below,
if we have pic A in the scenery, human convolutes(preserves) the pic B. Huan eye will take every granular information in any scenery which is imp. The human mind has this intelligence to filter important information.
Human uses Edge detection for detecting anything
Initially, we were taking every pixel of an image as a feature, like the boxes in the below image.
In Feature Extraction, we get the information, combine them, and use it as a Feature. In this pic, we combined some features(correlated features) of the nose, lips, eye, and ear as X1, X2, X3, AND X4 features. By this, we don't lose any imp. info and we can eliminate the necessary features.
Conclusion:
For feature extraction in getting correlation features we use Convolution, these correlated boxes(all features in box) are given to N.N to eliminate the unnecessary features(boxes), this is how CNN works.
A feature defined in the Convolution is the group of individual features, that makes one important feature. Those individual features are correlated to each other for an imp. feature of the observation.
A human eye can detect the object by color variance, data type, and lots of constraints. The computer also uses the same technique of color variance for detection, such a process is called Edge detection.
Humans use the above process of object detection in finding imp features, where these are RGB variance in flow, we detect there is an object between.
Computer used Convolution to detect objects
Compter also uses the same way in detecting an object by a filter/kernel/feature detector. Arranging boxes in total image. Box size depends on the feature of the image.
- If the box size is small, our features/Granular content increases.
- If the box size is huge, we might miss some imp content.
Typically the box Size is 3 * 3.
https://en.wikipedia.org/wiki/Kernel_(image_processing)
let's make some boxes for the pic,
In the above, we selected some of the features A - E; Here, we find some challenges about this process of detection.
In E, there is a drop of RGB, and the computer can find/detect the object. same in D and C.
In A, B features, there is no RBG variance and our N.N may delete these features. Without these A and B, image data is not complete. So to avoid this kind of Challenge, we arrange boxes in a jumping manner with values, this value or jumping is called Stride. Shown above pic with box jumping and boxes are 1, 2, and 3. By this stride, we won't lose any imp. feature of the image. Standard stride values are 1 or 2.
Convolution uses this Stride and Edge detection concept in feature extraction, but this is not an exact convolution.
[ Note: From this article, I will use google Colab in place of jupyter, as both are the same. Google collab is easy to use, share, and text between the commands]
Let's understand the Exact meaning of convolution with an example;
1D array dataset: Click the link
for 1d array example, an analogy also used in the example.
2D array dataset:
Click the link
for a 2D array example, an analogy also explained.
Summary:
In both example's we made edge detection by convolving the base image or dataset with a random variable of 1d or 2d array to define the place of object detection place.
This random variable is called Kernel or filter or feature detector.
By this the convolution we get imp feature from the image as shown below
we still have feature elimination for an image, will discuss that in the next article.