FocalCount: Towards Class-Count Imbalance in Class-Agnostic Counting

Huilin Zhu, Jingling Yuan, Zhengwei Yang, Yu Guo, Xian Zhong +1 more
2/15/2025
cs.CV

No confident code implementation found for this paper.

Abstract

In class-agnostic object counting, the goal is to estimate the total number of object instances in an image without distinguishing between specific categories. Existing methods often predict this count without considering class-specific outputs, leading to inaccuracies when such outputs are required. These inaccuracies stem from two key challenges: 1) the prevalence of single-category images in datasets, which leads models to generalize specific categories as representative of all objects, and 2) the use of mean squared error loss during training, which applies uniform penalization. This uniform penalty disregards errors in less frequent categories, particularly when these errors contribute minimally to the overall loss. To address these issues, we propose {FocalCount}, a novel approach that leverages diverse feature attributes to estimate the number of object categories in an image. This estimate serves as a weighted factor to correct class-count imbalances. Additionally, we introduce {Focal-MSE}, a new loss function that integrates binary cross-entropy to generate stronger error gradients, enhancing the model's sensitivity to errors in underrepresented categories. Our approach significantly improves the model's ability to distinguish between specific classes and general counts, demonstrating superior performance and scalability in both few-shot and zero-shot scenarios across three object counting datasets. The code will be released soon.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{zhu2025focalcount,
  title  = {FocalCount: Towards Class-Count Imbalance in Class-Agnostic Counting},
  author = {Huilin Zhu and Jingling Yuan and Zhengwei Yang and Yu Guo and Xian Zhong and Shengfeng He},
  year   = {2025},
  eprint = {2502.10677},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.10677v1}
}

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/2502.10677.svg)](https://codeofpaper.com/paper/2502.10677)

Discussion