HAP: Structure-Aware Masked Image Modeling for Human-Centric Perception

Junkun Yuan, Xinyu Zhang, Hao Zhou, Jian Wang, Zhongwei Qiu, Zhiyin Shao, Shaofeng Zhang, Sifan Long, Kun Kuang, Kun Yao, Junyu Han, Errui Ding, Lanfen Lin, Fei Wu, Jingdong Wang

Abstract

Human-centric perception tasks, such as pose estimation and person re-identification (ReID), require a nuanced understanding of human body structure. While Masked Image Modeling (MIM) has shown great promise in general computer vision, standard random masking strategies often disrupt the structural dependencies essential for human-centric tasks. We present HAP (Human structure-Aware Pre-training), a framework that integrates human part priors into the MIM pipeline. By employing part-aware mask sampling and a structure-invariant alignment loss, HAP enables a vanilla Vision Transformer (ViT) to achieve state-of-the-art performance across 11 major benchmarks, demonstrating the power of structure-aware self-supervised learning.

Introduction

Human-centric perception encompasses a wide range of tasks, including identifying individuals across non-overlapping camera views (ReID), estimating the coordinates of body joints (pose estimation), and recognizing specific pedestrian attributes. These tasks share a common requirement: a deep understanding of the human body's spatial and semantic structure.

Recent advances in self-supervised learning, particularly Masked Image Modeling (MIM) frameworks like MAE, have revolutionized general vision tasks by teaching models to reconstruct missing image patches. However, applying standard MIM to human-centric tasks often yields suboptimal results. The primary reason is that random masking frequently destroys critical structural information—such as the relationship between a shoulder and an elbow—that is vital for modeling human geometry. HAP addresses this by making the masking process "structure-aware."

Methodology

HAP enhances the standard MIM pipeline through three primary innovations designed to preserve and leverage human structural priors.

1. Human Part Prior and Part-Aware Masking

Instead of treating an image as a collection of independent patches, HAP utilizes 2D keypoints (extracted via an off-the-shelf pose estimator like ViTPose) to segment the human body into six logical semantic parts: the head, upper body, left arm, right arm, left leg, and right leg.

During the pre-training phase, HAP employs Part-Aware Mask Sampling. Rather than masking patches at random, the model selects entire body parts to mask out. This forces the encoder to learn the contextual correlations between different anatomical regions—for instance, predicting the position and appearance of a masked-out leg based on the visible torso and arms.

2. Structure-Invariant Alignment Loss

To further strengthen the model's discriminative capabilities, HAP introduces a Structure-Invariant Alignment Loss. For any given image, the model generates two distinct "views" by masking different sets of body parts. A contrastive loss (InfoNCE) is then applied to ensure that the latent representations of these two views remain closely aligned. This encourages the model to capture invariant human characteristics that persist regardless of which specific parts are occluded.

3. Optimized Training Strategy

Empirical analysis revealed that human-centric tasks benefit from specific hyperparameter configurations. HAP utilizes a higher "scaling ratio" to ensure more of the person remains within the crop and a moderate masking ratio of 50%, which differs from the higher masking ratios typically used in general-purpose MIM.

Experiments and Results

Datasets

HAP was pre-trained on a 2.1 million image subset of the LUPerson dataset. Evaluation was conducted across 12 diverse benchmarks, including:

  • Person ReID: MSMT17, Market-1501.
  • 2D Pose Estimation: MS COCO, MPII, AIC.
  • Text-to-Image ReID: CUHK-PEDES, ICFG-PEDES, RSTPReid.
  • 3D Pose & Shape: 3DPW.
  • Pedestrian Attribute Recognition: PA-100K, RAP, PETA.

Performance

HAP established new state-of-the-art (SOTA) results on 11 of the 12 benchmarks. Notable achievements include:

  • Person ReID: 78.1% mAP on MSMT17, outperforming specialized architectures.
  • 2D Pose Estimation: 78.2% AP on MS COCO.
  • Text-to-Image ReID: 68.05% Rank-1 on CUHK-PEDES, a significant improvement over the 60.19% achieved by the baseline MAE.
  • Pedestrian Attributes: 86.54% mA on PA-100K.

These results were achieved using a plain ViT-Base encoder, demonstrating that a specialized pre-training strategy can be more effective than designing complex, task-specific model architectures.

Discussion and Limitations

The success of HAP highlights that for articulated objects like humans, semantic structure is a critical component of effective representation learning. By combining the generative benefits of reconstruction with the discriminative benefits of contrastive alignment, HAP provides a robust foundation for human-centric vision.

However, the framework currently relies on pseudo-labels from external pose estimators. Inaccuracies in these initial estimations can propagate through the pre-training phase. Additionally, because the Vision Transformer operates on fixed-size patches, the masking of body parts is an approximation; some patches may contain pixels from multiple semantic regions.

Conclusion

HAP demonstrates that structure-aware masking is a powerful paradigm for human-centric perception. By moving beyond random patch masking and incorporating anatomical priors, HAP enables standard Vision Transformers to excel at complex tasks involving human geometry and identity. Future work may extend this philosophy to other articulated objects or explore more granular, human-annotated structural priors.

Summary updated

BibTeX
@inproceedings{yuan2023hap,
  author = {Junkun Yuan and Xinyu Zhang and Hao Zhou and Jian Wang and Zhongwei Qiu and Zhiyin Shao and Shaofeng Zhang and Sifan Long and Kun Kuang and Kun Yao and Junyu Han and Errui Ding and Lanfen Lin and Fei Wu and Jingdong Wang},
  title = {{HAP: Structure-Aware Masked Image Modeling for Human-Centric Perception}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=6XPPfZkhKi},
}
Figure