Skip to content
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.

A Simple pytorch implementation of GradCAM and GradCAM++

Notifications You must be signed in to change notification settings

vickyliin/gradcam_plus_plus-pytorch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Simple pytorch implementation of GradCAM[1], and GradCAM++[2]


Installation

pip install pytorch-gradcam

Supported torchvision models

  • alexnet
  • vgg
  • resnet
  • densenet
  • squeezenet

Usage

please refer to example.ipynb for general usage and refer to documentations of each layer-finding functions in utils.py if you want to know how to set target_layer_name properly.

Use your own model and layer:

model = MyModel()
target_layer = model.my_submodule
gradcam = GradCAM(model, target_layer)

References:

[1] Grad-CAM: Visual Explanations from Deep Networks via Gradient-based Localization, Selvaraju et al, ICCV, 2017
[2] Grad-CAM++: Generalized Gradient-based Visual Explanations for Deep Convolutional Networks, Chattopadhyay et al, WACV, 2018

About

A Simple pytorch implementation of GradCAM and GradCAM++

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Jupyter Notebook 99.0%
  • Python 1.0%