Count Anything

Mengqi Lei, Shuokun Cheng, Wei Bao, Shaoyi Du, Jun-Hai Yong +2 more
5/29/2026
1 citation
cs.CV

Official code: Mengqi-Lei/count-anything (548 stars, Python, Apache-2.0, last commit 2026-08-12).

Abstract

Object counting remains fragmented across domain-specific datasets and task formulations, despite rapid progress in generalist vision models. Existing counting models are often tailored to scenarios such as crowds, vehicles, cells, crops, or remote-sensing objects, and thus struggle to generalize across categories, visual domains, object scales, and density distributions.

Show full abstract

In this paper, we study text-guided object counting across domains, where a model takes an image and a natural-language query as input and returns an instance-grounded set of target points whose cardinality gives the count. This formulation unifies category-conditioned counting with interpretable spatial localization. To support this setting, we construct CLOC, a Cross-domain Large-scale Object Counting dataset that reorganizes diverse public data sources into a unified benchmark. CLOC covers six visual domains: General Scene, Remote Sensing, Histopathology, Cellular Microscopy, Agriculture, and Microbiology, with about 220K images, 619 categories, and 15M object instances. Based on CLOC, we propose Count Anything, a generalist model for text-guided object counting. Unlike density-map-based methods, which dominate counting models, Count Anything adopts discrete instance points and performs dual-granularity instance enumeration. A Region-level Sparse Counter provides object-level anchors for large and sparse targets, while a Pixel-level Dense Counter handles small, crowded, and weakly bounded targets via dense point prediction. A point-centric supervision strategy enables learning from heterogeneous annotations, and Complementary Count Fusion combines both counters in a parameter-free manner. Extensive experiments show that Count Anything achieves strong accuracy and multi-domain generalization, outperforming existing open-world counting methods. Code is available at: https://github.com/Mengqi-Lei/count-anything.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Code and implementation guidelines for the paper ✨Counting Anything. Project Page: https://mengqi-lei.github.io/count-anything-projectpage/

54848Python, ShellMay 18, 20263 months agoApache-2.0
computer-visioncount-anythingobject-countingobject-detectionopen-vocabulary+2 more

Similar Papers

Cite this paper

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

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2605.30846.svg)](https://codeofpaper.com/paper/2605.30846)

Discussion