Class-Agnostic object Counting (CAC) involves counting instances of objects from arbitrary classes within an image. Due to its practical importance, CAC has received increasing attention in recent years. Most existing methods assume a single object class per image, rely on extensive training of large deep learning models and address the problem by incorporating additional information, such as visual exemplars or text prompts. In this paper, we present OCCAM, the first training-free approach to CAC that operates without the need of any supplementary information. Moreover, our approach addresses the multi-class variant of the problem, as it is capable of counting the object instances in each and every class among arbitrary object classes within an image. We leverage Segment Anything Model 2 (SAM2), a foundation model, and a custom threshold-based variant of the First Integer Neighbor Clustering Hierarchy (FINCH) algorithm to achieve competitive performance on widely used benchmark datasets, FSC-147 and CARPK. We propose a synthetic multi-class dataset and F1 score as a more suitable evaluation metric. The code for our method and the proposed synthetic dataset will be made publicly available at https://mikespanak.github.io/OCCAM_counter.
翻译:类别无关物体计数(CAC)旨在统计图像中任意类别物体的实例数量。由于其实际重要性,CAC近年来受到越来越多的关注。现有方法大多假设每张图像仅包含单一物体类别,依赖大规模深度学习模型的广泛训练,并通过引入视觉示例或文本提示等附加信息来解决该问题。本文提出OCCAM,这是首个无需训练、且无需任何辅助信息的CAC方法。此外,我们的方法解决了该问题的多类别变体,能够对图像中任意物体类别中的每个类别分别统计其实例数量。我们利用基础模型Segment Anything Model 2(SAM2)以及自定义的基于阈值的FINCH算法变体,在广泛使用的基准数据集FSC-147和CARPK上取得了具有竞争力的性能。我们提出了一个合成多类别数据集和F1分数作为更合适的评估指标。本方法的代码及所提出的合成数据集将在https://mikespanak.github.io/OCCAM_counter公开提供。