NOTE: There is another awesome visualization of CNN called CNN-Fixations, which involvs only forward pass. Demo code is available for Caffe and Tensorflow ResNet, Vgg. Please check it out.
This is tensorflow version of demo for Grad-CAM. I used ResNet-v1-101, ResNet-v1-50, and vgg16 for demo because this models are very popular CNN model. However grad-cam can be used with any other CNN models. Just modify convolution layer in my demo code.
See python notebook to see demo of this repository.
To use VGG networks in this demo, the npy files for VGG16 NPY has to be downloaded.
To use ResNet-v1-50 or ResNet-v1-101, download weight from https://github.com/tensorflow/models/tree/master/research/slim
Any Contributions are Welcome
Grad-CAM: Why did you say that? Visual Explanations from Deep Networks via Gradient-based Localization
Ramprasaath R. Selvaraju, Abhishek Das, Ramakrishna Vedantam, Michael Cogswell, Devi Parikh, Dhruv Batra
https://arxiv.org/abs/1610.02391
- GPU Memory: 6GB or higher to run VGG16, and ResNet101 (You may able to run ResNet50 with less than 6GB)
export PYTHONPATH=$PYTHONPATH:`pwd`/slim
Thanks for the awesome machine learning commuity for providing many building blocks.
https://github.com/ramprs/grad-cam
https://github.com/machrisaa/tensorflow-vgg
https://github.com/jacobgil/keras-grad-cam
https://github.com/Ankush96/grad-cam.tensorflow
https://gist.github.com/falcondai/561d5eec7fed9ebf48751d124a77b087