hila-chefer / Transformer-Explainability

[CVPR 2021] Official PyTorch implementation for Transformer Interpretability Beyond Attention Visualization, a novel method to visualize classifications by Transformer based networks.
MIT License
1.75k stars 232 forks source link

How to generate the visualization result of a batch of inputs at a time #22

Closed lyxxn0414 closed 3 years ago

lyxxn0414 commented 3 years ago

Hi, i'm wondering how to generater the cam results of a batch of input images at a time to save the time used for visualization. I tried to modify the generate_visualization(original_image) method but failed, thanks for your help!

hila-chefer commented 3 years ago

Hi @lyxxn0414 thanks for your interest in our work! I’m afraid our implementation does not support a batch size greater than one currently. Are you experiencing any issues with latency of the code? How many examples do you wish to use?

hila-chefer commented 3 years ago

@lyxxn0414 closing this issue due to inactivity. Please reopen if necessary.

caposerenity commented 3 years ago

@hila-chefer hi, I also want to use this implementation for downstream tasks and need to input a batch of images at a time. Will you consider supporting batch size greater than one in the future?

hila-chefer commented 3 years ago

Hi @caposerenity, apologies for the delayed response I missed your question. Currently, we do not plan to add an implementation to support a bigger batch size since it would require to change our LRP implementation. However, we have a second paper where we remove LRP and you can use a bigger batch size there with no specific modifications. I added a ViT notebook there, so maybe that could help you? Runtime is also quicker there. If you require more assistance, I’ll be happy to help.

Hila.

caposerenity commented 3 years ago

Hi @caposerenity, apologies for the delayed response I missed your question. Currently, we do not plan to add an implementation to support a bigger batch size since it would require to change our LRP implementation. However, we have a second paper where we remove LRP and you can use a bigger batch size there with no specific modifications. I added a ViT notebook there, so maybe that could help you? Runtime is also quicker there. If you require more assistance, I’ll be happy to help.

Hila.

Thank you, it really helps me