Skip to content

Tensorflow Slim Grad-Cam to Explain Neural Network Predictions with Heatmap or Shading

Notifications You must be signed in to change notification settings

hiveml/tensorflow-grad-cam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grad-Cam - Tensorflow Slim

Features:

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

Dependencies

Installation

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

Usage

./main.sh

Changing the Class

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.

How to load another resnet_v2 model

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.

About

Tensorflow Slim Grad-Cam to Explain Neural Network Predictions with Heatmap or Shading

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published