CNN example and Standard Architecture
CNN Example:
Let's apply our previous article analogy and do an example by constructing 2 C.L, 2 P.L, 1 Flatten layer, and 2 dense o/p layer's with 32 filters in each C.L and P.L
I am taking an example(Example of using .flow_from_directory(directory):) from Keras (https://keras.io/api/preprocessing/image/) of image data processing: For this example am taking cat or dog test image for prediction.
As Keras accepts only 4D data, I transferred my 3D data into 4D.
The CNN dataset given has 2 folders test and train sets with 8000 samples(cat and dog) for the train set and 2000(cat and dog) samples for the test set.
As Keras internally use, Pillow module for image processing, we should install it.
Standard Nets:
Normally Convolution layer with activation function and pooling layer is done for feature extraction is called CRP layer(convolution, Relu, and pooling). pooling is also called sub-sampling. No. of CRP and FCL layers defines the accuracy of the CNN model. By this we have many models available, we are discussing LeNet and AlexNet as these are building blocks for many upcoming and past models.
LeNet:
CNN architecture was found in 1988 by Yann LeCun is called LeNet. This is a base network architecture for N.N. This LeNet has 2 CRP layers and 2 fully connected layers
Reference: https://medium.com/@pechyonkin/key-deep-learning-architectures-lenet-5-6fc3c59e6f4
I am taking MNIST dataset as an example for LeNet architecture explanation,
The test accuracy for the MNIST dataset for LeNet is 99.14%, such an accurate architecture.
AlexNet:
After 5 years of Lenet, Alex Krizhevsky is a computer scientist most noted for his work on artificial neural networks and deep learning. Shortly after having won the ImageNet challenge 2012 through AlexNet. AlexNet contained eight layers; the first five were CRP layers, and the last three were fully connected layers.
Reference: https://towardsdatascience.com/alexnet-the-architecture-that-challenged-cnns-e406d5297951.
I am taking the CIFAR-10 dataset as an example for AlexNet Explanation, the CIFAR-10 dataset is used for object detection.
In CRP layers, we use R--> Relu as an activation function(A.F) for better results, if our requirement changes we can vary the A.F.
Day-27:
On Day-27: A task for MLOps was explained and some intro next-day article was given, ie.,
If wan can observe the LeNet and Alexnet models CRP Layers are increased for Better accuracy. But the Con here is resource handling, if we have many CRP layers then we need more CPU/Memory and Time. For example in Day-26, i.e, in the above example of LeNet,
we can clearly observe that for a single Epoch, we need approx, 12hrs for model training for my Laptop(low configured one).
To avoid, this we have some Advance CNN models where some data scientists built a model on some categories and made available for the market.
Note: I will add the task in the upcoming article by completing it.