Closed xuyuan closed 5 years ago
Hello,
The line you are referring to is there to resize the image properly. I would suggest reading the comments below that line. Cam heatmap was indeed in [0,1] (check line 86) and scaled to [0,255] so that we are able to export it as an image.
however the save_image
will scale it up 255 again:
https://github.com/utkuozbulak/pytorch-cnn-visualizations/blob/ad79687d926b83e109e3e6bf559d867fc5e950f8/src/misc_functions.py#L118
The current master code doesn't produce the same heatmap as REAMDE
Oh, I thought I tested those :disappointed:
I will check it today! Thanks for letting me know.
Just committed a bandaid fix for image saving. I will streamline image saving soon. It is currently a mess.
https://github.com/utkuozbulak/pytorch-cnn-visualizations/blob/ad79687d926b83e109e3e6bf559d867fc5e950f8/src/gradcam.py#L88
add
cam = cam / 255
?