Few-Shot Object Detection

Machine Learning
Introduced by
Xin Wang
Year
2020
Type
Neural network architecture
Family
Deep Learning, Object Detection, Meta-Learning

What does it do?

Few-Shot Object Detection (FSOD) is a meta-learning approach for detecting novel object classes from only a few annotated examples.

Standard object detectors need many labeled instances for each class, whereas FSOD learns from abundant base classes and then adapts to new classes using a small support set. The aim is to detect new categories without building a full training set for each one.

The intuition behind the method

FSOD rests on two ideas: a feature space learned on base classes can transfer to novel classes, and detection can be focused on new categories by matching candidate regions against a few examples. The pipeline first trains on base classes that have plenty of annotations. At adaptation time, an attention-RPN compares proposal features with support embeddings to focus region proposals on candidates likely to belong to novel classes, and a relation network scores each proposal against those embeddings to predict class labels. In this formulation the matching is carried by similarity scoring in the relation step, rather than by a separate contrastive or metric-learning loss.

History

Few-shot object detection applies few-shot and meta-learning ideas to object detection, where the task also requires localising objects. The approach described here, built on an attention region proposal network and a relation-based detector, is one such design for adapting a detector to novel classes from few examples.

When to use it

Choose FSOD when the target object categories are new or rare, only a handful of annotated examples per category can be obtained, and a larger labeled dataset exists for related classes that can serve as base classes. It suits settings where new categories appear over time and retraining a detector on full annotations for each one is impractical. Do not use it when abundant labels exist for every target class; standard detection trained on those labels is the simpler choice. If only class names or descriptions are available and no visual examples, a zero-shot approach is the relevant family and FSOD does not apply directly. If the base data differs strongly in appearance from the target domain, the pre-trained feature space may not transfer, which argues against this approach.

Limitations and considerations

  • Detection of novel classes generally trails detectors trained with full annotations for those classes; the size of the gap depends on the dataset and the number of support examples.
  • Results depend heavily on the support examples; an unrepresentative set degrades the novel-class references used at test time.
  • Matching by feature similarity can confuse novel objects with visually similar base-class objects or background regions, because the relation step scores appearance similarity.
  • Transfer depends on how well base and target data match; a large appearance shift between them weakens the pre-trained feature space.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Novel classes can be added from a small number of annotated examples, without the full annotation effort that a standard detector requires.
  • Pre-training on base classes provides a feature space that is reused for novel classes rather than learned from scratch for each one.
  • The attention step narrows region proposals toward candidates that resemble the support examples, rather than treating all image regions equally.
  • In this matching scheme, novel classes are represented by support embeddings used as references at detection time, so a new class can be introduced by supplying new examples.

Applications

  • Industrial inspection, where a new defect type or product variant may be detected from a few reference images, provided a labeled set exists for related parts.
  • Medical imaging for rare findings where only a few annotated cases are available, with a base dataset of other findings used for pre-training.
  • Satellite or aerial imagery, for object categories that appear only sparsely in the archive.
  • Robotics, where a robot must detect a new object from a few examples, relying on a base model pre-trained on other categories.

How it works

How it works

1

The few annotated examples of each novel class (the support set) are passed through an encoder to produce embeddings that serve as references for those classes during detection.

2

Each input image passes through a backbone, a convolutional or transformer network, which produces feature maps at several scales for use by the later steps.

3

An attention module compares proposal features with the support embeddings and uses this comparison to focus region proposals on candidates likely to belong to the novel classes.

4

A relation network scores the similarity between each proposal's features and the support embeddings, and from these scores predicts objectness and a class label for the few-shot categories.

Common pitfalls

  • Unrepresentative support sets: examples that do not span the variation in appearance, pose and scale seen at test time give the relation step a narrow reference for each novel class.
  • Thin base-class training: if the base classes are few or not diverse, the learned feature space covers little variation and transfers poorly to novel classes.
  • Imbalance between base-class training and novel-class adaptation: if the two are not balanced, the model can overfit to base classes and under-detect novel ones.
  • Mixing base and novel results: novel-class performance should be reported separately on held-out novel classes, because an overall score averaged over both can hide weak detection of new categories. Results also depend on the base/novel class split and the number of shots, so comparisons should hold these fixed.
  • Single-run scores: a result from one draw of support examples does not show general performance. Varying the support examples gives a fairer picture of how stable the novel-class detection is.

Frequently asked questions

What is the difference between few-shot and zero-shot object detection?

Few-shot detection uses a small set of labeled visual examples (the support set) to adapt the model to new classes. Zero-shot detection has no visual examples and must rely on class names or semantic descriptions. Support examples show the actual appearance of the target object, which a text description may not capture, but they must be annotated by someone first.

How are support sets selected?

Support examples should cover the variation in appearance, pose and scale expected at test time, because the novel-class references are built only from them. Choosing them without checking how representative they are is a common source of poor results.

How does pre-training on base classes help?

Pre-training on base classes learns a feature space in which objects of the same class have similar representations and different classes are separated. This space can partly transfer to novel classes, which is what allows the model to detect new objects from few examples. Transfer is not guaranteed: it is weaker when base and target data differ in appearance, and novel-class accuracy usually trails that of detectors trained with full annotations. The quality and diversity of the base-class data strongly affect how well the features transfer.

Related methods

Sources

  1. Wang, X., Huang, T. E., Darrell, T., Gonzalez, J. E., & Yu, F. (2020). Few-shot object detection with attention-RPN and multi-relation detector. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (pp. 9050-9059).

    Open publication reference