Skip to main content
QUICK REVIEW

[Paper Review] Learning to Count Anything: Reference-less Class-agnostic Counting with Weak Supervision

Michael Hobley, Victor Adrian Prisacariu|arXiv (Cornell University)|May 20, 2022
Advanced Neural Network ApplicationsComputer Science12 citations
TL;DR

This paper proposes RCC, a reference-less, class-agnostic counting method that uses self-supervised vision transformer features to count instances without any point-level annotations or reference images. It achieves state-of-the-art performance on FSC-147 and the improved FSC-133 dataset, outperforming existing reference-less methods and matching methods that use full supervision.

ABSTRACT

Current class-agnostic counting methods can generalise to unseen classes but usually require reference images to define the type of object to be counted, as well as instance annotations during training. Reference-less class-agnostic counting is an emerging field that identifies counting as, at its core, a repetition-recognition task. Such methods facilitate counting on a changing set composition. We show that a general feature space with global context can enumerate instances in an image without a prior on the object type present. Specifically, we demonstrate that regression from vision transformer features without point-level supervision or reference images is superior to other reference-less methods and is competitive with methods that use reference images. We show this on the current standard few-shot counting dataset FSC-147. We also propose an improved dataset, FSC-133, which removes errors, ambiguities, and repeated images from FSC-147 and demonstrate similar performance on it. To the best of our knowledge, we are the first weakly-supervised reference-less class-agnostic counting method.

Motivation & Objective

  • To develop a counting method that generalizes to unseen object classes without requiring reference images or instance-level annotations.
  • To investigate whether self-supervised vision transformer features with global context can enable accurate, class-agnostic counting through simple regression.
  • To address limitations in existing datasets by creating a cleaned, error-free benchmark, FSC-133, for more reliable evaluation of counting models.
  • To demonstrate that global context from self-attention mechanisms is essential for identifying repeated instances in an object-agnostic manner.
  • To show that minimal supervision—only the total count—is sufficient for high-accuracy counting when combined with powerful, general-purpose features.

Proposed method

  • The method uses a vision transformer backbone (ViT-Small) with self-supervised pre-training to extract global, context-aware features from input images.
  • A simple linear projection head regresses the total count directly from the flattened class token of the vision transformer features.
  • The model is trained using only the ground-truth count as supervision, with no instance-level annotations or reference images.
  • Feature visualization confirms that the attention mechanism localizes relevant object regions without any location supervision.
  • The approach is evaluated on FSC-147 and the newly proposed FSC-133 dataset, which corrects errors, ambiguities, and duplicates in the original.
  • Ablation studies compare the vision transformer to ResNet-50 and ConvNeXt backbones without self-attention, demonstrating the importance of global context.

Experimental results

Research questions

  • RQ1Can a vision transformer with self-supervised pre-training enable accurate, class-agnostic counting without any reference images or point-level annotations?
  • RQ2Is the global receptive field of self-attention mechanisms essential for identifying repeated instances in a reference-less setting?
  • RQ3Can a simple linear head on vision transformer features outperform more complex regression heads in the counting task?
  • RQ4Does the performance of the proposed method match or exceed that of methods using full supervision and reference images?
  • RQ5How does the model generalize across diverse object compositions and unseen classes in real-world scenarios?

Key findings

  • RCC achieves a test set MAE of 14.23 and RMSE of 43.83 on FSC-133, outperforming the only other reference-less method and matching state-of-the-art methods that use reference images and full supervision.
  • The vision transformer-based method achieves significantly better performance than ResNet-50 and ConvNeXt when used as backbones, even with ImageNet pre-training, proving the importance of self-attention and global context.
  • Simple linear regression heads outperform more complex convolutional regression heads, which overfit to training classes and degrade performance.
  • Feature visualization shows that the model implicitly localizes relevant object instances without any location supervision, indicating strong inductive bias for repetition detection.
  • The model generalizes well to unseen classes and object compositions, including on the cross-domain CARPK dataset, demonstrating robustness and transferability.
  • The proposed FSC-133 dataset removes 122 errors, 15 ambiguous images, and 12 duplicate images from FSC-147, resulting in a cleaner, more reliable benchmark for future research.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.