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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytorch-gradcam-0.2.1.tar.gz
(6.0 MB
view details)
File details
Details for the file pytorch-gradcam-0.2.1.tar.gz.
File metadata
- Download URL: pytorch-gradcam-0.2.1.tar.gz
- Upload date:
- Size: 6.0 MB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
891d2dcedf695cd18233f94258315131a56056171a92412e691f75f0816bdc97
|
|
| MD5 |
dadf362d52a4063daac644145d9cd296
|
|
| BLAKE2b-256 |
e60a55251f7cbea464581c6fb831813d38a41fdeb78f3dd8193522248cb98744
|