Closed pir127 closed 4 years ago
Thank you for your error reporting! As you said, the problem should be fixed.
I believe that Gradcam#__call__
should be improved to have seek_penultimate_layer
argument that is a flag.
When seek_penultimate_layer
is False, _find_penultimate_output
would return the output that is indicated by penultimate_layer
argument.
That is, you won't need to comment out above codes.
class Gradcam(ModelVisualization):
def __call__(self,
loss,
seed_input,
penultimate_layer=-1,
seek_penultimate_layer=True,
activation_modifier=lambda cam: K.relu(cam),
normalize_gradient=True):
What do you think about this plan?
would also be more than great to have an option to return
the non-interpolated grad-CAM
as for custom convolutional layers the interpolation may be special.
I couldn't understand the non-interpolated grad-CAM
.
Could you be more specific?
Thanks!
Hi Keisen,
I just meant that it could be useful in some very specific cases to return the grad-CAM vectors before they undergo the interpolation step (Line 68 of gradcam.py).
Thanks for the fix, and thanks so much for sharing this code.
I got it. I'll solve it that was opened issues/#8.
Hello,
I have a CNN with custom convolutional layers and the name of those layers are not instances of
tensorflow.python.keras.layers.convolutional
Therefore, the function
_find_penultimate_output
always returnsNone
and raises en Error. I had to comment out a few lines in_find_penultimate_output
to be able to obtain a grad-CAM, those lines:Not a clean solution but it can help if someone else has this issue, and would be great if you could release an official fix for custom convolutional layers.
And by the way, would also be more than great to have an option to return the non-interpolated grad-CAM as for custom convolutional layers the interpolation may be special.
Thanks so much !