I have a Segmentation network model trained for 2 classes and am able to see accurate results. But when using grad-cam for the heatmap, I am able to see good results for the last convolution layer for both the classes but having issues when trying to generate a heatmap for the second last convolution layer for one of the classes (the other class's heatmap is working fine).
**Last 5 layers**
convolution_layer(filters:8, kernel:3*3)
convolution_transpose_layer(filters:2, kernel:2*2)
convolution_layer(filters:2, kernel:3*3)
convolution_layer(filters:10, kernel:1*1)
activation_layer(softmax)
The heatmap is empty because of all negative pooled gradients(due to mean from all the -ve gradients wrt Conv layer), resulting in negative values in pooled_grads*convolution_output on which relu is applied, giving all zeros.
What does it mean for GradCAM to be all negative?
Why is it that all channels in the convolution lead to a "negative" contribution to the true output class?
https://arxiv.org/pdf/2002.11434.pdf following this paper for heatmap for segmentation models.
I use a bit of time to make the GIF explain the convolution was running too much of the same input or no contrast information they merged to similar values. Convolution with padding they will extend the similarities those are one cause or they can find contrast information. It is before answers I go through your links and see the examples output and think this is what the heat map you mean just using the color system you specify. ( I removed those Conv layers and used only 1 layer to examine and accelerate the output behaviors, Heatmap is worked and that is not always negative when using convs not negative means, not negative image when you use the true dimensions images )
[ Sample ]:
[ Output ]: