RCCFormer: A Robust Crowd Counting Network Based on Transformer

Peng Liu, Heng-Chao Li, Sen Lei, Nanqing Liu, Bin Feng, Xiao WuarXiv 2025 · DOI

Introduction

Crowd counting is a critical task for urban management, public safety, and traffic control. The goal is typically to generate a high-fidelity "density map" from an image to estimate the total number of individuals. Despite significant progress, two primary challenges persist: extreme scale variation—where individuals near the camera appear much larger than those in the distance—and complex background interference, where environmental elements mimic human features.

Complex backgrounds often contain objects like billboards or foliage that confuse traditional counting models.

To address these issues, this paper presents RCCFormer, a Transformer-based architecture designed for robustness. By integrating global-local attention mechanisms and dynamically adapting convolutions, RCCFormer effectively distinguishes foreground human heads from background noise while adapting to drastic scale changes.

The RCCFormer Architecture

The model is built upon a PVTv2 Transformer backbone and introduces three specialized modules to bridge the semantic gap between global context and local detail.

The RCCFormer pipeline integrates multi-level feature fusion, detail-embedded attention, and adaptive scale-aware modules.

1. Multi-level Feature Fusion Module (MFFM)

Standard architectures often fuse features from different network depths using simple addition or concatenation. RCCFormer employs a cross-attention mechanism instead. This allows the network to selectively integrate high-level semantic information with low-level spatial details, creating a more representative feature set that serves as a robust foundation for counting.

2. Detail-Embedded Attention Block (DEAB)

Background confusion often arises because Transformers excel at global context but may overlook fine-grained local textures. The DEAB addresses this by running two parallel branches:

  • Global Branch: A self-attention mechanism to capture the overall scene structure.
  • Local Branch: A depth-wise CNN-based attention mechanism to extract precise local details.

A learnable parameter fuses these branches, enabling the model to dynamically balance global and local information to suppress false positives from the background.

3. Adaptive Scale-Aware Module (ASAM)

To handle scale variations, the authors introduced Input-dependent Deformable Convolution (IDConv). Unlike standard deformable convolutions that only adjust sampling offsets, IDConv dynamically learns both the offsets and the convolution weights based on the input. This allows the receptive field to morph according to the specific size and shape of heads in different parts of the image.

Experimental Results

RCCFormer was evaluated on four major benchmarks: ShanghaiTech (Part A & B), UCF-QNRF, and NWPU-Crowd. It achieved state-of-the-art (SOTA) performance across the board.

  • ShanghaiTech Part A: Achieved a Mean Absolute Error (MAE) of 48.3, outperforming previous Transformer-based models like PET.
  • NWPU-Crowd: The model demonstrated exceptional performance in ultra-dense scenarios (images with >5,000 people), highlighting its scalability.
  • Ablation Studies: Removing the IDConv component resulted in a 2.5-point increase in MAE, confirming the importance of dynamic weight adaptation for scale awareness.

Qualitative analysis shows that RCCFormer produces significantly cleaner density maps than competing models, successfully ignoring distracting elements like tree branches and mannequins.

Conclusion and Future Directions

RCCFormer sets a new standard for robust crowd counting by effectively combining the strengths of Transformers and CNNs. While the model is highly effective, the authors note that the field remains bottlenecked by the high cost of manual head-point annotation. Future research will focus on unsupervised and semi-supervised learning techniques to leverage unlabeled data and reduce the reliance on expensive human-labeled datasets.

Summary updated

BibTeX
@misc{liu2025rccformer,
  author = {Peng Liu and Heng-Chao Li and Sen Lei and Nanqing Liu and Bin Feng and Xiao Wu},
  title = {{RCCFormer: A Robust Crowd Counting Network Based on Transformer}},
  year = {2025},
  eprint = {2504.04935},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.04935},
}
Figure