Visualize attention maps of ViT

I have create ViT model using timm for 5 class classification as follows.
model = timm.create_model(‘vit_base_patch16_224’, pretrained=True, num_classes=5)

I want to visualize attention maps for it. How to do this?

1 Like

Hmm… Like this?