This repo is a comparative study of performance between CNN from scratch and using transfer learning :
Properties | Details |
---|---|
Name | Intel Image Classificaiton |
Source | Kaggle |
Author | PUNEET BANSAL |
Data Type | Images |
Problem Type | Image Classificaiton |
Files | 3 Folders (14K Training , 3K Testing , 7K Prediction) |
Classes | 6 Classes (Buildings, Forest, Glacier, Mountain, Sea, Street) |
- Image Resizing : Image has been resized to
(150,150)
- Image Normalisation : Normalising pixel values from
0-255
to between0-1
- Encoding Image Labels : Transforming labels from categorical format to numerical using
Label Encoder
In this part we will go through the different CNN version that we created from scratch and using transfer learning with different versions compare the results including fine-tuning :
- Simple CNN :
- 1 convolutional layer
(32 Units)
- 1 MaxPooling layer
- 2 Dense Layers
( 128 Units , 6 )
- 10 Epochs
- 1 convolutional layer
- Deep CNN :
- 4 convolutional layers
(2 * 32 Units + 64 Units + 128 Units)
- 4 Maxpooling Layers
- 3 Dense Layers
(128 Units + 64 Units , 6 )
- 10 Epochs
- 4 convolutional layers
- Deep CNN + Fine-tuning :
- Same previous Architecure
- Change optimizer to
Adamax
- Added Callbacks (
early stopping
+LR Scheduler
) - 20 Epochs
- InceptionV3 I :
- Excluding Original Classification layers (
include_top = False
) - Using ImageNet Weights (
weights='imagenet'
) - Unfreezing the first 25 layers (
inception1.layers[-25:]
) - Adding Costume classificaiton head :
- Dense layer
(1024 units)
- Dropout layer
Dropping 20% of units (0.2)
- Classification layer (last dense layer)
(6)
- Dense layer
- Optimizer
Adamax
with starting learning rate of0.0001
- Callbacks (
early stopping + retreive best weights
) - 20 Epochs
- Excluding Original Classification layers (
- InceptionV3 II :
- Same Previous Architecture
- Unfreezing the last 25 layers instead (
inception2.layers[25:]
) - 20 Epochs
- InceptionV3 III :
- Using the full architecture (
48 Layers
) - Different Costume classificaiton head :
- Batch Normalization Layer
- 2 Dense Layers (
256 Units + 128 Units
) - 1 Classification layer (
6
)
- Same Callbacks
- 20 Epochs
- Using the full architecture (
- Training : The Simple CNN did a horrible job with evaluation of
68%
Accuracy &140%
Loss
- Prediciton : The bad training explains the bad predictions done by the simple CNN failing to classify a lot of image
- Training : The Deep CNN did a better job than the normal CNN with evaluation of
81%
Accuracy but still having errors with82%
Loss
- Prediciton : The defective training explains the wrong predictions done by the Deep CNN failing to classify some images
- Training : The Fine-tubned Deep CNN did a better than the previous models with evaluation of
82%
Accuracy but still having errors with49%
Loss (still high loss)
- Prediciton : The improvement in the training results can be seen in the predictions done by the fine-tuned CNN
- Training : We can already see the supremacy of transfer learning here with evaluation of
90%
Accuracy but still having errors with27%
Loss
- Prediciton : The difference cannot be really seen here , but overall it's doing way better than previous models
- Training : Freezing the first 25 layers insead showed difference with
91%
Accuracy but still having errors with25%
Loss
- Prediciton : The difference cannot be really seen here , but overall it's doing way better than previous models
- Training : Using the whole model made the performance inferrior than previous versions of inception with evaluation of
89%
Accuracy but having more errors with30%
Loss
- Prediciton : The difference cannot be really seen here , but overall it's doing a bit worse than the other inception versions
- The Transfer learning models are
doing exponentionally better
than the best from-scratch CNN model ( the fine-tuned version)
- This is the confusion matrices of each models giving better context at the overall performances