#298 · Primary category: Computer Vision

Transformer-Explainability

attention-matrix attention-visualization bert bert-model cvpr2021 deep-learning explainability perturbation transformer-interpretability vision-transformer visualize-classifications vit

[CVPR 2021] Official PyTorch implementation for Transformer Interpretability Beyond Attention Visualization, a novel method to visualize classifications by Transformer based networks.

Project last updated:01/24/24

GitHub Stars

2.0K

Forks

261

Contributors

2

License

MIT

Why we included this project

Vision Transformer users who have tried to read raw attention maps know how little those reveal: the weights point at scattered patches, not at what actually drove the prediction. This is the reference PyTorch implementation from the CVPR 2021 paper that tackled that, replacing raw attention with relevance scores that propagate back through the network. The Colab notebooks make it easy to load a pretrained ViT or DeiT, feed in an image, and get a heatmap of what the model used to classify it, plus a BERT notebook for sentiment analysis. It is a useful, self-contained baseline for anyone auditing model behavior or debugging why a prediction went wrong, though the authors point to their newer Transformer-MM-Explainability repo for encoder-decoder and multimodal models.

Articles for this project

No articles for this project yet.

To suggest a topic or contribute an article, contact us.

Related projects in this category