Deep Spatial Regression Model for Image Crowd Counting

Haiyan Yao, Kang Han, Wanggen Wan, Li HouarXiv 2017

Abstract

Computer vision techniques have been used to produce accurate and generic crowd count estimators in recent years. Due to severe occlusions, appearance variations, perspective distortions and illumination conditions, crowd counting is a very challenging task. To this end, we propose a deep spatial regression model (DSRM) for counting the number of individuals present in a still image with arbitrary perspective and arbitrary resolution. Our proposed model is based on Convolutional Neural Network (CNN) and long short term memory (LSTM). First, we put the images into a pretrained CNN to extract a set of high-level features. Then the features in adjacent regions are used to regress the local counts with a LSTM structure which takes the spatial information into consideration. The final global count is obtained by a sum of the local patches. We apply our framework on several challenging crowd counting datasets, and the experiment results illustrate that our method on the crowd counting and density estimation problem outperforms state-of-the-art methods in terms of reliability and effectiveness.

Introduction

Crowd counting is a critical task in computer vision with applications in public safety, urban planning, and event management. Despite its apparent simplicity, the task is complicated by several real-world factors:

  • Severe Occlusion: Individuals often overlap, obscuring key features.
  • Perspective Distortion: Camera angles cause significant scale variations between foreground and background subjects.
  • Varying Density: Images often contain both sparse and extremely dense regions.
Diverse crowd scenes illustrating challenges like occlusion and varying density across different datasets.

Traditional methods typically analyze local image patches in isolation, failing to capture the spatial correlations inherent in crowd distributions. The Deep Spatial Regression Model (DSRM) addresses this by incorporating spatial context into the regression process.

Methodology

The DSRM architecture consists of a two-stage pipeline designed to extract features and model their spatial relationships.

Feature Extraction

The model utilizes a pre-trained ResNet-152 backbone to process 100x100 image patches. These patches are extracted with a 50% overlap. This overlapping strategy is crucial as it ensures that adjacent patches share information, establishing a mathematical correlation that the subsequent stage can exploit.

Spatial LSTM Regression

The core innovation of DSRM is the use of Long Short-Term Memory (LSTM) networks to process spatial sequences rather than temporal ones. Features from the image patches are organized into a "Deep Features Matrix."

The researchers observed that in typical surveillance or outdoor shots, perspective distortion is most pronounced vertically (longitudinal direction), while head sizes remain more consistent horizontally (transverse direction). Consequently, the LSTM is designed to "walk" across the rows of the image. By treating the image grid as a sequence, the model learns the spatial constraints and dependencies between neighboring patches, refining local count predictions which are then summed for a final global count.

A waterfront scene demonstrating significant perspective distortion, where subjects in the background appear much smaller than those in the foreground.

Datasets and Evaluation

The model was rigorously tested on four major benchmarks:

  • ShanghaiTech (Part A & B): A large-scale dataset containing over 330,000 annotations. Part A focuses on high-density internet images, while Part B covers medium-density street views.
  • UCF_CC_50: A challenging dataset of 50 images with extreme count variations (94 to 4,500+ individuals).
  • AHU-CROWD: Used to evaluate cross-scene robustness.
  • WorldExpo’10: Focuses on cross-scene counting across 108 different surveillance cameras.

Results and Discussion

DSRM consistently outperformed existing state-of-the-art models, such as the Multi-column CNN (MCNN).

Key Insights

  • Spatial Context Matters: Treating image grids as sequences allows the model to leverage the fact that crowd density is locally correlated.
  • Horizontal Bias Effectiveness: Prioritizing horizontal correlations effectively mitigates the impact of perspective distortion in standard camera setups.
  • Transfer Learning: Pre-training on high-density datasets like ShanghaiTech Part A significantly improves performance on smaller or lower-density datasets, indicating the model learns generalizable crowd features.

Conclusion

The Deep Spatial Regression Model demonstrates that combining deep CNN features with the sequential modeling capabilities of LSTMs provides a robust solution for crowd counting. While highly effective, future work could explore more computationally efficient backbones and dynamic patch sizing to better handle extreme perspective shifts and real-time deployment requirements.

Summary updated

BibTeX
@misc{yao2017deep,
  author = {Haiyan Yao and Kang Han and Wanggen Wan and Li Hou},
  title = {{Deep Spatial Regression Model for Image Crowd Counting}},
  year = {2017},
  eprint = {1710.09757},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1710.09757},
}
Figure