SUST-reynole / USSFC-Net

33 stars 4 forks source link

Heat map issues #3

Open is8xia opened 11 months ago

is8xia commented 11 months ago

hello Thanks for sharing your source code! On my side, I would like to ask you how the heat map in your Figure 7 is realized?

XinzheGeng commented 11 months ago

@is8xia Please refer to this repo: https://github.com/jacobgil/pytorch-grad-cam tutorial: https://jacobgil.github.io/pytorch-gradcam-book/Class%20Activation%20Maps%20for%20Semantic%20Segmentation.html#tutorial-class-activation-maps-for-semantic-segmentation

is8xia commented 10 months ago

@XinzheGeng Thank you for your reply. But there is a problem, in change detection the input image is two, how do you go about getting the heat map via grad_cam? Can you provide an idea or source code?

XinzheGeng commented 10 months ago

@is8xia You can try to modify the code of the network: Merge the bitemporal images into the network, and modify the code of forward() as follow. x1, x2 = torch.unsqueeze(x1[0], dim=0), torch.unsqueeze(x1[1], dim=0)

is8xia commented 10 months ago

@XinzheGeng Thank you, I have achieved it

bobo59 commented 9 months ago

谢谢你,我做到了

你好,请问是否可以分享你完成的代码。

adleess commented 6 months ago

hello When i using grad-cam, there will be an error:' grad can be implicitly created only for scalar outputs', I don't know if you have encountered this problem when using it, and I would like to ask you how to realize the visualization.

is8xia commented 6 months ago

@bobo59 Change the input to the grad source code. Change the input to a splice of two images and separate the spliced images in the network. input_tensor = [torch.unsqueeze(imgA_tensor, dim=0), torch.unsqueeze(imgB_tensor, dim=0)]

is8xia commented 6 months ago

Check if the output of your network is a tensor or a tuple, the output of the network needed for grad_cam should be a single tensor.

你好, 当我使用grad-cam时,会出现错误:'grad can beimplicitly create only for scalaroutputs',不知道你在使用的时候是否遇到过这个问题,想请教一下你如何解决实现可视化。

adleess commented 6 months ago

Check if the output of your network is a tensor or a tuple, the output of the network needed for grad_cam should be a single tensor.

你好, 当我使用grad-cam时,会出现错误:'grad can beimplicitly create only for scalaroutputs',不知道你在使用的时候是否遇到过这个问题,想请教一下你如何解决实现可视化。

Thank you for your help, I've solved the problem