Generalized Semantic Contrastive Learning via Embedding Side Information for Few-Shot Object Detection

Ruoyu Chen, Hua Zhang, Jingzhi Li, Li Liu, Zhen Huang, Xiaochun Cao · DOI

TL;DR

This paper tackles the challenge of few-shot object detection (FSOD) by introducing "side information" – specifically, semantic relationships between categories derived from visual attributes – to improve how models learn and distinguish novel objects with limited examples. Their novel approach, Contextual Semantic Contrastive Learning (CCL), combined with a counterfactual data augmentation technique, significantly boosts detection performance by creating more discriminative feature spaces and mitigating overfitting.

What Problem Does This Paper Address?

Few-shot object detection (FSOD) aims to train object detectors that can identify new object categories using only a handful of labeled examples. This is a significant challenge because standard object detectors rely on vast amounts of data to learn robust feature representations. In FSOD, two main problems arise:

  1. Feature Space Confusion: With limited data for novel categories, their features can easily be mistaken for or blended with features from existing "base" categories. This leads to blurred decision boundaries, making it hard for the detector to differentiate between similar-looking objects.
  2. Overfitting: Having very few examples for novel categories makes the model prone to memorizing these specific instances rather than learning generalizable features. This results in poor performance on unseen data.

Existing methods often struggle to overcome these issues, especially when dealing with semantically similar categories.

Methods

The authors propose a novel framework for FSOD that addresses the above challenges through two key innovations:

  1. Contextual Semantic Contrastive Learning (CCL):
    • Side Information & Knowledge Matrix: They leverage "side information," specifically visual attributes of objects (like "head," "eye," "metal"), to build a "knowledge matrix." This matrix quantifies the semantic similarity between different categories (both base and novel).
  2. Prototype-Based Contrastive Learning: Instead of just contrasting proposal features, CCL uses prototypes (representative feature vectors for each category) stored in a memory bank. This helps in learning more robust and unbiased representations.
  3. Weighted Contrast: The knowledge matrix is used to weight the contrastive loss. This means that semantically similar categories are pushed further apart in the feature space, enhancing discrimination.
  4. Counterfactual Data Augmentation:
    • Counterfactual Explanation: To combat overfitting, they employ a counterfactual explanation technique. This involves identifying the discriminative regions of the model for a given object and then finding a "counter class" (a semantically similar but incorrect category) using the knowledge matrix.
  5. Region Masking: A saliency map highlights the regions the model focuses on. These regions are then masked and replaced with random noise. This forces the model to learn from other, less obvious features, thereby reducing reliance on biased or shortcut features and improving generalization.

Datasets

The authors evaluate their method on several standard FSOD benchmarks:

  • PASCAL VOC: A classic dataset with 20 categories, often split into base and novel sets.
  • MS COCO: A larger dataset with 80 categories, providing a more challenging scenario.
  • LVIS V1: A large-scale dataset with a long-tail distribution of categories (rare, common, frequent), used to test performance on challenging rare categories.
  • FSOD-1K: A dataset specifically designed for few-shot detection, featuring 1000 categories.
  • FSVOD-500: A video object detection dataset, used to evaluate performance in a video context.

Key Insights and Ideas

  • Semantic Similarity is Crucial: Explicitly modeling semantic relationships between categories (beyond just visual similarity) is key to distinguishing between easily confused novel objects.
  • Prototypes Offer Robustness: Using representative prototypes for each category, rather than just raw proposal features, leads to more stable and unbiased contrastive learning.
  • Counterfactuals for Generalization: Augmenting data by "explaining away" the most discriminative features (and forcing the model to learn from less obvious ones) is a powerful way to combat overfitting in low-data regimes.
  • Knowledge Matrix as a Guide: The knowledge matrix acts as a crucial guide, informing both the contrastive learning process (which categories to push apart) and the data augmentation process (which counter-classes to consider).

Key Results

The proposed method achieves state-of-the-art (SOTA) performance across multiple benchmarks, including PASCAL VOC, MS COCO, LVIS V1, FSOD-1K, and FSVOD-500.

  • Significant Improvements: On PASCAL VOC, their method, when integrated with TFA++, shows improvements of up to 7.6% over strong baselines. On MS COCO, they achieve notable gains in AP and AP75 metrics, outperforming methods like DeFRCN, MFDC, and DE-ViT.
  • Effectiveness of Components: Ablation studies confirm that both the CCL module and the counterfactual data augmentation contribute significantly to performance gains. The knowledge matrix, in particular, is shown to be more effective than text embeddings for building category relationships.
  • Improved Feature Space: Visualizations (using t-SNE) demonstrate that their method leads to a more compact and discriminative feature space compared to existing methods, effectively alleviating the "scattered feature space" problem.

Limitations and Future Work

  • Visual Attributes vs. Text Embeddings: While visual attributes proved more effective for constructing the knowledge matrix, the paper notes that text embeddings can also be used. However, they acknowledge potential issues with noise and domain gaps in text-based methods.
  • Focus on Overall Attributes: The current method focuses on overall visual attributes. Future work could explore individual visual attributes and their relationships to further refine discriminative boundaries.
  • Object-Background Relationships: The current approach primarily considers relationships between objects, not between objects and their backgrounds. Incorporating context-induced recognition biases is suggested as a future research direction.
  • Video Data: While tested on FSVOD-500, the paper notes that video clips offer less sample diversity than static images, which can limit novel category inference. Further exploration in video FSOD is implied.

Summary updated

BibTeX
@article{chen2025generalized,
  author = {Ruoyu Chen and Hua Zhang and Jingzhi Li and Li Liu and Zhen Huang and Xiaochun Cao},
  title = {{Generalized Semantic Contrastive Learning via Embedding Side Information for Few-Shot Object Detection}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2025},
  doi = {10.1109/tpami.2025.3560033},
}
Figure