This is the repository for Pytorch Implementation of
"Grad-CAM: Visual Explanations from Deep Networks via Gradient-based Localization".
If you have any issues regarding this repository, please contact [email protected].

STEP 1 : Data preperation

As we are fine-tuning the model, we will only be taking a small portion of the original training set.

$ cd ./1_preprocessor
$ python main
> Enter mode name : split # This will make a train-validation split in your 'split_dir' in config.py> Enter mode name : check # This will print out the distribution of your split.> Enter mode name : meanstd # This will print out the meanstd value of your train set.

STEP 2 : Classification

This will fine-tune a pre-trained resnet-50 model on your dataset.
To train your network on different models & layers, view the scripts. See README-classifier for further instructions.

STEP 3 : Detection

After you have trained your model, there will be a model saved in the checkpoint directory.
The files in directory will be automatically updated in the detector module, searched by the directory name of your training set.

In the configuration of module 4, match the 'name' variable identical to the 'name' you used in your classification training data directory name.

The heatmap generation for each of the test data can be done by running,