[Paper Review] A Simple Interpretable Transformer for Fine-Grained Image Classification and Analysis
This paper proposes INTR, a simple yet interpretable Transformer model for fine-grained image classification that uses class-specific queries in a decoder to localize distinguishing image attributes via cross-attention. By learning one query per class, INTR enables faithful, attention-based interpretation of predictions, achieving state-of-the-art performance on eight fine-grained datasets while revealing nuanced visual patterns, including those matching biological observations.
We present a novel usage of Transformers to make image classification interpretable. Unlike mainstream classifiers that wait until the last fully connected layer to incorporate class information to make predictions, we investigate a proactive approach, asking each class to search for itself in an image. We realize this idea via a Transformer encoder-decoder inspired by DEtection TRansformer (DETR). We learn "class-specific" queries (one for each class) as input to the decoder, enabling each class to localize its patterns in an image via cross-attention. We name our approach INterpretable TRansformer (INTR), which is fairly easy to implement and exhibits several compelling properties. We show that INTR intrinsically encourages each class to attend distinctively; the cross-attention weights thus provide a faithful interpretation of the prediction. Interestingly, via "multi-head" cross-attention, INTR could identify different "attributes" of a class, making it particularly suitable for fine-grained classification and analysis, which we demonstrate on eight datasets. Our code and pre-trained models are publicly accessible at the Imageomics Institute GitHub site: https://github.com/Imageomics/INTR.
Motivation & Objective
- To address the lack of intrinsic interpretability in standard deep learning models for image classification.
- To enable models to proactively search for class-specific patterns in images, rather than relying on post-hoc attention interpretation.
- To develop a method that naturally produces faithful, class-specific attention maps without auxiliary supervision or complex training.
- To validate the model’s interpretability and generalization across diverse fine-grained visual recognition tasks.
- To demonstrate that multi-head cross-attention can learn to identify distinct attributes across visually similar classes.
Proposed method
- The model uses a standard Vision Transformer encoder to extract patch-wise features from input images.
- A decoder is introduced with learnable class-specific queries—one per class—fed as input to the decoder.
- Cross-attention between class-specific queries and image features enables each class to attend to its own distinctive patterns in the image.
- Self-attention within the decoder encodes contextual relationships among candidate classes to guide discrimination.
- The final prediction is made by comparing class-specific image features (from cross-attention) with a shared class-agnostic vector using a dot product.
- The model is trained end-to-end using standard cross-entropy loss, with interpretation derived directly from cross-attention weights during inference.
Experimental results
Research questions
- RQ1Can a Transformer-based model be designed to intrinsically interpret predictions by having each class search for its own visual patterns?
- RQ2Does the use of class-specific queries in the decoder lead to faithful, interpretable cross-attention maps that highlight distinguishing attributes?
- RQ3Can multi-head cross-attention learn to localize different semantic attributes of a class consistently across images?
- RQ4How does the model perform on fine-grained classification tasks, especially when distinguishing visually similar classes?
- RQ5To what extent is the model’s attention sensitive to attribute-level image manipulations?
Key findings
- INTR achieves state-of-the-art or competitive accuracy across eight fine-grained image classification benchmarks, including CUB-200-2011, Stanford Dogs, and FGVC-Aircraft.
- The cross-attention maps produced by INTR consistently localize discriminative attributes such as eye patches, wing patterns, and beak shapes across all datasets.
- When tested on visually similar species like Heliconius melpomene and Heliconius elevatus, INTR localized subtle differences that align with biological annotations.
- The model demonstrated high sensitivity to attribute-level image manipulations: deleting or adding key attributes caused significant shifts in attention maps, confirming attention is grounded in visual semantics.
- By limiting input queries to only visually similar classes, INTR improved its ability to detect fine-grained differences, suggesting context-aware attention learning.
- The mathematical analysis confirms that minimizing cross-entropy loss encourages distinct cross-attention patterns per class, ensuring faithful interpretation without ad-hoc design.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.