Open Source
Explore the latest AI open-source projects from GitHub and HuggingFace.
Explore the latest AI open-source projects from GitHub and HuggingFace.
Count Anything is a generalist model for **text-guided object counting across domains**, released under Apache-2.0 with an arXiv paper, a Hugging Face checkpoint, and a live demo Space. Opened in May 2026 and sitting at roughly 235 stars, it addresses a task that sounds trivial and is not: given an image and a natural-language query, return how many of that thing are present — and show where each one is. ## Why Counting Is Its Own Problem Object counting has historically been handled either by density-map regression, which produces a number without telling you where the objects are, or by running a detector and counting boxes, which collapses on crowded scenes where instances overlap and bounding boxes stop being meaningful. Both approaches also tend to be domain-specific: a model trained to count people in crowds does not transfer to counting cells under a microscope. Count Anything's formulation is to return an **instance-grounded set of points** whose cardinality is the count. That single choice unifies category-conditioned counting with interpretable spatial localization — you get the number and the evidence for it, and points remain well-defined for objects too small or too clustered to box cleanly. ## Architecture: Two Counters and a Fusion Rule The model splits the problem by object scale and density rather than trying to solve both regimes with one head. A **Region-level Sparse Counter (RSC)** provides object-level anchoring for large, sparse targets — the regime where detection-style reasoning works well. A **Pixel-level Dense Counter (PDC)** handles small, crowded, and weakly bounded targets through dense point prediction — the regime where detection collapses. **Complementary Count Fusion (CCF)** then combines the two in a **parameter-free** manner, suppressing duplicate counts while preserving the complementarity of the two branches. Nothing is learned in the fusion step, which makes the combination easier to reason about than a learned arbiter. The supervision strategy is where a lot of the practical work sits. Real counting datasets are annotated inconsistently — some with boxes, some with points, some with polygons, masks, rotated boxes, or label maps. Count Anything converts all of these into counting points with optional boxes, and applies **point-centric supervision** so every valid instance is supervised by a point, with bounding boxes used only where reliable box annotations actually exist. This is what makes training on a heterogeneous corpus tractable. The model initializes from **SAM3** pretrained weights and trains LoRA parameters alongside the counting branch — LoRA learning rate `1e-3`, a 30-epoch cosine schedule with `min_lr_ratio=0.1`, train batch 18, and four GPUs in the default configuration. ## CLOC: The Dataset Behind It The accompanying contribution is **CLOC** (Cross-domain Large-scale Object Counting), which reorganizes diverse public sources into a unified counting benchmark: roughly **220K images, 619 categories, and 15M object instances** across six visual domains — General Scene, Remote Sensing, Histopathology, Cellular Microscopy, Agriculture, and Microbiology. That domain list is the point. Counting rice grains, tumour cells, and vehicles in satellite imagery are usually three separate literatures; CLOC forces one model to handle all of them. The benchmark is being actively maintained rather than dumped and abandoned. **CLOC-v1.1**, released 2026-07-02, followed a manual re-review of the test annotations that removed or relabeled samples with missing labels, incorrect labels, or obvious noise. On 2026-07-20 the authors added evaluation results for NVIDIA's **LocateAnything-3B**, a recent vision-language grounding model, and report that Count Anything continues to lead substantially across the full test set and all six domains. Re-auditing your own benchmark and then benchmarking against a newer competitor on it is the behaviour you want to see from a paper repository. ## Reproduction Friction This is where prospective users should read carefully. Because several CLOC source datasets carry license and redistribution restrictions, **the authors cannot release the complete image set**. What ships is the CLOC annotation files produced by their re-annotation process plus the subset of augmented images that can legally be redistributed; reproducing the full dataset requires downloading original source images and running the repository's preprocessing, rebuilding, and audit scripts. The authors offer a processed ready-to-use copy by email request, which is helpful but not the same as a download link. Inference is far lighter: only `count_anything.pt` from Hugging Face is required, placed at `checkpoints/count_anything.pt`. Training additionally needs official SAM3 weights from `facebook/sam3` — and the README specifically warns to download **SAM3, not SAM3.1**, a versioning trap that would otherwise cost someone an afternoon. Setup is a conda environment on Python 3.12 with an intentionally minimal dependency list, with the caveat that you may need to install PyTorch and torchvision builds matching your local CUDA yourself. ## Pros and Cons The strengths are coherent. Points-as-output is the right primitive for a task where boxes fail and density maps are uninterpretable, and it makes results auditable — a user can see which instances were counted. The RSC/PDC split acknowledges that sparse-large and dense-small are genuinely different regimes instead of forcing one head to compromise, and CCF being parameter-free removes a tuning surface. Six-domain coverage spanning natural images through microscopy is unusually broad for a counting model, and the point-centric conversion of six annotation formats is real engineering that makes such breadth possible. Apache-2.0 licensing, an arXiv paper, a released checkpoint, and a hosted demo mean the claims can be checked at several levels of effort. The CLOC-v1.1 re-audit and the added LocateAnything-3B comparison indicate ongoing maintenance. The limitations are equally clear. **The dataset cannot be fully redistributed**, so end-to-end reproduction is a multi-step scavenger hunt across source datasets, Google Drive, and Baidu Netdisk, with an email request as the practical fallback — a meaningful barrier for independent verification. The quantitative results in the README are embedded as **table images** rather than text, so the actual MAE/RMSE figures are not readable without opening assets. Training depends on SAM3 weights under a separate license the project cannot redistribute, adding a compliance step for commercial use. This is research code — configs, shell scripts, and conda — with no pip package or packaged inference API, and default training assumes four GPUs. The community is small (roughly 16 forks, a single primary author), the repository has no tagged releases, and last activity was mid-July. Counting also inherits the ambiguity of its query: what counts as one instance under a vague natural-language description is a genuine failure mode that no architecture fully resolves. ## Outlook The more durable contribution here may be CLOC rather than the model. A unified cross-domain counting benchmark with cleaned annotations gives the subfield something to compare against, and the authors are already using it to evaluate outside models. Whether Count Anything itself remains the leader depends on how quickly general vision-language grounding models close the gap — the LocateAnything-3B comparison is precisely that race, and it is currently being run on the authors' home benchmark, which is worth keeping in mind when reading the margin. ## Conclusion Count Anything is worth a look for anyone with a real counting workload outside the usual crowd-counting setting — agricultural yield estimation, cell and colony counting, remote-sensing inventory — where a text query is a more natural interface than training a bespoke detector. Start with the Hugging Face demo and the released checkpoint, which require none of the dataset friction. Plan for research-grade code rather than a library, budget for the SAM3 license step if you intend to train, and treat the reported margins as author-reported on an author-built benchmark until independently checked.