CrowdCL: Unsupervised Crowd Counting Network via Contrastive Learning
Yingxiang Hu, Yanbo Liu, Guo Cao, Jin Wang · IEEE Internet of Things Journal · 2025
With the continuous growth of the population, crowd counting plays a crucial role in intelligent monitoring systems for the Internet of Things (IoT) and smart city development. Accurate monitoring of crowd density not only helps maintain public safety but also effectively promotes the development of smart cities. Currently, supervised crowd counting techniques have made significant progress in improving accuracy, but these methods rely on expensive manual annotations and have limited generalization performance. To address these challenges, this article proposes an unsupervised crowd counting network based on contrastive learning, named CrowdCL. CrowdCL primarily leverages image-image contrastive learning and text-image contrastive learning to achieve unsupervised crowd counting. Specifically, in image-image contrastive learning, we strengthen the network’s ability to distinguish crowd features by designing progressive occlusion strategies and patch matching strategies, effectively differentiating crowd information from background information. In text-image contrastive learning, we construct ordered textual prompts to match ordered feature maps and use modality matching loss$(L_{m})$to guide the image encoder. Additionally, to reduce the loss of fine details and alleviate the interference of complex backgrounds, we design a coarse-grained filtering strategy during the testing phase, assigning higher weights to crowd patches with greater potential. Experiments on multiple public datasets show that CrowdCL not only achieves outstanding performance but also outperforms some fully supervised methods in cross-dataset testing.