Skip to content
Pytorch Implementation of recent visual attribution methods for model interpretability
Jupyter Notebook Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
explainer first commit May 23, 2018
images first commit May 23, 2018
notebooks first commit May 23, 2018
weights change patterns weights url Jan 22, 2019
.gitignore first commit May 23, 2018
LICENSE add LICENSE Jan 23, 2019
README.md update readme Jan 20, 2020
create_explainer.py first commit May 23, 2018
googlenet.py first commit May 23, 2018
preprocess.py first commit May 23, 2018
utils.py first commit May 23, 2018
viz.py first commit May 23, 2018

README.md

Pytorch Visual Attribution Methods

A collection of visual attribution methods for model interpretability

Including:

  • Vanilla Gradient Saliency
  • Grad X Input
  • Integrated Gradient
  • SmoothGrad
  • Deconv
  • Guided Backpropagation
  • Excitation Backpropagation, Contrastive Excitation Backpropagation
  • GradCAM
  • PatternNet, PatternLRP
  • Real Time Saliency
  • Occlusion
  • Feedback
  • DeepLIFT
  • Meaningful Perturbation

Setup

Prerequisities

  • Linux
  • NVIDIA GPU + CUDA (Current only support running on GPU)
  • Python 3.x
  • PyTorch version == 0.2.0 (Sorry I haven't tested on newer versions)
  • torchvision, skimage, matplotlib

Getting Started

  • Clone this repo:
git clone git@github.com:yulongwang12/visual-attribution.git
cd visual-attribution
  • Download pretrained weights
cd weights
bash ./download_patterns.sh  # for using PatternNet, PatternLRP
bash ./download_realtime_saliency.sh # for using Real Time Saliency

Note: I convert caffe bvlc_googlenet pretrained models in pytorch format (see googlenet.py and weights/googlenet.pth).

Visual Saliency Comparison

see notebook saliency_comparison.ipynb. If everything works, you will get the above image.

Weakly Supervised Object Localization

TBD

Citation

If you use our codebase or models in your research, please cite this project.

@misc{visualattr2018,
  author =       {Yulong Wang},
  title =        {Pytorch-Visual-Attribution},
  howpublished = {\url{https://github.com/yulongwang12/visual-attribution}},
  year =         {2018}
}
You can’t perform that action at this time.