Skip to content

zzzace2000/FIDO-saliency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Explaining Image Classifiers by Counterfactual Generation

ArXiv | BibTex

Note: this repo is deprecated. See another repo that reproduces our method: https://github.com/zphang/saliency_investigation

Run

  1. Requirements:

    • Install python3
    • Install pytorch 0.3 version (It does not support 0.4)
    • Put an imagenet folder under exp/imagenet/
    • Install Visdom if you want visualization, and see here.
    • If you want to replicate VAE experiments, please download the pretrained model from here and put under exp/vbd_imagenet/checkpts2/
    • If you want to replicate Contextual Attention GAN experiments, you need to setup the pre-trained GAN from this repo. Put this repo under exp/vbd_imagenet/generative_inpainting/
  2. Running examples:

    • Run FIDO with SDR objectives (vbd_sdr), and with Local inpainter (LocalMeanInpainter)
    CUDA_VISIBLE_DEVICES=0 python -u vbd_imagenet.py --importance-method vbd_sdr --classifier resnet50 --dropout_param_size 56 56 --epochs 300 --lr 0.05 --reg-coef 1e-3 --batch-size 8 --num-samples 1 --gen-model-name LocalMeanInpainter --save-dir ./imgs/0317_local_vbd_sdr_1E-3_56_val_resnet/ --num-imgs 50 --dataset valid/ --data-dir ../imagenet/ --gpu-ids 0
    • Without GPU (add --no-cuda)
    python -u vbd_imagenet.py --importance-method vbd_ssr --classifier resnet50 --dropout_param_size 56 56 --epochs 300 --lr 0.05 --reg-coef 1e-3 --batch-size 8 --num-samples 1 --gen-model-name LocalMeanInpainter --save-dir ./imgs/0317_local_vbd_sdr_1E-3_56_val_resnet/ --num-imgs 50 --dataset valid/ --data-dir ../imagenet/ --no-cuda
    • Run FIDO with SSR objectives (vbd_ssr), and with Contextual Attention Inpainter (CAInpainter)
    python -u vbd_imagenet.py --importance-method vbd_sdr --classifier resnet50 --dropout_param_size 56 56 --epochs 300 --lr 0.05 --reg-coef 1e-3 --batch-size 8 --num-samples 1 --gen-model-name CAInpainter --save-dir ./imgs/0317_local_vbd_sdr_1E-3_56_val_resnet/ --num-imgs 50 --dataset valid/ --data-dir ../imagenet/ --no-cuda
    • Run BBMP with SSR objectives under random inpainting
    python -u vbd_imagenet.py --importance-method bbmp_ssr --classifier resnet50 --dropout_param_size 56 56 --epochs 300 --lr 0.05 --reg-coef 5e-3 --gen-model-name RandomColorWithNoiseInpainter --save-dir ./imgs/0317_random_bbmp_ssr_5E-3_56_val_resnet/ --num-imgs 50 --dataset valid/ --data-dir ../imagenet/ --no-cuda
  3. Still have questions?

    • If you still have questions, please first search over closed issues. If the problem is not solved, please open a new issue.

Visdom

Visualization on Visdom for the saliency map during training is supported. Run visdom server and then add argument --visdom_enabled to view.

License

CC 4.0 Attribution-NonCommercial International

The software is for educaitonal and academic research purpose only.

Citing

@article{chang2018explaining,
  title={Explaining Image Classifiers by Adaptive Dropout and Generative In-filling},
  author={Chang, Chun-Hao and Creager, Elliot and Goldenberg, Anna and and Duvenaud, David},
  journal={arXiv preprint arXiv:1807.08024},
  year={2018}
}

About

Explaining Image Classifiers by Counterfactual Generation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages