Abstract
We present OmniCount, a training-free, open-vocabulary framework designed for the simultaneous counting of multiple object categories within a single image. By integrating semantic segmentation and depth estimation priors, OmniCount effectively guides the Segment Anything Model (SAM) to overcome common pitfalls such as over-counting and occlusion. Alongside this framework, we introduce OmniCount-191, a massive new benchmark specifically designed for complex, multi-label object counting tasks.
Introduction
Traditionally, object counting models have been highly specialized, requiring separate training for distinct categories like crowds or cells. While recent class-agnostic models offer more flexibility, they typically require manual exemplar cropping and process only one category at a time. Foundation models like the Segment Anything Model (SAM) initially appeared to offer a zero-shot solution; however, SAM often struggles in dense, multi-class scenes. Its reliance on RGB texture frequently leads to over-segmentation (e.g., treating a bottle's cap and label as separate objects) and a failure to distinguish overlapping items. OmniCount addresses these challenges by building an interactive, text-promptable counter that accurately tallies multiple object categories in a single pass without task-specific training.
Methodology
OmniCount functions as an intelligent orchestrator for existing foundation models, utilizing a three-step pipeline to refine SAM's output for accurate counting.
1. Semantic and Geometric Priors
The system first employs a Side Adapter Network (SAN) to generate coarse semantic masks based on user-provided text prompts (e.g., "bottles", "grapes"). Simultaneously, it utilizes an off-the-shelf depth estimator (Marigold) to generate a monocular depth map, providing essential structural context.
2. Geometry-Aware Object Recovery
This stage represents the core novelty of the framework. To correct coarse semantic masks and manage occlusions, OmniCount refines the masks using the generated depth map. By employing a k-nearest-neighbor search, the system ensures that pixels assigned to a mask align with the object's mean depth. This prevents masks from bleeding into the background or merging with overlapping items.
3. Reference Point Guided Counting
Rather than relying on SAM's default grid-based "segment everything" approach—which often results in over-counting—OmniCount calculates precise reference points from the refined semantic masks. These points serve as accurate foreground prompts. SAM then processes these points alongside cropped RGB patches to generate final, instance-level masks, which are then tallied for the final output.
Datasets and Benchmarks
To evaluate performance, the authors developed OmniCount-191, a new benchmark featuring 30,230 images across 191 categories. This dataset contains over 300,000 object instances with rich annotations, including counts, points, bounding boxes, and Visual Question Answering (VQA) pairs. The framework was also tested on PASCAL VOC for multi-label counting and FSC-147 and CARPK for single-label performance.
Key Results
- Multi-label Performance: On the OmniCount-191 dataset, the framework achieved a mean Root Mean Square Error (mRMSE) of 0.70, significantly outperforming other zero-shot models such as TFOC (0.95) and Grounding-DINO (1.29).
- Single-label Performance: OmniCount outperformed both training-based and training-free models on standard benchmarks. On FSC-147, it achieved a Mean Absolute Error (MAE) of 18.63 using box prompts.
- Ablation Studies: Results highlight the necessity of geometric and semantic priors. Removing the depth prior increased mRMSE by 56%, while removing smart reference point selection increased errors by 67%.
Conclusion and Future Work
OmniCount demonstrates that intelligently chaining semantic segmenters, depth estimators, and SAM can achieve state-of-the-art counting performance without the need for bespoke multi-class training. While the current pipeline is computationally heavier than lightweight networks due to its reliance on multiple foundation models, it sets a new standard for training-free, open-vocabulary counting. Future research will focus on optimizing the pipeline for real-time applications and improving zero-shot recall for rare object categories.
Summary updated