Class activation maps, Weight Updates, Optimizers & LR Schedulers
The model is trained using CIFAR-10 dataset. It consists of 60000 32x32 color (3-channel) images in 10 classes, with 6000 images per class. There are 50000 training images and 10000 test images. It has the classes: ‘airplane’, ‘automobile’, ‘bird’, ‘cat’, ‘deer’, ‘dog’, ‘frog’, ‘horse’, ‘ship’, ‘truck’.
Figure 1 : Random images from dataset
- Apply Transformation using Albumentation Library ( RandomCrop(32, padding=4) and CutOut(16x16))
- Implement GradCam.
- Train ResNet18 on Cifar10 for 20 Epochs
Code Explanation
All the python scripts are cloned from repository MyMainRepo. The repo has the following structure
- models/restnet.py (contains the Resnet18 model)
- main.py (contains training and testing function)
- utils.py (contains image augmentation, gradcam functions ...)
Albumentation
The transformation is applied using library albumentations.
Figure 2 : transformation applied different times on same image
The summary of the model is shown below
Result
The training log for 20 eposchs is shown below
Figure 4.1 : log1 (epoch 1 to 8)
Figure 4.2 : log2 (epoch 8 to 14)
Figure 4.3 : log3 (epoch 14 to 20)
The test and validation loss and accuracy are shown below
Figure 5 : Plot for loss and accuracy
Misclassified Images during validation
Misclassified images during validation for all the three models are shown below
Figure 7 : Misclassified images
GradCam output on misclassified images Gradient-weighted Class Activation Mapping (GradCAM) uses the gradients of any target concept (say logits for 'dog' or even a caption), flowing into the final convolution layer to produce a coarse localization map highlighting the important regions in the image for predicting the concept