A Few-Shot Sequential Approach for Object Counting

Negin Sokhandan, Pegah Kamousi, Alejandro Posada, Eniola Alese, Negar RostamzadeharXiv 2020

Abstract

This paper introduces a novel few-shot, multi-class object counting method that mimics human visual attention by sequentially localizing and classifying objects in an image. By leveraging point-level annotations and a recurrent attention mechanism, the model can count novel object categories using only a handful of examples, significantly reducing the data labeling burden compared to traditional bounding-box-based methods.

Introduction

Object counting is a fundamental computer vision task with applications ranging from traffic monitoring to retail inventory. However, most existing methods struggle with two main issues: high data requirements and limited multi-class flexibility. Traditional models often require massive amounts of labeled data, typically in the form of expensive bounding boxes. Furthermore, many models are class-specific, failing to generalize to the diverse categories found in real-world scenarios like supermarket shelves.

Overview of the few-shot sequential counting model, showing how support images guide the classification of objects localized in a query image.

The authors tackle the problem of few-shot multi-class object counting using only point-level annotations—a single dot per object—which are significantly faster and cheaper to produce than bounding boxes.

Methodology

The proposed framework follows a two-step sequential process to disentangle the "where" from the "what" in an image.

Feature Extraction and Coordinate Encoding

A ResNet-50 backbone is used to extract multi-scale features. To enhance the model's spatial awareness, the authors concatenate encoded $x, y$ coordinates to the feature maps. This addition is crucial for distinguishing between adjacent objects in dense scenes.

Recurrent Decoder and Attention Mechanism

Instead of processing the entire image simultaneously, the model employs an LSTM-based recurrent decoder. At each time step, an attention module generates a mask for a single object.

  • Localization: The attention map isolates a specific object's feature vector.
  • Classification: This vector is compared against "class prototypes"—averaged features from the few-shot support images—using cross-correlation to determine the object's category.
Detailed architecture of the proposed model, illustrating the dual paths for support set prototypes and query image attention-based localization.

Training and Loss

To ensure a consistent counting path, ground-truth point labels are sorted lexicographically (top-left to bottom-right). The training process utilizes an adaptive loss function that combines KL-divergence for localization and Cross-Entropy for classification, prioritizing localization early in training.

Experiments and Results

The model was evaluated on three challenging benchmarks: FS-COCO, FSOD (1,000 categories), and a new Cafeteria Dataset featuring high-density retail items.

The sequential approach consistently outperformed the primary baseline, GMNet, across various scenarios in terms of Mean Absolute Error (MAE) and Root Square Error (RMSE). Notably, when trained on the Cafeteria dataset and tested on the completely different FSOD dataset, the model maintained a 90% recall, demonstrating robust generalization to unseen classes. Furthermore, it surpassed several state-of-the-art few-shot detection methods in counting accuracy, despite those methods requiring more expensive training labels.

Conclusion

This work demonstrates that sequential attention is a powerful tool for few-shot object counting. By mimicking the human "glance and count" process and utilizing point-level supervision, the model achieves high accuracy and strong generalization while minimizing annotation costs. Future work may explore more flexible attention paths and sophisticated scoring mechanisms to further enhance performance.

Summary updated

BibTeX
@misc{sokhandan2020few,
  author = {Negin Sokhandan and Pegah Kamousi and Alejandro Posada and Eniola Alese and Negar Rostamzadeh},
  title = {{A Few-Shot Sequential Approach for Object Counting}},
  year = {2020},
  eprint = {2007.01899},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2007.01899},
}
Figure