Source-linked AI summary

Counterfactual Attention Learning for Fine-Grained Visual Categorization and Re-identification

Yongming Rao, Guangyi Chen, Jiwen Lu, Jie Zhou

arXiv:2108.08728v2cs.CVcs.AIcs.LG

TL;DR

Fine-grained recognition needs attention that focuses on useful object evidence rather than biased or partial cues, but conventional likelihood supervision offers limited guidance for attention quality. The paper introduces counterfactual attention learning, which compares learned-attention predictions with counterfactual-attention predictions and maximizes their difference. CAL consistently improves attention baselines across image categorization, person re-identification, and vehicle re-identification benchmarks, with no inference-time computation cost.

  • Problem

    Conventional weakly supervised attention learning supervises final predictions but does not adequately evaluate attention quality or distinguish main clues from biased clues.

  • Method

    CAL uses counterfactual intervention to compare predictions under learned versus uncorrected attentions, maximizing their causal effect during training.

  • Results

    CAL consistently improves baseline attention models across fine-grained categorization, person re-identification, and vehicle re-identification benchmarks.

  • Takeaways & Limitations

    CAL is a model-agnostic plug-and-play framework that mitigates dataset-bias effects with negligible training overhead and no inference overhead.

Abstract

from arXiv · show

Attention mechanism has demonstrated great potential in fine-grained visual recognition tasks. In this paper, we present a counterfactual attention learning method to learn more effective attention based on causal inference. Unlike most existing methods that learn visual attention based on conventional likelihood, we propose to learn the attention with counterfactual causality, which provides a tool to measure the attention quality and a powerful supervisory signal to guide the learning process. Specifically, we analyze the effect of the learned visual attention on network prediction through counterfactual intervention and maximize the effect to encourage the network to learn more useful attention for fine-grained image recognition. Empirically, we evaluate our method on a wide range of fine-grained recognition tasks where attention plays a crucial role, including fine-grained image categorization, person re-identification, and vehicle re-identification. The consistent improvement on all benchmarks demonstrates the effectiveness of our method. Code is available at https://github.com/raoyongming/CAL

1. Introduction

The paper argues that conventional weakly supervised attention learning can follow biased or incomplete visual cues, motivating counterfactual supervision. CAL measures attention effects on prediction and improves attention models across fine-grained recognition benchmarks.

  • Attention helps fine-grained recognition by locating discriminative regions and reducing effects from clutter, occlusion, pose variation, and diverse appearance.
  • Existing likelihood-based attention learning supervises final predictions but provides limited guidance for distinguishing main clues from biased clues.
  • Training-set biases and incomplete object attributes can produce misleading, scattered attention that harms generalization and prediction.
  • Additional bounding-box or segmentation supervision can identify regions of interest, but it requires costly human annotation and is difficult to scale.
  • CAL compares predictions from learned and counterfactual attentions, then maximizes their difference to encourage more effective attention and reduce biased-training effects.
  • The method is model-agnostic and adds little training computation while introducing no inference cost; experiments report significant baseline improvements across benchmarks.

2. Related Work

Prior work established attention as important for fine-grained recognition and explored causality for bias mitigation in vision. This paper applies causal reasoning specifically to visual attention models.

  • Fine-Grained Visual Recognition: Fine-grained recognition research has used attention through recurrent, reinforcement-learning, and other visual-attention models.
  • Causal Reasoning in Vision: Causal reasoning has been applied to explainability, fairness, language, reinforcement learning, adversarial learning, and some vision tasks.
  • Causal Reasoning in Vision: This work studies causality in visual attention models, presenting a direction the related work identifies as previously unexplored.

3. Approach

The approach builds on spatial attention models and reframes their variables in a causal graph, then uses counterfactual intervention to measure and optimize attention quality. The resulting objective guides attention toward discriminative regions while limiting reliance on biased clues, with lightweight training overhead.

  • 3.1. Attention Models for Fine-Grained Recognition: Spatial attention maps weight CNN feature maps over image regions and aggregate part representations for classification or retrieval.The attention model produces maps for regions such as a bird’s wing or a person’s clothing, then forms a normalized global representation.
  • 3.2. Attention Models in Causal Graph: The causal graph represents feature maps X, learned attention maps A, and prediction Y, with X producing A and X,A jointly determining Y.This formulation is architecture-agnostic because it does not constrain the backbone or attention implementation.
  • 3.3. Counterfactual Attention Learning: Counterfactual intervention replaces learned attention A with alternative maps while keeping feature maps X fixed, allowing the attention’s effect on prediction to be estimated.Random, uniform, or reversed attention can serve as counterfactual alternatives.
  • 3.3. Counterfactual Attention Learning: The attention effect is defined as the difference between prediction with learned attention and prediction under counterfactual attention, and serves as an attention-quality measure.The counterfactual effect compares the observed prediction with an expectation over alternative attention maps.
  • 3.3. Counterfactual Attention Learning: The training objective combines cross-entropy on the effect prediction with the original objective to favor discriminative regions and reduce biased-clue reliance.It encourages stronger prediction under learned attention relative to wrong attentions while penalizing predictions based on those wrong attentions.

