What Happens Without Background? Constructing Foreground-Only Data for Fine-Grained Tasks

Yuetian Wang, Wenjin Hou, Qinmu Peng, Xinge YouarXiv 2024 · DOI

Abstract

Fine-grained visual categorization (FGVC) often suffers from background bias, where models rely on environmental context rather than object-specific features. We present an automated pipeline using the Segment Anything Model (SAM) and Detic to generate foreground-only datasets. Our results on CUB-200, Stanford Cars, and Aircraft benchmarks show that removing background noise leads to more robust feature extraction and higher classification accuracy, particularly for Vision Transformers. We demonstrate that current models are heavily biased by background cues and that "cleaning" this data is essential for expert-level recognition.

Introduction

Fine-grained visual categorization (FGVC) represents a significant challenge in computer vision, requiring models to distinguish between highly similar sub-categories, such as specific bird species or car models. While modern deep learning architectures achieve impressive accuracy on standard benchmarks, there is growing concern that these models rely on spurious correlations—specifically, background cues—rather than the intrinsic features of the subject. This paper explores the impact of background noise and proposes an automated pipeline to construct foreground-only datasets to improve model robustness and feature purity.

The Background Trap

Current models often act as "lazy" learners. Instead of identifying the unique beak shape of a bird, a model might learn that a certain species is typically photographed against a forest background. This reliance on environmental context hinders generalization to new environments.

Grad-CAM visualizations comparing ideal focus (left) versus common background-biased focus (right) in fine-grained classification models.

As shown in Figure 1, Grad-CAM heatmaps reveal that standard models frequently focus on irrelevant elements like branches, grass, or sky. By isolating the foreground, we can force the model to learn discriminative features directly from the object of interest.

Methodology: The Foreground Extraction Pipeline

To address this, we developed an automated pipeline leveraging Visual Foundation Models to strip backgrounds from large-scale datasets:

  1. Object Detection: An open-vocabulary detector (e.g., Detic or Grounding DINO) identifies the subject based on a text prompt and generates a bounding box.
  2. Segmentation: This box is processed by the Segment Anything Model (SAM) to produce a high-fidelity mask.
  3. Extraction: The subject is isolated from the original image, resulting in a "clean" foreground-only image.
An example of a foreground-only image extracted using the proposed SAM-based pipeline.

This process was applied to the CUB 200-2011, Stanford Cars, and Aircraft datasets, creating new "FG" (Foreground) variants for each. A manual review step ensures the removal of the small percentage (~1-2%) of segmentation errors, such as incomplete masks.

Results and Discussion

Our experiments demonstrate that models trained on standard data suffer an average 6% performance drop when tested on foreground-only images, confirming a heavy reliance on background cues. Conversely, models trained on the new FG datasets show improved accuracy and more distinct feature clusters in t-SNE visualizations. This suggests the model is learning more distinct, "pure" discriminative features.

Vision Transformers (ViT) particularly benefit from this "clean diet," as their global attention mechanism can more effectively integrate foreground features without the interference of background clutter. For instance, ViT-B/16 reached 91.3% accuracy on CUB_FG, surpassing its performance on the original noisy dataset.

Conclusion

Constructing foreground-only datasets is a vital step toward achieving true "expert-level" recognition in AI. By removing background bias, we produce models that are more robust, interpretable, and capable of extracting pure discriminative features. Future work will focus on adaptive methods to ignore backgrounds during inference without explicit cropping and expanding these datasets into more modalities like 3D and multi-view.

Summary updated

BibTeX
@misc{wang2024what,
  author = {Yuetian Wang and Wenjin Hou and Qinmu Peng and Xinge You},
  title = {{What Happens Without Background? Constructing Foreground-Only Data for Fine-Grained Tasks}},
  year = {2024},
  eprint = {2408.01998},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.01998},
}
Figure