Few-shot Object Counting and Detection

Thanh Nguyen, Chau Pham, Khoi Nguyen, Minh Hoai · DOI

Abstract

This paper introduces Few-shot Object Counting and Detection (FSCD), a novel computer vision task that aims to identify the location and size of all objects in a target class using only a few exemplar bounding boxes and dot annotations. To address this, the authors propose Counting-DETR, a transformer-based model utilizing a two-stage training strategy and an uncertainty-aware loss function based on the Laplace distribution. By treating dot annotations as initial coordinate queries, the model effectively generates pseudo-ground-truth bounding boxes to refine its detection capabilities. Evaluation on the new FSCD-147 and FSCD-LVIS benchmarks demonstrates that Counting-DETR significantly outperforms existing counting and detection baselines in both accuracy and localization.

Introduction

Traditional computer vision tasks often separate counting from detection. Few-shot Counting (FSC) typically produces density maps that provide a total count but lack precise object locations. Conversely, Few-shot Object Detection (FSOD) provides detailed bounding boxes but requires extensive box-level annotations for training, which are costly to produce.

Overview of the FSCD task, showing training with dot annotations and exemplar boxes (a) and testing for full detection and counting (b).

The authors identify a critical gap and propose FSCD, a task that seeks the detailed output of detection with the lightweight supervision of counting. In this setting, models are trained using "dot annotations" (a single click at the center of an object) and a minimal number of exemplar boxes. The primary challenge lies in training a high-quality detector without ground-truth bounding boxes for the majority of the training data.

Methodology: Counting-DETR

Counting-DETR builds upon the Anchor DETR architecture, introducing several innovations to handle imperfect supervision:

  • Two-Stage Training: In the first stage, the model is trained on the few provided exemplar boxes to predict bounding boxes for objects marked only with dots. These predictions serve as "pseudo ground-truth (GT)." In the second stage, the model is fine-tuned using these pseudo-GT boxes.
  • Uncertainty-Aware Learning: To mitigate the noise in pseudo-labels, the model utilizes a Laplace distribution to model boundary uncertainty. This allows the loss function to penalize the model less when it is uncertain about a pseudo-GT box, preventing the over-learning of errors.
  • Dots as Queries: Instead of standard learnable embeddings, the model uses annotated dots as initial coordinate queries, anchoring the transformer's attention to known object locations.
Example of training data featuring dot annotations (blue) and a few exemplar bounding boxes (yellow).

Datasets and Benchmarks

To evaluate FSCD, the authors introduced two new benchmarks:

  1. FSCD-147: An extension of the FSC-147 dataset, adding bounding box annotations for 6,135 images across 147 categories for validation and testing.
  2. FSCD-LVIS: A more complex dataset derived from LVIS, featuring 6,196 images and 377 classes with significant variations in scale, orientation, and object density.

Key Results

Counting-DETR demonstrates superior performance over adapted counting and detection baselines:

  • FSCD-147: The model achieved a Mean Average Error (MAE) of 16.79, significantly lower than the 22.09 achieved by the previous state-of-the-art counting method, FamNet. In detection, it reached an AP50 of 50.57, outperforming adapted detection baselines that scored between 30 and 37.
  • FSCD-LVIS: The model maintained its lead in complex scenes, proving its ability to generalize to unseen object classes.

Conclusion and Future Work

While Counting-DETR represents a significant step forward, limitations remain in handling extreme perspective distortion and heavily truncated objects. Future research may explore incorporating temporal information from video or utilizing self-supervised pre-training to further reduce the reliance on manual annotations. By bridging the gap between counting and detection, FSCD offers a more practical and scalable approach to dense object analysis in real-world scenarios.

Summary updated

BibTeX
@inproceedings{nguyen2022few,
  author = {Thanh Nguyen and Chau Pham and Khoi Nguyen and Minh Hoai},
  title = {{Few-shot Object Counting and Detection}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  url = {https://openreview.net/forum?id=wzEVL6cpSs},
}
Figure