Official repository of GeCo2
🏆 Accepted to AAAI 2026
📄 Read the paper: GeCo2 PDF
Few-shot detection-based counters estimate the number of category instances in an image using only a few test-time exemplars. Existing methods often rely on ad-hoc image upscaling and tiling to detect small, densely packed objects, and they struggle when object sizes vary widely within a single image.
GeCo2 introduces a generalized-scale dense query map that is gradually aggregated across multiple backbone resolutions. Scale-specific query encoders interact with exemplar appearance and shape prototypes at each feature level and then fuse them into a high-resolution query map for detection. This avoids heuristic upscaling/tiling, improves counting and detection accuracy, and reduces memory and runtime. A lightweight SAM2-based mask refinement further polishes box quality.
On standard few-shot counting/detection benchmarks, GeCo2 achieves strong gains in MAE/RMSE and AP/AP50, while running ~3× faster with a smaller GPU footprint.
- 🔁 Gradual cross-scale query aggregation → one high-res dense query map without tiling.
- 🧩 Per-scale exemplar interaction with appearance + shape prototypes.
- ⚡ Fast & memory-efficient inference.
- 📈 Strong results on FSCD147, FSCD-LVIS, and MCAC (few-shot & multi-class).
You can easily install and run the demo using the provided install.sh script.
bash install.shDownload the model weights from:
and place the file in the project root directory.
Then run:
python demo_gradio.py
If you find this work useful, please cite:
@inproceedings{pelhan2026generalized,
title={Generalized-Scale Object Counting with Gradual Query Aggregation},
author={Pelhan, Jer and Lukezic, Alan and Kristan, Matej},
booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
pages={},
year={2026}
}