cs.CVDec 18, 2025

CountZES: Counting via Zero-Shot Exemplar Discovery and Selection

Authors: Muhammad Ibraheem Siddiqui, Muhammad Haris Khan

Organizations: Mohamed Bin Zayed University of Artificial Intelligence, Abu Dhabi, UAE

Abstract

Zero-shot object counting (ZOC) aims to count instances of unseen categories using only a class name. Existing exemplar-based methods discover candidate exemplars through random image patches or open-vocabulary detector proposals. However, random patch sampling often yields poorly delineated instances, while detector-based discovery may produce multi-instance regions and, in dense scenes, provide only a few or even no suitable single-instance candidates. Thus, exemplar selection is constrained by candidate quality and coverage, while counting itself remains highly sensitive to exemplar choice. To this end, we propose CountZES, an inference-only framework that jointly addresses candidate discovery and exemplar selection through density-guided candidate generation and complementary exemplar-selection mechanisms. Starting from a text-grounded anchor, CountZES progressively discovers and refines visual exemplars through three stages: Detection-Anchored Exemplar (DAE), Density-Guided Exemplar (DGE), and Feature-Consensus Exemplar (FCE). DAE establishes a reliable single-instance anchor, DGE leverages density responses to expand candidate discovery beyond the detector-constrained pool and select a statistically consistent exemplar, and FCE promotes representativeness through feature-level consensus. Together, they yield complementary exemplars balancing semantic grounding, count consistency, and feature representativeness. CountZES requires no ZOC-specific optimization and adopts a modular design that supports different pretrained components. Extensive evaluations across natural, aerial, and medical domains demonstrate strong cross-domain generalization and superior performance among inference-only ZOC methods.

Figures & tables

Appendix figures & tables5 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

Jul 2, 2026

AdaCount: Training-Free Similarity-Guided Spatial and Feature Adaptation for Zero-Shot Object Counting

Zero-shot object counting (ZOC) aims to count instances of arbitrary object categories specified only through textual prompts. Recent training-free approaches leverage foundation models such as SAM to reformulate counting as a prompt-driven segmentation task, eliminating the need for costly counting-specific training data with point-level annotations. More recently, SAM3 introduced promptable concept segmentation, enabling the zero-shot segmentation of all instances corresponding to a text-defined concept. However, SAM3 struggles in densely populated scenes containing numerous small objects, where limited image resolution and insufficient attention to target-relevant regions often lead to missed instances and poor instance separation, hindering accurate object counting. To address this limitation, we propose AdaCount, a training-free framework for ZOC based on similarity-guided spatial and feature adaptation. AdaCount first estimates a prototype-driven similarity map that identifies target-relevant regions. This similarity map subsequently guides two complementary adaptations: (i) similarity-guided spatial warping, which reallocates image resolution toward target instances, and (ii) feature modulation, which amplifies target-relevant encoder representations. Together, these adaptations enable SAM3 to devote greater representational capacity to target-relevant regions while preserving global image context, without requiring any model retraining. Extensive experiments across six diverse counting benchmarks establish AdaCount as a new SOTA among training-free ZOC approaches.
Aug 20, 2026

RECOUNT: Reference-guided Counting with Synthetic Visual Exemplars

Text-guided zero-shot object counters excel at spatial localization but categorize poorly on novel or fine-grained classes: natural language is too coarse to fully specify visual identity, so they fail to separate visually similar distractors. Few-shot counters sidestep this with visual exemplars, but require manual annotations on every image. To resolve this dilemma, we introduce RECOUNT, a plug-and-play framework for image-guided zero-shot counting. Rather than specify a category with a text prompt, our key insight is to specify it visually, from a single off-scene reference image. However, we find that a lone reference image provides narrow coverage of a category's appearance and is unreliable across diverse scenes. We therefore repurpose a diffusion model as an automated contrastive data engine that expands the reference into a diverse exemplar gallery, supplying the discriminative detail that text cannot. RECOUNT preserves the class-agnostic proposals of any frozen counter and offloads categorization to a separate visual module (a frozen backbone with a lightweight head trained on this synthetic data) that matches each proposal against the target and distractor galleries. Applied to a frozen counter, RECOUNT attains the best zero-shot accuracy on both benchmarks, cutting counting error (MAE) by 55% on LookAlikes and 21% on PairTally relative to the strongest prior zero-shot counter.
Mar 17, 2026

Boosting Quantitive and Spatial Awareness for Zero-Shot Object Counting

Zero-shot object counting (ZSOC) aims to enumerate objects of arbitrary categories specified by text descriptions without requiring visual exemplars. However, existing methods often treat counting as a coarse retrieval task, suffering from a lack of fine-grained quantity awareness. Furthermore, they frequently exhibit spatial insensitivity and degraded generalization due to feature space distortion during model adaptation.To address these challenges, we present QICA, a novel framework that synergizes quantity perception with robust spatial cast aggregation. Specifically, we introduce a Synergistic Prompting Strategy (SPS) that adapts vision and language encoders through numerically conditioned prompts, bridging the gap between semantic recognition and quantitative reasoning. To mitigate feature distortion, we propose a Cost Aggregation Decoder (CAD) that operates directly on vision-text similarity maps. By refining these maps through spatial aggregation, CAD prevents overfitting while preserving zero-shot transferability. Additionally, a multi-level quantity alignment loss (LMQA\mathcal{L}_{MQA}) is employed to enforce numerical consistency across the entire pipeline. Extensive experiments on FSC-147 demonstrate competitive performance, while zero-shot evaluation on CARPK and ShanghaiTech-A validates superior generalization to unseen domains.