TL;DR
GECO2 is an end-to-end, few-shot object counting and detection model designed to accurately localize and count objects of wildly varying sizes in dense scenes. By gradually aggregating exemplar-guided queries across multiple feature scales, it eliminates the need for slow, memory-hungry image upsampling and tiling heuristics, achieving state-of-the-art accuracy while running up to $3\times$ faster with a fraction of the memory footprint.
What Problem Does This Paper Address?
Few-shot object counting requires a model to count objects of any arbitrary category at test time, guided only by a few visual examples (exemplars). While traditional "global counters" output a single density map sum, modern "detection-based counters" provide exact bounding boxes—a necessity for downstream applications like biomedical analysis.
However, current detection counters struggle when a scene contains highly diverse object scales or densely packed small objects. To compensate, state-of-the-art models rely on ad-hoc engineering tricks: upsampling the input image or "tiling" (chopping the image into sub-images, running inference on each, and stitching them back together). Tiling introduces severe artifacts, such as cutting exemplars at borders, generating inconsistent features across tiles, and causing double-detections at boundaries. Furthermore, it causes GPU memory consumption and inference times to skyrocket.
Methods
GECO2 replaces ad-hoc scaling heuristics with a principled architecture that directly builds a high-resolution, generalized-scale dense query map.
- Multi-Scale Feature Extraction: The model utilizes a frozen Hiera backbone (from SAM2) to extract multi-resolution image features across three distinct scales.
- Scale-Specific Query Encoder: Instead of merging backbone features immediately, GECO2 processes each scale independently. It extracts scale-specific appearance prototypes (via RoIAlign on the exemplars) and shape prototypes (via a multi-layer perceptron mapping exemplar dimensions). Cross-attention transfers exemplar information to the features, and deformable attention refines them locally without incurring quadratic computational costs.
- Cross-Scale Query Aggregation: The scale-specific queries are gradually upsampled and fused from the coarsest resolution to the finest resolution using Lightweight Upsampling and Fusion Modules (LUM). This creates a unified, high-resolution dense query map.
- Dense Query Decoder & Refinement: The final query map is decoded into objectness scores and bounding boxes. To ensure pixel-perfect localization, these boxes are fed as prompts into a SAM2 decoder to predict segmentation masks, which are then used to tightly refine the final bounding boxes.
Datasets
The authors evaluated GECO2 across three challenging benchmarks:
- FSCD147: A standard few-shot object counting and detection dataset containing 6,135 images across 147 categories, featuring disjoint splits to ensure evaluation on completely unseen object classes.
- FSCD-LVIS ("unseen" split): A detection-field-adapted benchmark featuring 377 diverse object categories.
- MCAC (Multiclass, Class-Agnostic Counting): A recent synthetic benchmark where images contain 1–4 different object classes simultaneously, testing a model's ability to selectively count only the targeted category.
Key Insights and Ideas
- Query Aggregation vs. Feature Aggregation: Standard multi-scale architectures merge backbone features before interacting with the exemplar queries. GECO2 performs exemplar interaction independently at each scale first. Aggregating the resulting queries preserves scale-specific details much more effectively.
- Heuristic-Free Efficiency: By natively handling multiple scales in the query space, GECO2 completely avoids image upsampling and tiling. This slashes GPU memory requirements by over 70% while eliminating edge-boundary detection errors.
- Shared Shape Prototypes: A key finding from the authors' ablation studies was that sharing the same shape prototype encoder across all scales is vital. It provides consistent object-size cues that guide query generation uniformly across all feature levels.
Key Results
- State-of-the-Art Accuracy: On the FSCD147 test set, GECO2 achieved a Mean Absolute Error (MAE) of 7.64 and a Root Mean Squared Error (RMSE) of 39.39, outperforming the previous best detection counter (GeCo) by 22% in RMSE.
- Exceptional Speed and Efficiency: GECO2 requires only 4.98 GB of GPU memory, compared to GeCo's 23.83 GB and CountGD's 15.47 GB. In highly dense scenes (images with 300+ objects), GECO2 processes an image in 0.4 seconds—making it $5.8\times$ faster than GeCo and $8.3\times$ faster than CountGD under identical testing conditions.
- Robust Multi-Class Discrimination: On the multi-class MCAC benchmark, GECO2 reduced MAE by 27% compared to the previous top-performing global counter (LOCA), proving it successfully differentiates between target and non-target object categories in the same image.
Limitations and Future Work
The primary limitation of GECO2 is its architectural dependency on a backbone that natively supports high-resolution inputs and yields high-quality multi-scale features (such as Hiera). While it functions seamlessly as an extension head for the SAM2 framework, its performance and adaptability on alternative, non-hierarchical transformer backbones remain an open question for future exploration.
Summary updated