Skip to content

Aa-Aanegola/Grad-CAM

Repository files navigation

Grad-CAM

Statistical Methods in AI, Spring 2021

About

Implementation based on the paper by Selvaraju et al.

Pytorch implementation for Grad-CAM, using pytorch hooks, which enable us to access the individual gradients during backpropagation. The GradCAM implementation can look at the gradients flowing through any specified CNN layer in the model and compute a class activation mapping. By choosing the label from which we backpropagate from, it is possible to observe the regions of interest pertinent to the label.

The implementation also includes extensions of GradCAM such as:

  • Class Discriminative GradCAM
  • Guided GradCAM
  • Counterfactual Activation Map

File Structure

GradCam.py contains the main implementation of the GradCAM and its extensions. The jupyter notebooks use modules imported from GradCam.py, and demonstrate their usage.

Results

  • Base GradCAM

Base GradCAM

  • Class Discriminative GradCAM

Target Oriented GradCAM

  • Counterfactual​ Activation Mapping

Counterfactual​ Activation Mapping

  • ​Guided GradCAM

Guided GradCAM

  • ​GradCAM for VQA

GradCAM for VQA

Releases

No releases published

Packages

No packages published