AFreeCA: Annotation-Free Counting for All
Adriano D'Alessandro Ali Mahdavi-Amiri Ghassan Hamarneh
Object counting methods typically rely on manually annotated datasets. The
cost of creating such datasets has restricted the versatility of these networks
to count objects from specific classes (such as humans or penguins), and
counting objects from diverse categories remains a challenge. The availability
of robust text-to-image latent diffusion models (LDMs) raises the question of
whether these models can be utilized to generate counting datasets. However,
LDMs struggle to create images with an exact number of objects based solely on
text prompts but they can be used to offer a dependable \textit{sorting} signal
by adding and removing objects within an image. Leveraging this data, we
initially introduce an unsupervised sorting methodology to learn object-related
features that are subsequently refined and anchored for counting purposes using
counting data generated by LDMs. Further, we present a density
classifier-guided method for dividing an image into patches containing objects
that can be reliably counted. Consequently, we can generate counting data for
any type of object and count them in an unsupervised manner. Our approach
outperforms other unsupervised and few-shot alternatives and is not restricted
to specific object classes for which counting data is available. Code to be
released upon acceptance.