Counting with ease: Class-agnostic counting via one-shot detection across diverse domains

  • Zhongxing Peng
  • , Bohui Guo
  • , Shugong Xu*
  • *Corresponding author for this work

Research output: Contribution to journalArticlepeer-review

Abstract

Class-agnostic counting is increasingly prevalent in industrial and agricultural applications. However, most deployable methods rely on density maps, which (1) struggle with background interference in complex scenes, and (2) fail to provide precise object locations, limiting downstream usability. The advancement of class-agnostic counting is hindered by suboptimal model designs and the lack of datasets with bounding box annotations. While some studies explore text-guided methods using multimodal models, they remain impractical for edge deployment and are beyond our study's scope. To address these limitations, we diverge from traditional counting paradigms and propose a novel Class-Agnostic Counting and Localization (CACAL) framework, which performs accurate object counting and localization using a single query image-streamlining the process for real-world use. First, we introduce a Sampling-Aware Feature Enhancement module to improve feature discriminability and mitigate confusion in shared-encoder settings. Second, we design a Split-and-Assemble Feature Matching strategy to produce structurally-aware similarity maps, boosting performance in cluttered and occluded scenarios. To further advance the field, we introduce the LOCO dataset, a large-scale benchmark with both point and bounding box annotations across industrial, agricultural, and daily-life domains. CACAL consistently outperforms existing methods across multiple benchmarks and demonstrates strong generalization across diverse domains. Our dataset will be released at: https://github.com/imMid-Star/CACAL.

Original languageEnglish
Article number107961
JournalNeural Networks
Volume193
DOIs
Publication statusPublished - Jan 2026

Keywords

  • Class-agnostic counting
  • Feature enhancement and matching
  • One-shot
  • Sampling-aware mechanism

Cite this