Skip to content

KL severity grading using SE-ResNet and SE-DenseNet architectures trained with Cross Entropy loss and Focal Loss. The hyperparameters of focal loss have been fine-tuned as well. Further, Grad-CAM has been implemented for visualization purposes.

Notifications You must be signed in to change notification settings

rae-t627/KL-Severity-Grading-Focal-Loss-Optimization-Grad-CAM

Repository files navigation

Enhancing KL Severity Grading with Focal Loss Optimization and Interpretability through Grad CAM Analysis

Project Structure

.
├── dataset
│   ├── train
│   │   ├── 0
│   │   ├── 1
│   │   ├── 2
│   │   ├── 3
│   │   └── 4
│   ├── val
│   │   ├── 0
│   │   ├── 1
│   │   ├── 2
│   │   ├── 3
│   │   └── 4
│   └── test
│       ├── 0
│       ├── 1
│       ├── 2
│       ├── 3
│       └── 4
├── models
├── custom_densenets.py
├── custom_resnets.py
├── Grad-CAM.ipynb
├── hyperval.py
├── README.md
├── requirements.txt
├── se_nets.py
├── test.ipynb
├── train.py
└── utils.py

Running the files

Dataset can be downloaded from here.

Training:

Example statement:

python3 train.py -m resnet -d dataset -b 32 -l ce -o test -e 100 --learning_rate 1e-3

Make sure your path to the dataset is correct. Other parameters can be changed. Do refer to the parser arguments for the same.

Computing accuracy on Test set, Grad-CAM

To change any of the parameters, go to the notebook and change the parameters in the parser statement

Hyperparameter Optimization:

Example statement:

python3 hyperval.py -m resnet -o test -e 100 -n 100 -s study_name

Other parameters can be changed. Do refer to the parser arguments for the same.

Results

Model weights can downloaded from here.

Architecture Accuracy Precision Recall F1
SE-ResNet18 (CE loss) 68.12 63.67 68.12 64.69
SE-DenseNet (CE loss) 69.14 67.21 69.14 67.85
SE-ResNet18 (FL) 67.75 68.56 67.75 67.83
SE-DenseNet (FL) 68.05 70.68 68.05 68.78
SE-ResNet18 (tuned FL) 69.38 67.59 69.38 67.75

About

KL severity grading using SE-ResNet and SE-DenseNet architectures trained with Cross Entropy loss and Focal Loss. The hyperparameters of focal loss have been fine-tuned as well. Further, Grad-CAM has been implemented for visualization purposes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published