Project-MONAI / tutorials

MONAI Tutorials
https://monai.io/started.html
Apache License 2.0
1.85k stars 682 forks source link

Visualize attention maps for ViT #1646

Closed apoorvasafai closed 8 months ago

apoorvasafai commented 8 months ago

Hi

I am using ViT for a 2D image classification task. How do I visualize the attention maps after changing save_attn=True while training the ViT model.

Thanks

KumoLiu commented 8 months ago

Hi @apoorvasafai, you can get it by using: net.blocks[0].attn.att_mat Hope it helps, thanks.