4. Experiments

Experiments evaluate CAL across fine-grained categorization, person re-identification, and vehicle re-identification, using shared baselines and benchmark comparisons. CAL consistently improves recognition performance, while analysis indicates that counterfactual supervision also improves attention quality and generalizes across attention architectures.

  • Fine-Grained Visual Categorization: 1.3%, 1.5%, and 0.6% improvements over a strong baseline are reported on CUB200-2011, Stanford Cars, and Aircraft, respectively.CAL also outperformed prior state-of-the-art methods on all three benchmarks.
  • Person Re-identification: 0.6%/0.5%, 1.6%/2.3%, and 2.8%/4.7% Rank-1/mAP improvements are reported on Market1501, DukeMTMC-ReID, and MSMT17, respectively.With the stronger attention model, CAL achieves state-of-the-art performance on DukeMTMC-ReID and MSMT17.
  • Vehicle Re-identification: 0.9%/2.3% Rank-1/mAP gains are obtained on VeRi-776, while VehicleID Rank-1 improves by 5.8%, 3.3%, and 4.1% in small, medium, and large settings.These results are achieved without extra training labels and are comparable to a viewpoint-annotated method.
  • Analysis: CAL is the only tested regularization strategy that simultaneously improves classification accuracy and attention mean IoU against ground-truth object boxes on CUB.Attention Dropout and Entropy regularization slightly degrade both metrics, while Attention normalization significantly hurts performance.
  • Analysis: CAL consistently improves weaker single-head attention baselines and produces maps that reduce scattered attention while focusing on whole objects and discriminative regions.Visualizations show avoidance of ground reflections and attention to regions such as a bird’s buttocks, a car’s rearview mirror, and an aircraft wheel.

5. Conclusion

The paper presents counterfactual attention learning, which measures attention quality through factual and counterfactual effects on prediction and maximizes their difference. CAL adds negligible training cost, no inference cost, and achieves state-of-the-art performance across three fine-grained recognition tasks.

  • Counterfactual attention learning measures attention quality by comparing factual and counterfactual effects on final predictions.The method maximizes this difference to encourage more effective visual attention.
  • CAL adds negligible extra training cost and no inference cost.
  • CAL is model-agnostic, mitigates dataset bias, and applies across fine-grained visual recognition tasks.
  • The method achieves state-of-the-art performance on all benchmarks across three fine-grained recognition tasks.

A. More Visual Results

Visual comparisons on CUB, Stanford Cars, and Aircraft show that counterfactual attention learning reduces misleading, scattered attention and encourages attention toward main classification clues and more discriminative regions.

  • On CUB, Stanford Cars, and Aircraft, counterfactual learning produces attention maps that reduce misleading and scattered attention.The paper presents these comparisons as visual evidence that the models make more correct predictions.
  • The learned attention encourages models to focus on main classification clues and explore more discriminative regions.

B. More Implementation Details

The implementation details compare four ways to generate counterfactual attention and three attention regularization strategies. Counterfactual variants alter, average, reverse, or shuffle attention maps, while regularizers apply dropout, entropy maximization, or ℓ2 normalization.

  • Counterfactual Attentions: Random attention samples each location from U(0, 2) to generate counterfactual attention maps.
  • Counterfactual Attentions: Uniform attention sets every location to the average value of the real attention maps.
  • Counterfactual Attentions: Reversed attention subtracts the original attention from each sample’s maximal attention value.
  • Counterfactual Attentions: Shuffle attention randomly shuffles attention maps along the batch dimension.
  • Attention Regularization Strategy: Attention regularization is evaluated with dropout, entropy maximization, and ℓ2 normalization applied to attention maps.Dropout is applied directly; entropy adds a loss term; normalization adds ℓ2 normalization.
Loading 2108.08728v2…