Table of Contents
Fetching ...

OCCAM: Class-Agnostic, Training-Free, Prior-Free and Multi-Class Object Counting

Michail Spanakis, Iason Oikonomidis, Antonis Argyros

TL;DR

The paper addresses the problem of class-agnostic, multi-class object counting without relying on training data or priors. It introduces OCCAM, a pipeline that uses SAM2 to generate masks from a dense seed grid and a threshold-based FINCH variant to cluster object features, supporting both single-class and multi-class counting (OCCAM-S and OCCAM-M). The approach achieves competitive results on FSC-147 and CARPK, introduces a synthetic multi-class dataset, and argues that F1-score is a more reliable metric for CAC evaluation. By enabling out-of-the-box, multi-class counting across arbitrary object classes, OCCAM advances toward fully automated, general-purpose counting systems.

Abstract

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.

OCCAM: Class-Agnostic, Training-Free, Prior-Free and Multi-Class Object Counting

TL;DR

The paper addresses the problem of class-agnostic, multi-class object counting without relying on training data or priors. It introduces OCCAM, a pipeline that uses SAM2 to generate masks from a dense seed grid and a threshold-based FINCH variant to cluster object features, supporting both single-class and multi-class counting (OCCAM-S and OCCAM-M). The approach achieves competitive results on FSC-147 and CARPK, introduces a synthetic multi-class dataset, and argues that F1-score is a more reliable metric for CAC evaluation. By enabling out-of-the-box, multi-class counting across arbitrary object classes, OCCAM advances toward fully automated, general-purpose counting systems.

Abstract

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.
Paper Structure (5 sections, 3 figures, 8 tables)

This paper contains 5 sections, 3 figures, 8 tables.

Figures (3)

  • Figure 1: We propose a class-agnostic multi-class object counting approach that takes as input an RGB image and outputs a count of object instances per detected class.
  • Figure 2: Given an RGB image as input, a dense grid of seed points is constructed, which are passed to SAM2 to produce a collection of binary masks. These masks are then filtered to obtain a refined set of candidate object masks. Each candidate object mask is used to extract an aspect-ratio-preserving bounding box region, which is passed through ResNet50 to produce a feature vector. These vectors are then grouped using a custom threshold-based variant of FINCH algorithm, resulting in a final set of clusters.
  • Figure 3: Qualitative Results from the FSC-147 Test Set (first row) and the Real Multi-Class Test Set (second row). Failure Cases shown in the third row.