Closed zhenni closed 6 years ago
Hello, sorry for the late response. It doesn't really matter too much in the end because of the normalization that comes afterwards. You can change ones to zeros and obtain the same cam map most of the time.
However, there are times when the output may look different, for example, for cat and dog it looks like this:
Ones:
Zeros:
It actually highlights the same part but the choice of color looks way more appealing on the first one (because too much red is kind of irritating). I think I made the choice of using ones because of that reason and I agree that naturally, it makes more sense to have it zeros. I will put this note on the code as a comment so that people can see why.
Thanks for highlighting, I hope this clears things up.
@utkuozbulak
Thanks! I think it is clear.
I think the colormap JET
is much better for visualization of heatmaps, instead of HSV
. (HSV
has red color for the smallest values and largest values as well.) If you choose JET
, the color should not have the irritating red things.
Thanks for the advice! I will have a look at it!
https://github.com/utkuozbulak/pytorch-cnn-visualizations/blob/93d112c563e5e601eebab0eb7bf58bf9df30c008/src/gradcam.py#L81