  Crowd counting models in highly congested areas confront two main challenges:
weak localization ability and difficulty in differentiating between foreground
and background, leading to inaccurate estimations. The reason is that objects
in highly congested areas are normally small and high level features extracted
by convolutional neural networks are less discriminative to represent small
objects. To address these problems, we propose a learning discriminative
features framework for crowd counting, which is composed of a masked feature
prediction module (MPM) and a supervised pixel-level contrastive learning
module (CLM). The MPM randomly masks feature vectors in the feature map and
then reconstructs them, allowing the model to learn about what is present in
the masked regions and improving the model's ability to localize objects in
high density regions. The CLM pulls targets close to each other and pushes them
far away from background in the feature space, enabling the model to
discriminate foreground objects from background. Additionally, the proposed
modules can be beneficial in various computer vision tasks, such as crowd
counting and object detection, where dense scenes or cluttered environments
pose challenges to accurate localization. The proposed two modules are
plug-and-play, incorporating the proposed modules into existing models can
potentially boost their performance in these scenarios.
