Crossing the Line: Crowd Counting by Integer Programming with Local Features

Zheng Ma, Antoni B. Chan

In computer vision, counting people within a static region of interest (ROI) is a well-established task. However, many real-world applications—such as monitoring transit station throughput or retail foot traffic—require knowing exactly how many people cross a specific line (Line-of-Interest or LOI) and precisely when they do so.

In their CVPR 2013 paper, Zheng Ma and Antoni B. Chan from the City University of Hong Kong introduced a robust framework for LOI counting. Their approach moves away from traditional "blob-based" estimation toward a more precise, optimization-driven method using temporal slices and local features.

The Challenges of LOI Counting

Traditional methods for LOI counting often rely on segmenting moving "blobs." This approach suffers from three critical issues:

  1. The "Jump" Problem: When a group of people is treated as a single blob, the cumulative count jumps only after the entire group clears the line, obscuring the exact crossing time of individuals.
  2. Heavy Occlusion: In dense crowds, individual segmentation is nearly impossible as people overlap significantly.
  3. Perspective Distortion: Variations in distance from the camera affect the perceived size and speed of pedestrians, often requiring complex manual calibration.

A New Pipeline: From Slices to Integer Programming

The authors proposed a four-stage pipeline designed to overcome these hurdles:

1. Temporal Slice Generation

Instead of processing full video frames, the system samples pixels only along the defined LOI over time. This transforms the 3D video data into a 2D "temporal slice" image, where one axis represents the position on the line and the other represents time.

Overview of the LOI counting process: (a) the line of interest, (b) the resulting temporal slice, and (c) a comparison of counting accuracy.

2. Local HOG Features

To handle occlusion, the method avoids whole-body detection. Instead, it extracts "Local HOG" features—small 8x8 blocks capturing parts like heads or shoulders. These are summarized using a bag-of-words model, providing a representation that remains stable even when parts of a person are hidden.

3. Bayesian Poisson Regression

The system estimates the number of people within overlapping sliding windows on the temporal slice using Poisson regression. This choice is ideal for counting tasks as it naturally handles discrete, non-negative integer outputs.

4. Integer Programming Optimization

The core innovation is formulating the final count as an integer programming problem. Since a sliding window's total count is the sum of the instantaneous counts of the frames it spans, the problem becomes a system of linear equations ($n = As$). By solving for the best whole-number frame counts, the method "de-blurs" the signal, recovering precise crossing times.

Experimental Results

The method was evaluated on the UCSD Pedestrian and LHI datasets. The results demonstrated a significant leap over the then-state-of-the-art "flow-mosaicking" approach.

Temporal slice results showing bidirectional pedestrian crossings (red and blue) and ground truth comparisons.

On the crowded UCSD "Right" direction, the proposed method achieved a Mean Squared Error (MSE) of 0.955, vastly outperforming flow-mosaicking's MSE of 93.20. Furthermore, the method produced smooth cumulative counts that closely tracked ground truth, avoiding the jagged "jumps" seen in blob-based methods. The model correctly identified over 80% of pedestrians within a narrow 2-second window of their actual crossing.

Conclusion

By treating crowd counting as a signal reconstruction problem rather than a simple estimation task, Ma and Chan's work provides a highly accurate and robust solution for LOI monitoring. While the reliance on motion segmentation and the computational cost of integer programming are areas for future refinement, the use of local features and temporal slicing represents a major step forward in handling dense, occluded environments.

Summary updated

BibTeX
@inproceedings{ma2013crossing,
  author = {Zheng Ma and Antoni B. Chan},
  title = {{Crossing the Line: Crowd Counting by Integer Programming with Local Features}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2013},
  doi = {10.1109/cvpr.2013.328},
}
Figure