sicara / tf-explain

Interpretability Methods for tf.keras models with Tensorflow 2.x
https://tf-explain.readthedocs.io
MIT License
1.02k stars 111 forks source link

Which layer to choose when using gradCAM #99

Closed barisic-fzi closed 4 years ago

barisic-fzi commented 4 years ago

I am not sure which layer should be selected when using gradCAM.

This is my model description (from a YOLOv3 example - repo: https://github.com/YunYang1994/TensorFlow2.0-Examples/tree/master/4-Object_Detection/YOLOV3)

https://www.codepile.net/pile/mqk0b0yQ

If it is better I can also post the model description directly, but i think it looks messy like that.

97 is related, if that would be added, someone casually using this wouldn't have to know, although it would still be cool that it is mentioned somewhere while starting execution and also some comments on this in documentation.

Any help would be great!!!

RaphaelMeudec commented 4 years ago

@barisic-fzi I'll try to integrate #97 as soon as possible. Target layer should be the last convolutional layer (according to the paper). The intuition is that the output filters of the last convolution are the features for the dense layers. That's why it's selected

RaphaelMeudec commented 4 years ago

@barisic-fzi Layer is now automatically detected so that won't be a problem anymore

barisic-fzi commented 4 years ago

will try it out, many thanks!!!

RaphaelMeudec commented 4 years ago

There should be a release this week, you can try it out from master at the moment.

barisic-fzi commented 4 years ago

@RaphaelMeudec tried on a basic example, works good :+1: didn't find that it says which layer is selected, that would be cool if it's not already implemented

gururajaramesh commented 4 years ago

@RaphaelMeudec Can you please share the link to the repository you are referring to? I am trying to implement GradCAM for Yolov3 as well.

RaphaelMeudec commented 4 years ago

@gururajaramesh I'm not sure which reference you're talking about? I'm not pointing to any repository (except this one)?