Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about using Grad-CAM #6

Open
viet2411 opened this issue Apr 4, 2022 · 3 comments
Open

Question about using Grad-CAM #6

viet2411 opened this issue Apr 4, 2022 · 3 comments

Comments

@viet2411
Copy link

viet2411 commented Apr 4, 2022

Hello,

Thank you for your great work.

I was trying to use the draw_cam.py script to extract heatmap from results, but there were some errors occured during the experiment, and I do not really understand the problem here:

Traceback (most recent call last):
File "draw_cam.py", line 115, in
draw_CAM(model, img_path, save_path, transform=data_transforms, visual_heatmap=False)
File "draw_cam.py", line 42, in draw_CAM
output.register_hook(extract)
File "/.pyenv/versions/anaconda3-2021.05/lib/python3.8/site-packages/torch/_tensor.py", line 289, in register_hook
raise RuntimeError("cannot register a hook on a tensor that "
RuntimeError: cannot register a hook on a tensor that doesn't require gradient

Could you check the script again and teach me how to solve this problem?
Thank you and best regards.

@wtyhub
Copy link
Owner

wtyhub commented Apr 4, 2022

Hello,
You can try to use heatmap.py to extract heatmap. The script of draw_cam.py may be not work, and I forgot to delete it.

@viet2411
Copy link
Author

Thank you for your response.
I have one more question about the "Effect of the drone distance to the geographic target" part.
Could you explain about how you divided the dataset into three different parts (Long, middle and short) please?
Thank you and best regards.

@wtyhub
Copy link
Owner

wtyhub commented Sep 22, 2022

I did not divide the dataset. In this experiment. I use "--scale_test" in test.py and select a fixed image index to denote Long or Middle or Short. The indxe=0, index=36 and index=54 refer to the long, middle and short respectively.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants