Skip to main content

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

Release files for pytorch-gradcam 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytorch-gradcam 0.2.1
File Size Uploaded
pytorch-gradcam-0.2.1.tar.gz 6.0 MB Details

Release files / pytorch-gradcam-0.2.1.tar.gz

Download URL pytorch-gradcam-0.2.1.tar.gz
Size 6.0 MB
Tags Source
SHA-256 checksum
How to use checksums
891d2dcedf695cd18233f94258315131a56056171a92412e691f75f0816bdc97
BLAKE2b-256 checksum
How to use checksums
e60a55251f7cbea464581c6fb831813d38a41fdeb78f3dd8193522248cb98744
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.7

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page