Swin-Transformer icon indicating copy to clipboard operation
Swin-Transformer copied to clipboard

Visualize Attentions

Open chirchef opened this issue 4 years ago • 3 comments
trafficstars

Hello, I was thinking about how to produce attention rollouts for Swin Transformer like in ViT. In ViT, the window size is constant so after averaging the attentions in a head, the attn matrices can be multiplied to make the attn rollouts as I understood.

However, in Swin transformer, the window size is changing and there is also a cyclic shift. What kind of roadmap can be followed here to generate attn rollouts? For instance, following Swin-T (2,2,6,2) architecture, would averaging W-MSA and SW-MSA of the same layer along the first dimension, then multiplying the resulting matrices of the following layers make sense?

chirchef avatar Oct 10 '21 18:10 chirchef

Any clues?

junyongyou avatar Dec 12 '21 16:12 junyongyou

Probably you can plot the attention maps within the neighboring window for each query point

ancientmooner avatar Dec 20 '21 10:12 ancientmooner

Has anyone succeeded in visualizing the attention can share?

hoangphucITJP avatar Jul 15 '22 10:07 hoangphucITJP