hiveml / tensorflow-grad-cam

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

Home Page:https://thehive.ai/blog/inside-a-neural-networks-mind

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

https://thehive.ai/blog/inside-a-neural-networks-mind


Languages

Language:Python 99.4%Language:Shell 0.6%