CODA: Counting Objects via Scale-Aware Adversarial Density Adaption

Li Wang, Yongbo Li, Xiangyang XueICME 2019

Abstract

Counting objects in diverse environments remains a significant challenge due to domain shift—the performance drop when a model trained on one dataset is applied to another. CODA (Counting Objects via scale-aware adversarial Density Adaption) is a novel unsupervised framework that enables models to generalize to new scenes without manual labeling. By integrating adversarial learning with a multi-scale pyramid patch approach and a ranking constraint, CODA achieves performance comparable to supervised models and outperforms existing semi-supervised techniques.

1. Introduction

Object counting, particularly for pedestrians and vehicles, is essential for urban safety and traffic management. While deep learning models excel on specific training datasets, they often fail when deployed in real-world settings with different lighting, perspectives, and scales. Traditionally, overcoming this required labor-intensive manual labeling for every new camera location. CODA addresses this by leveraging unsupervised domain adaptation (UDA), allowing a model to automatically adjust to a target domain using only raw, unlabeled images.

2. The CODA Framework

The CODA framework operates in two distinct stages to bridge the gap between source and target domains.

2.1 Pre-training

A Counting Network (CN), based on a VGG-16 backbone with dilated convolutions (similar to CSRNet), is first trained on a labeled source dataset. This stage establishes the model's ability to generate high-quality density maps where local "blobs" represent individual objects.

2.2 Density Adaptation

To adapt to the target domain without labels, CODA employs three key strategies:

  • Adversarial Learning: A discriminator network tries to distinguish between density maps from the source and target domains. The CN learns to produce target maps that are indistinguishable from the source, forcing it to capture universal spatial structures.
  • Scale-Aware Pyramid Patches: To handle varying object sizes caused by perspective, the model processes "pyramids" of nested patches cropped at different scales (e.g., 100%, 80%, 60%, 40%).
  • Ranking Constraint: This self-supervision signal enforces a physical consistency: a larger image patch must contain a count equal to or greater than the smaller patches nested within it. This prevents the model from making nonsensical predictions across scales.

3. Experimental Results

The authors evaluated CODA across several benchmarks, including ShanghaiTech (crowds), UCSD/Mall (pedestrians), and Trancos (vehicles).

Comparison of ground truth (GT) and predicted density maps for crowd and vehicle counting tasks, illustrating the challenges of domain adaptation.

3.1 Performance Gains

CODA demonstrated a remarkable ability to close the performance gap. On the ShanghaiTech Part B dataset, it improved the baseline Mean Absolute Error (MAE) from 27.3 to 15.9, nearly matching supervised models like ACSCP (17.2). In the UCSD-to-Mall task, CODA's unsupervised MAE of 3.38 even outperformed semi-supervised methods that utilized target labels.

3.2 Cross-Category Generalization

A significant insight from the study is CODA's effectiveness in cross-category adaptation. A model trained to count people can be adapted to count cars effectively, suggesting that the framework learns a generalized concept of "objectness" and spatial distribution rather than just category-specific features.

4. Conclusion

CODA provides a robust solution for unsupervised object counting by exploiting local structure similarity and geometric constraints. By eliminating the need for target-domain labeling, it paves the way for "universal counters" that can be deployed across diverse industries and environments with minimal tuning.

Summary updated

BibTeX
@inproceedings{wang2019coda,
  author = {Li Wang and Yongbo Li and Xiangyang Xue},
  title = {{CODA: Counting Objects via Scale-Aware Adversarial Density Adaption}},
  booktitle = {ICME},
  year = {2019},
  doi = {10.1109/icme.2019.00041},
}
Figure