Count Anything

Mengqi Lei, Shuokun Cheng, Wei Bao, Shaoyi Du, Jun-Hai Yong, Siqi Li, Yue GaoarXiv 2026

TL;DR

"Count Anything" introduces a generalist, text-guided object counting model that unifies fragmented, domain-specific counting tasks into a single framework. By combining a region-level sparse counter with a pixel-level dense counter, the model accurately locates and counts objects across diverse domains (from crowds to microscopic cells) using natural language queries. Alongside the model, the authors introduce CLOC, the largest cross-domain object counting dataset to date, containing 15 million instances.

What Problem Does This Paper Address?

Object counting is a fundamental computer vision task, but it has historically been highly fragmented. Existing models are typically specialized for narrow scenarios—such as crowd counting, vehicle tracking, or cell enumeration. A model trained to count people in a stadium fails completely when applied to remote-sensing imagery of vehicles or histopathology slides of cell nuclei.

Furthermore, traditional dense counting models rely heavily on density maps. While density maps can estimate a total count via integration, they lack a one-to-one correspondence with individual objects. This makes it impossible to provide instance-level confidence scores or precise spatial localization, limiting their interpretability and utility in generalist applications.

The authors tackle this problem by formulating a text-guided, instance-grounded, cross-domain object counting framework. Given an image and a natural-language query (e.g., "people's heads"), the system returns a discrete set of target points, where the total count is simply the number of points.

Methods

The proposed Count Anything model abandons continuous density maps in favor of discrete instance point predictions.

Figure 1: Overall framework of the proposed Count Anything.

The architecture consists of three main components:

  1. Text-Conditioned Encoder: Built on a pretrained SAM3 backbone, this module fuses visual features with textual query representations to generate target-conditioned object embeddings.
  2. Dual-Granularity Counters:
  3. Region-level Sparse Counter (RSC): A DETR-like decoder that uses region queries to predict bounding boxes for large, sparse, and clearly bounded targets. The center of each box serves as a counting point.
  4. Pixel-level Dense Counter (PDC): Operates on high-resolution features to predict coordinate offsets and foreground confidence relative to fixed anchor points. This branch excels at capturing small, crowded, and weakly bounded targets.
  5. Complementary Count Fusion (CCF): A lightweight, parameter-free inference-time rule that resolves duplicate predictions between the RSC and PDC branches. It compares local confidence scores to suppress double-counting while preserving dense recall in crowded areas.

To train the model on diverse data sources, the authors design a point-centric supervision strategy. This allows the model to learn from heterogeneous annotations (points, boxes, polygons, masks) by converting everything into counting points with optional bounding boxes, avoiding the noise introduced by generating pseudo-boxes for point-only data.

Datasets

The authors introduce CLOC (Cross-domain Large-scale Object Counting dataset), which reorganizes multiple public datasets into a unified category-specified counting format.

  • Scale: ~220K images, 619 categories, and 15.356M object instances.
  • Domains: Covers 6 distinct visual domains: General Scene, Remote Sensing, Histopathology, Cellular Microscopy, Agriculture, and Microbiology.
  • Evaluation Split: Features a strict seen/unseen category split based on semantic category groups (e.g., ensuring "sports cars" and "cars" stay on the same side of the split) to rigorously evaluate zero-shot generalization.

Key Insights and Ideas

  • Discrete Points > Density Maps: Predicting discrete points instead of continuous density maps provides explicit instance-level interpretability, making it easier to diagnose localization errors and assign confidence scores.
  • Regions and Pixels are Complementary: Large, sparse objects require geometric anchors and spatial constraints (handled by the RSC), whereas tiny, crowded objects are better resolved via dense pixel-level recall without explicit boundary estimation (handled by the PDC).
  • Semantic Grouping is Essential for Zero-Shot Evaluation: In large-scale datasets, simply ensuring that training and testing category names do not overlap is insufficient. Semantic grouping prevents the model from cheating during "unseen" evaluation by leveraging highly similar categories seen during training.

Key Results

Count Anything achieves state-of-the-art performance across all six visual domains on the CLOC dataset, significantly outperforming existing open-world counting methods and foundation models.

Table 1: Comparison with other state-of-the-art methods on the CLOC dataset.
  • Overall Accuracy: The model achieves a 9.34 MAE (Mean Absolute Error) and 33.34 RMSE on the full test set, compared to the next best generalist counting model, CountGD++, which scores 23.38 MAE.
  • Domain Generalization: In highly specialized domains like Microbiology and Agriculture, Count Anything reduces the MAE to 4.30 and 41.78 respectively, demonstrating robust cross-domain stability where other models degrade.

Limitations and Future Work

Despite its strong performance, the authors note several limitations:

  • Backbone Dependency: The model relies heavily on the underlying vision-language representations of its pretrained encoder. It can still fail when encountering highly ambiguous queries or rare, domain-specific terminology.
  • Crowd Resolution: In extremely dense or heavily occluded scenarios, the lightweight CCF mechanism can still struggle to perfectly differentiate between duplicate predictions and genuinely adjacent individual instances.
  • Future Directions: The authors suggest exploring more efficient dense point decoding, adaptive cross-branch fusion strategies, and extending text prompts to complex natural-language descriptions using Large Language Models (LLMs).

Summary updated

BibTeX
@misc{lei2026count,
  author = {Mengqi Lei and Shuokun Cheng and Wei Bao and Shaoyi Du and Jun-Hai Yong and Siqi Li and Yue Gao},
  title = {{Count Anything}},
  year = {2026},
  eprint = {2605.30846},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.30846},
}
Figure