hiveml / tensorflow-grad-cam Goto Github PK
View Code? Open in Web Editor NEWTensorflow Slim Grad-Cam to Explain Neural Network Predictions with Heatmap or Shading
Home Page: https://thehive.ai/blog/inside-a-neural-networks-mind
Tensorflow Slim Grad-Cam to Explain Neural Network Predictions with Heatmap or Shading
Home Page: https://thehive.ai/blog/inside-a-neural-networks-mind
I hope to use this work to Visualize my own classification model.At first,I use pretrained model resnetv2_152 l to finetune my dataset , and I got my own model.ckpt,I use this model.ckpt replaced ‘flags.DEFINE_string("checkpoint_path"./imagenet/resnetv2_152’, and I replaced label.txt to my own label.txt. But there are some proplems,
"InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [13] rhs shape= [12]
[[Node: save/Assign_810 = Assign[T=DT_FLOAT, _class=["loc:@resnet_v2_152/logits/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/gpu:0"](resnet_v2_152/logits/biases, save/RestoreV2_810/_1)]]
"
Do you where am I wrong?
Hi,can I ask if want to use other model,for example Inception-ResNet-v2, can I directly download inception_resnet_v2_2016_08_30.tar.gz,and modify the input arguments in main.sh,then it will works, or I need to rewritite the Script in "model--nets"folder?
Is it possible to implement mobilenet (or inception)? I'd like to visualize the same CAM using my own model (trained on mobilenet)... how can a change the code?
Hi,
Nice repository and blog post about it.
It looks like its based in some form on my implementations of grad-cam.
Specifically, the code starting here:
https://github.com/hiveml/tensorflow-grad-cam/blob/master/main.py#L77
Is exact to the code in two grad-cam implementations I made:
https://github.com/jacobgil/keras-grad-cam/blob/master/grad-cam.py#L105
https://github.com/jacobgil/pytorch-grad-cam/blob/master/grad-cam.py#L111
I'm glad you found my implementation helpful,
Could you please give it proper attribution in the Readme and the blog post?
Thanks,
Jacob
I like your work very much,but there are somethings bother me,I used tensorflow1.3 for long time,but I noticed your work is based on tensorflow1.5, I try to run your work on tensorflow1.3,but an error occurred,"reduce_mean() got an unexpected keyword argument 'keepdims",I think that is because the version of tensorflow, so I have to run the program on tensorflow1.5? If I update CUDA9.0,my tensorflow1.3 won't work,So are there programs run on lower version of tensorflow? I am very glad for your reply.
is it possible to implement the code for other nets(except resnet)?
Thanks first for introducing this awesome tensorflow-grad-cam and this blog article (https://thehive.ai/blog/inside-a-neural-networks-mind).
The overview on the CAM and grad-CAM in the blog article is great, but somehow I found there is some bias or misleading claim to CAM, compared to grad-CAM. I would like to clarify that below:
First of all, nowadays all the mainstream network architectures such as resnet, densenet, or other squeezenet use global average pooling at the end, so the class activation map (the heatmap) could be generated directly using CAM, without modifying any network architectures. So the claim that the grad-Cam is superior over CAM because of using grad-cam without modifying architecture is false.
Meanwhile, in your demo code, you are already using the resnet, so you can basically generate heatmap using CAM directly (see example code at https://github.com/metalbubble/CAM/blob/master/pytorch_CAM.py), without needing the extra step to compute the gradient . Through that you save the backward computation, you save almost half of the computation. This is crucial in some application such as video processing that all the need is the forward pass to generate the prediction and heatmap for each frame.
In your demo code, you can generate the heatmaps using CAM and grad-CAM, so you can compare the difference.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.