Open-world Text-specified Object Counting

Niki Amini-Naieni, Kiana Amini-Naieni, Tengda Han, Andrew ZissermanarXiv 2023 · DOI

Abstract

Traditional object counting often relies on class-specific models or few-shot visual exemplars. Researchers from the University of Oxford and UC Davis have introduced CounTX, a single-stage transformer model that counts objects based solely on natural language descriptions (e.g., "the strawberries"). By bypassing the need for manual visual exemplars, CounTX sets a new state-of-the-art for text-specified counting. This work also introduces FSC-147-D, an enhanced dataset with detailed linguistic descriptions to support more robust evaluation.

Introduction

Object counting has historically been treated as a "closed-world" problem, requiring specific models for specific categories. Recent "open-world" approaches moved toward class-agnostic counting, where users provide visual examples (bounding boxes) at inference time. While flexible, this "few-shot" approach is often tedious for human users.

The next frontier is text-specified counting, where a user simply describes what to count. Previous attempts were complex, two-stage processes that first used text to find visual exemplars and then used those exemplars to count. This architecture often suffered from error propagation. CounTX addresses these inefficiencies by proposing a direct, single-stage architecture that maps text and images to counts.

CounTX enables counting specific objects based on natural language prompts, such as "the coins" or "the oranges," within the same image.

Methodology

CounTX (pronounced "Count-text") is a transformer-based architecture that maps an image and a text string directly to a density map. The sum of the values in this map provides the final count.

The CounTX architecture utilizes dual CLIP encoders and a feature interaction module to generate a density map from image and text inputs.

Key Components

  • Dual Encoders: The model leverages pre-trained CLIP (Contrastive Language-Image Pre-training) backbones. A Vision Transformer (ViT-B-16) encodes the image, while a text transformer encodes the description.
  • Feature Interaction Module: This module acts as the "brain" of the model, using transformer decoder layers where image features serve as the Query and text features serve as the Key and Value. This allows the model to "mine" image patches that semantically match the text description.
  • Density Decoder: A series of convolutional and upsampling blocks transform the interacted features into a high-resolution density map.
  • Training Strategy: Optimal performance is achieved by freezing the text encoder to preserve broad semantic knowledge while fine-tuning the image encoder and the counting head.

Datasets and Evaluation

The authors evaluated CounTX on several benchmarks:

  • FSC-147: The standard class-agnostic counting dataset.
  • FSC-147-D (New): An enhanced version of FSC-147 with corrected and detailed natural language descriptions, addressing inaccuracies in the original class names (e.g., labeling a "cupcake tray" when the objects to count were the cupcakes).
  • CARPK: A dataset of overhead drone shots of parking lots, used to test domain generalization for vehicle counting.
  • CountBench: A subset used for qualitative evaluation of images with a small number of objects.

Results and Insights

CounTX significantly outperforms previous text-based methods. On the FSC-147 test set, it achieved a Mean Absolute Error (MAE) of 15.88, a substantial improvement over the previous state-of-the-art text-based method (Patch-selection), which sat at 22.09.

Key Findings

  • Single-Stage Robustness: By removing intermediate exemplar-finding steps, CounTX avoids the "double-error" problem where a bad exemplar leads to a bad count. Direct grounding is more robust.
  • Semantic Generalization: CLIP’s text embeddings are rich enough that freezing them during training improves the model's ability to generalize to unseen object classes.
  • Zero-Shot Versatility: Because it uses CLIP, CounTX can count objects it has never seen during training, provided the text description is sufficiently descriptive.

Limitations and Future Work

Despite its success, the authors identify several hurdles for future research:

  1. Self-Similarity: The model sometimes struggles with objects made of similar parts (e.g., counting each lens of a pair of sunglasses as a separate object).
  2. Logical Reasoning: It lacks deep logical reasoning, occasionally counting illustrated objects (e.g., a cat on a sign) when asked to count "cats."
  3. Spatial Awareness: Since CLIP features can be spatially weak, future work may involve replacing the backbone with more spatially-aware models like DinoV2 to further improve precision.

Summary updated

BibTeX
@misc{amininaieni2023open,
  author = {Niki Amini-Naieni and Kiana Amini-Naieni and Tengda Han and Andrew Zisserman},
  title = {{Open-world Text-specified Object Counting}},
  year = {2023},
  eprint = {2306.01851},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.01851},
}
Figure