Semantic Enhanced Few-shot Object Detection

Zheng Wang, Yingjie Gao, Qingjie Liu, Yunhong Wang

TL;DR

Few-shot object detection often fails in ultra-low-shot scenarios because novel classes get confused with visually similar base classes. This paper introduces a semantic-enhanced framework that aligns visual features with pre-trained text embeddings (from CLIP) and applies an adaptive max-margin loss to push confusable classes apart. The approach yields significant performance gains on standard benchmarks, particularly when only 1 to 3 training samples are available.

What Problem Does This Paper Address?

Few-Shot Object Detection (FSOD) aims to train models to detect novel object categories using only a handful of annotated bounding boxes, leveraging knowledge already learned from data-rich base categories.

However, current fine-tuning methods struggle when data is extremely scarce (e.g., 1-shot detection). With only one or two images, a model cannot build a robust, unbiased representation of a new class. Instead, the novel class's feature distribution often ends up overlapping with well-established, visually similar base classes (for instance, a novel "cow" class getting mixed up with base "horse" or "sheep" classes). This leads to severe classification confusion and poor detection accuracy.

Methods

The authors build their approach on top of DeFRCN, a strong fine-tuning baseline derived from the two-stage Faster R-CNN architecture. To mitigate feature bias and class confusion, they introduce three novel components:

  1. Semantic Similarity Classifier (SSC): Instead of using a standard, randomly initialized linear classifier for new classes, the authors replace it with fixed text embeddings of class names generated by CLIP. Visual region proposals are projected into this semantic space, and classification scores are calculated using cosine similarity. Because CLIP embeddings are pre-aligned with massive amounts of visual data, they act as robust, unbiased class centers.
  2. Multimodal Feature Fusion (MFF): To prevent the model from treating text and vision completely independently, MFF introduces a cross-attention mechanism. This allows early-stage interaction between visual region features and textual class embeddings, enriching the diversity of the visual features.
  3. Semantic-aware Max-margin (SAM) Loss: While semantic embeddings help novel classes draw useful context from similar base classes, they can also exacerbate confusion if the categories are too close. The SAM loss introduces an adaptive margin ($m_{ij}$) into the standard cross-entropy loss. This margin is dynamically determined by the semantic similarity between classes, explicitly pushing confusable classes away from each other in the feature space.
Fig. 1: The illustration of our main idea. a) The original fea- ture space, where ’cow’ is a novel class, ’sheep’ and ’horse’ are confusable base classes. b) The semantic alignment learn- ing aligns visual space with semantic space by bringing RoI features closer to their class name embeddings. c) A max- margin loss is further proposed to push confusable classes away from each other.
Fig. 2: The overview of our method. In the base training stage, we follow previous method to train a linear classifier on the base set. In the novel fine-tuning stage, we initialize the model with base knowledge and replace the linear classifier with our semantic similarity classifier. Additionally, multimodal feature fusion is propose to improve the vision-language communication. Finally the classifier branch is optimized by our semantic-aware max-margin loss.

Datasets

The framework was evaluated on two widely accepted FSOD benchmarks:

  • Pascal VOC: Divided into three distinct novel/base splits. Models were evaluated on 1, 2, 3, 5, and 10-shot scenarios using the nAP50 metric.
  • MS COCO: A more challenging dataset utilizing 60 base classes and 20 novel classes, evaluated across 1, 2, 3, 5, 10, and 30-shot settings using standard COCO mAP metrics.

Key Insights and Ideas

  • Text as an Unbiased Anchor: When you only have a single image of a "cow," visual data alone cannot define the category. Pre-trained language-vision models (like CLIP) provide a powerful shortcut, offering an established, generalized representation of the concept to anchor the few-shot learning process.
  • The Danger of Semantic Proximity: Leveraging semantic relationships is a double-edged sword. If two concepts are semantically close, the model naturally wants to cluster them together. The "aha moment" here is the SAM loss, which selectively penalizes closeness only for the top-$k$ most similar classes, preventing unnecessary noise while enforcing boundaries where they matter most.

Key Results

The proposed method achieved state-of-the-art (SOTA) performance, showing the most dramatic improvements in ultra-low-shot settings:

  • Pascal VOC: On Split 1 (1-shot), the method achieved 58.7% nAP50, outperforming the baseline DeFRCN by 3.5% and comfortably beating previous SOTA methods. Across all three splits, 1-shot performance saw absolute improvements of 6.3%, 5.9%, and 7.2% respectively.
  • MS COCO: The framework achieved the highest novel AP under both 10-shot (20.0%) and 30-shot (22.6%) settings.
  • Confusion Reduction: As shown in the confusion matrices below, the semantic-aware approach drastically reduced misclassifications (red circles) between novel classes and visually similar base classes compared to DeFRCN.
Fig. 3: The confusion matrix on Pascal VOC Split1. Each ele- ment in column m and row n indicates the percentage of sam- ples in class m that are recognized as class n. If m and n stand for different classes, a high score would indicate severe con- fusion. Our approach alleviates the confusion between novel classes and similar base classes by a large margin.

Limitations and Future Work

The authors observed that as the number of available training shots increases (e.g., 10 to 30 shots), the performance gap between their method and purely visual baselines narrows. In a few instances with higher shot counts, the performance was slightly behind the baseline.

The authors conjecture that when visual data becomes abundant, rigid semantic priors can occasionally conflict with the rich visual features the model is capable of learning directly from the images. Future work will likely focus on adaptively balancing or relaxing these semantic constraints as more visual data becomes available.

Summary updated

BibTeX
@inproceedings{wang2024semantic,
  author = {Zheng Wang and Yingjie Gao and Qingjie Liu and Yunhong Wang},
  title = {{Semantic Enhanced Few-shot Object Detection}},
  booktitle = {ICIP},
  year = {2024},
  url = {https://openreview.net/forum?id=GTvkg596lo},
}
Figure