Enhancing Fine-grained Image Classification through Attentive Batch Training

Duy M. Le, Bao Q. Bui, Anh Tran, Cong Tran, Cuong PhamarXiv 2024 · DOI

Introduction

Fine-grained image classification (FGIC) involves distinguishing between highly similar sub-categories, such as specific breeds of dogs or species of birds. This task is inherently difficult due to high intra-class variation (different poses/angles of the same breed) and low inter-class variation (different species sharing nearly identical features).

Traditional deep learning models typically process images in isolation, ignoring the contextual information available within a training batch. This paper introduces the Relationship Batch Integration (RBI) framework, which allows a model to "borrow" subtle visual features from neighboring images in a batch to better distinguish between similar categories.

The RBI Framework

The RBI framework is a plug-and-play module designed to enhance existing backbones like ResNet, ConvNeXt, or Vision Transformers. It shifts the paradigm from independent sample processing to treating a training batch as a graph of related information.

The RBI framework architecture, detailing the Relationship Position Encoding (RPE) and Residual Relationship Attention (RRA) modules.

Core Components

  1. Relationship Position Encoding (RPE): Unlike standard sequence-based encodings, RPE calculates similarity between image pairs in a batch using Mean Squared Error (MSE) and Peak Signal-to-Noise Ratio (PSNR). This creates a similarity matrix that guides the model on how images relate to one another.
  2. Residual Relationship Attention (RRA): This module uses an attention mechanism to integrate feature vectors across the batch. It enables the model to amalgamate subtle features—such as a clear view of a wing tip from one image—to complement the features of a target image where that detail might be obscured.
  3. Residual Integration: A learnable parameter ($\beta$) allows the model to flexibly balance original features with the newly integrated batch-level context.

Experimental Results

The researchers evaluated RBI on four benchmarks: CUB-200-2011, Stanford Dogs, NABirds, and Tiny-Imagenet. The framework achieved state-of-the-art (SOTA) results on Stanford Dogs (95.79%) and Tiny-Imagenet (93.71%).

Key Performance Metrics

  • Accuracy Gains: RBI provided an average accuracy increase of +2.78% on CUB-200-2011 and +3.83% on Stanford Dogs.
  • Efficiency: Smaller models equipped with RBI often outperformed much larger baseline models. For instance, a SwinT-Small with RBI surpassed the SwinT-Big baseline while maintaining a smaller parameter footprint and faster inference speeds.

Qualitative Analysis

To understand why RBI improves performance, the authors utilized GradCAM visualizations. Standard models often focus on a single dominant feature (like a dog's head). In contrast, RBI-enhanced models attend to multiple salient regions—such as ears, paws, and tails—by learning which features are discriminative from the rest of the batch.

GradCAM visualizations comparing conventional models with RBI-enhanced versions, showing broader attention to salient features.

Conclusion and Future Work

The Relationship Batch Integration framework demonstrates that batch-level context is a powerful, often overlooked resource in fine-grained classification. By leveraging inter-image relationships, RBI achieves superior accuracy with minimal computational overhead. Future research may explore applying this batch-integration logic to other tasks like object detection and segmentation, as well as optimizing the quadratic memory scaling of the similarity matrix for extremely large batch sizes.

Summary updated

BibTeX
@misc{le2024enhancing,
  author = {Duy M. Le and Bao Q. Bui and Anh Tran and Cong Tran and Cuong Pham},
  title = {{Enhancing Fine-grained Image Classification through Attentive Batch Training}},
  year = {2024},
  eprint = {2412.19606},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.19606},
}
Figure