facebookresearch / TorchRay

Understanding Deep Networks via Extremal Perturbations and Smooth Masks
Other
344 stars 33 forks source link

Problem on the example of GradCam #5

Open AoLiu-CS opened 4 years ago

AoLiu-CS commented 4 years ago

Hi,

Thanks very much for the open source!

I got the following outcome from the example code of GradCam (/examples/gradcam.py), which seems to be incorrect because the size of interpretation does not match with the input.

Screen Shot 2019-12-11 at 4 59 37 PM

Is it possible to help me know where got incorrect here?

Thanks again for your time!

ruthcfong commented 4 years ago

Hi @AoLiu-CS, thanks for your question; sorry for the delay in reply.

If you'd like the heatmap to match the input dimensions, you should pass resize=True into the grad_cam function call in line 8 of examples/grad_cam.py. The full list of parameters can be found in the definition of the saliency function in attribution/common.py.

Hope that helps.