jacobgil / pytorch-grad-cam

Advanced AI Explainability for computer vision. Support for CNNs, Vision Transformers, Classification, Object detection, Segmentation, Image similarity and more.
https://jacobgil.github.io/pytorch-gradcam-book
MIT License
10.66k stars 1.56k forks source link

How can grad-cam be used in siamese networks? #277

Closed Yanll2021 closed 2 years ago

Yanll2021 commented 2 years ago

I'm sorry to bother you, but I would like to know that how can GRAD-CAM be used in siamese networks with shared weights, such as change detection of remote sensing image, which contains two inputs., and they are feed into the siamese feature extraction network. I want to visualize the visual feature map of a certain layer of dual-phase input in feature extraction, respectively. How can I use your Grad-CAM?

Bangbangbanana commented 2 years ago

The paper Visual Explanation for Deep Metric Learning and its code https://github.com/Jeff-Zilence/Explain_Metric_Learning may help you.

Yanll2021 commented 2 years ago

Thank you very much for your reply. I will refer to it carefully.

Yanll2021 commented 2 years ago

The paper Visual Explanation for Deep Metric Learning and its code https://github.com/Jeff-Zilence/Explain_Metric_Learning may help you. I'm sorry. I'm still in a bit of trouble. My task is change detection based on siamese network, which is similar to semantic segmentation task but contains double input. I have referenced the method in the paper you recommended, but the effect is poor. I think this may be due to the fact that my task is similar to semantic segmentation tasks, but I don't know how to modify them. At present, my some visualization results of feature map of middle layer are as follows. If you have good suggestions, I am very grateful! image image

jacobgil commented 2 years ago

Thanks for sharing that paper, I wasn't aware of it.

We have a notebook for this case - explaining the similarly of images based on the embeddings - https://github.com/jacobgil/pytorch-grad-cam/blob/master/tutorials/Pixel%20Attribution%20for%20embeddings.ipynb

IceHowe commented 1 year ago

The paper Visual Explanation for Deep Metric Learning and its code https://github.com/Jeff-Zilence/Explain_Metric_Learning may help you. I'm sorry. I'm still in a bit of trouble. My task is change detection based on siamese network, which is similar to semantic segmentation task but contains double input. I have referenced the method in the paper you recommended, but the effect is poor. I think this may be due to the fact that my task is similar to semantic segmentation tasks, but I don't know how to modify them. At present, my some visualization results of feature map of middle layer are as follows. If you have good suggestions, I am very grateful! image image

Hello, do you solve this problem? I also need to visualize the heat map of the twin network

Yzwfff commented 1 year ago

The paper Visual Explanation for Deep Metric Learning and its code https://github.com/Jeff-Zilence/Explain_Metric_Learning may help you. I'm sorry. I'm still in a bit of trouble. My task is change detection based on siamese network, which is similar to semantic segmentation task but contains double input. I have referenced the method in the paper you recommended, but the effect is poor. I think this may be due to the fact that my task is similar to semantic segmentation tasks, but I don't know how to modify them. At present, my some visualization results of feature map of middle layer are as follows. If you have good suggestions, I am very grateful! image image

您好,这个问题你解决了吗,我也遇到和你一样的问题