Pytorch implementation of gradCAM, guidedBackProp, smoothGrad
Resnet50 is used in this implementation (also other models can be used)
- gradCAM https://arxiv.org/pdf/1610.02391.pdf
- guidedBackProp https://arxiv.org/pdf/1412.6806.pdf
- smoothGrad https://arxiv.org/pdf/1706.03825.pdf
- Python 3.6
- torch 1.0.0
- torchvison 0.2.1
- cv2
- tqdm
install requirements
pip install -r requirements.txt
execute script
python main.py image_path --cuda --index hoge
-
add cuda option to use gpu
-
add index option to specify the target imagenet index of gradCAM
Please see imagenet_class_index.json (e.g. ostrich: 9, tusker: 101)
If not specified, target index will be estimated by the model
ostrich.jpg | elephant.jpg | |
---|---|---|
raw | ||
gradCAM | ||
guidedBackProp | ||
guidedGradCAM | ||
smoothGrad |