Modular with Tensorflow slim. Easy to drop in other Slim Models
Udated to work with Tensorflow 1.5
Includes various output options: heatmap, shading, blur
More examples and explanation here
- Python 2.7 and pip
- Scikit image :
sudo apt-get install python-skimage
- Tkinter:
sudo apt-get install python-tk
- Tensorflow >= 1.5 :
pip install tensorflow==1.5.0rc0
- Opencv - see https://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html
Clone the repo:
git clone https://github.com/hiveml/tensorflow-grad-cam.git
cd tensorflow-grad-cam
Download the ResNet-50 weights:
./imagenet/get_checkpoint.sh
./main.sh
By default this code shows the grad-cam results for the top class. You can
change the predicted_class
argument to function grad_cam
to see where the network
would look for other classes.
First download the new model from here: Slim Models
Then modify the input arguments in main.sh:
python main.py --model_name=resnet_v2_101 --dataset_dir=./imagenet/ --checkpoint_path=./imagenet/resnet_v2_101.ckpt --input=./images/cat.jpg --eval_image_size=299
Repo is based off this code.