TL;DR
This paper introduces MPCount, a novel method for Single Domain Generalization (SDG) in crowd counting. MPCount effectively addresses the "domain shift" problem by learning domain-invariant features using an attention memory bank and mitigating label ambiguity with a patch-wise classification auxiliary task, achieving state-of-the-art results, especially in challenging narrow-distribution scenarios.
What Problem Does This Paper Address?
Crowd counting, the task of estimating the number of people in an image, often relies on density map regression. While successful, these models typically assume that training and testing data come from the same distribution. In real-world applications, this assumption frequently breaks due to variations in camera angles, lighting, weather, and other factors, leading to a significant drop in performance – a phenomenon known as "domain shift." Existing methods to combat this, like domain adaptation, often require target domain data for fine-tuning, which may not be available. Domain generalization (DG) aims to solve this by training models that generalize to unseen domains without any target data. However, applying existing DG techniques to crowd counting is challenging due to its regression nature and the inherent ambiguity in density map labels (where pixel values can be unclear due to background or head size variations). This paper tackles the specific and difficult problem of Single Domain Generalization (SDG) for crowd counting, where only one source domain is available for training, and this source domain might even have a narrow distribution.
Methods
MPCount introduces two key novel components to address the challenges of SDG in crowd counting:
- Attention Memory Bank (AMB): To reconstruct domain-invariant features for density regression, MPCount uses a single attention memory bank. This bank stores representative feature vectors. Instead of directly mapping input features, MPCount reconstructs them as an "attention" over these memory vectors. This allows for representing continuous density values with a finite memory. To further refine this, two mechanisms are employed:
- Content Error Mask (CEM): This mask identifies and filters out "domain-related content" by comparing instance-normalized features of the original and augmented images. Discrepancies above a threshold are considered domain shift effects and are masked out.
- Attention Consistency Loss (ACL): This loss encourages the attention scores produced by the original and augmented features to be similar, ensuring that the memory vectors consistently store domain-invariant representations.
- Patch-wise Classification (PC): To tackle the label ambiguity inherent in density maps (where background pixels might be assigned zero density, or head pixels might be ambiguous), MPCount introduces an auxiliary task. The input image is divided into a grid of patches, and each patch is classified as either containing a human head or not. This creates a "patch-wise classification map" (PCM). This PCM is then used to mask out regions predicted as "no head" from the density map, effectively using coarser but more accurate patch-level information to refine the density regression.
Datasets
The proposed MPCount method was evaluated on several standard crowd counting datasets:
- ShanghaiTech Part A (SHA) & Part B (SHB)
- UCF-QNRF (Q)
- JHU-Crowd++ (JHU-Crowd++)
A novel benchmark setting was introduced using JHU-Crowd++ by partitioning it into subsets based on image-level labels (e.g., "snow" (SN) and "fog/haze" (FH) for weather, or "stadium" (SD) and "street" (SR) for scenes). This creates "narrow source distribution" scenarios, which are more challenging for SDG.
Key Insights and Ideas
- AMB for Regression: The AMB, combined with CEM and ACL, proves effective in learning domain-invariant features for regression tasks, a significant step beyond its typical use in classification.
- Patch-wise Classification as a Label Cleaner: The PC task is a clever way to address the inherent ambiguity in density map labels. By providing a coarser, patch-level binary label, it helps the model avoid learning spurious correlations from noisy pixel-level annotations.
- Narrow Source Distribution is Tough: The experiments highlight that existing DG methods struggle significantly when the training data comes from a very specific, narrow distribution (like only snow or only fog images). MPCount shows a marked improvement in these challenging settings.
- Single Memory Bank Suffices: Unlike some prior DG methods that might use multiple memory banks for different sub-domains, MPCount demonstrates that a single AMB can be sufficient when combined with effective feature refinement techniques.
Key Results
MPCount achieves state-of-the-art performance on various crowd counting benchmarks, particularly in domain generalization settings.
- Significant Error Reduction: MPCount reduced counting error by:
- 21.8% on SN → FH
- 18.6% on FH → SN
- 18.2% on SHB → SHA
- 9.5% on SHA → SHB
- Superiority in Narrow Distributions: In challenging narrow-distribution scenarios (e.g., SD → SR, SN → FH), MPCount significantly outperforms other DG methods, including DCCUS, which struggles due to its sub-domain clustering approach failing in such cases.
- Competitive with DA: In some instances, MPCount's performance is comparable to or better than domain adaptation (DA) methods, which typically have access to target domain data.
- Component Effectiveness: Ablation studies confirm the effectiveness of each proposed component: AMB, CEM, ACL, and PC, with PC showing particular benefit in mitigating label ambiguity.
Limitations and Future Work
- Limitations:
- The paper acknowledges that while PCMs achieve satisfactory results, they are an auxiliary task, and further improvements in PCM accuracy are not the primary focus.
- The performance of CEM is sensitive to the threshold parameter $\alpha$, requiring careful tuning.
- Future Work:
- The authors suggest that the proposed MPCount framework can be extended to other regression tasks that suffer from domain shift and label ambiguity.
- Further exploration of the interaction between CEM and PC, and potentially optimizing $\alpha$ automatically, could be avenues for future research.
Summary updated