CoDi -- an exemplar-conditioned diffusion model for low-shot counting

Grega Šuštar, Jer Pelhan, Alan Lukežič, Matej Kristan
12/23/2025
cs.CV

Official code: gsustar/CoDi (9 stars, last commit 2025-12-24).

Abstract

Low-shot object counting addresses estimating the number of previously unobserved objects in an image using only few or no annotated test-time exemplars. A considerable challenge for modern low-shot counters are dense regions with small objects. While total counts in such situations are typically well addressed by density-based counters, their usefulness is limited by poor localization capabilities. This is better addressed by point-detection-based counters, which are based on query-based detectors. However, due to limited number of pre-trained queries, they underperform on images with very large numbers of objects, and resort to ad-hoc techniques like upsampling and tiling. We propose CoDi, the first latent diffusion-based low-shot counter that produces high-quality density maps on which object locations can be determined by non-maxima suppression. Our core contribution is the new exemplar-based conditioning module that extracts and adjusts the object prototypes to the intermediate layers of the denoising network, leading to accurate object location estimation. On FSC benchmark, CoDi outperforms state-of-the-art by 15% MAE, 13% MAE and 10% MAE in the few-shot, one-shot, and reference-less scenarios, respectively, and sets a new state-of-the-art on MCAC benchmark by outperforming the top method by 44% MAE. The code is available at https://github.com/gsustar/CoDi.

View on arXivView PDF

Code Implementations(1)

gsustar/CoDiOfficial100%
92Shell, PythonDec 22, 202510 months ago

Similar Papers

Cite this paper

@article{utar2025codi,
  title  = {CoDi -- an exemplar-conditioned diffusion model for low-shot counting},
  author = {Grega Šuštar and Jer Pelhan and Alan Lukežič and Matej Kristan},
  year   = {2025},
  eprint = {2512.20153},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2512.20153v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2512.20153.svg)](https://codeofpaper.com/paper/2512.20153)

Discussion