HairFIT: Pose-invariant Hairstyle Transfer via Flow-based Hair Alignment and Semantic-region-aware Inpainting

Chaeyeon Chung, Taewoo Kim, Hyelin Nam, Seunghwan Choi, Gyojung Gu, Sunghyun Park, Jaegul Choo

TL;DR

HairFIT is a novel two-stage framework that enables "pose-invariant" hairstyle transfer, allowing users to swap hairstyles between images even when the subjects have different head orientations or face sizes. By combining keypoint-based optical flow for alignment with a semantic-aware inpainting module, the system successfully reconstructs occluded areas (like shoulders and backgrounds) that are revealed when switching from long to short hair.

What Problem Does This Paper Address?

Virtual hairstyle transfer—the task of "trying on" someone else's hair—usually hits two major roadblocks in the real world:

  1. Pose Mismatch: Most existing models assume the source person and the target hairstyle are facing the same way. If the source is looking left and the target is looking right, the transfer usually fails or looks distorted.
  2. The "Hole" Problem (Occlusions): When you replace a long hairstyle with a short one, the model must "hallucinate" what was behind the original hair. This might include parts of the forehead, shoulders, or the background. Standard inpainting often creates blurry or unrealistic artifacts because it doesn't understand the different textures of skin versus clothing.

Methods

The authors propose a two-stage pipeline called HairFIT:

  • Stage 1: Flow-based Hair Alignment: Instead of trying to force a hairstyle into a new pose during synthesis, HairFIT uses a Hair Flow Estimation Network. It extracts facial keypoints from both images and calculates an optical flow map to warp the target hairstyle so it physically aligns with the source person’s head position and scale.
  • Stage 2: Hair Synthesis & SIM Estimator: Once aligned, the images are blended. To handle the revealed "holes," the authors introduce the Semantic-region-aware Inpainting Mask (SIM) estimator. This module predicts which parts of the missing area should be face, clothes, or background.
  • ALIAS Generator: The model uses an Alignment-Aware Segment (ALIAS) generator that takes the SIM masks into account, ensuring that the "skin" regions get skin textures and "background" regions match the surrounding environment.

Datasets

The model was trained and evaluated on two large-scale multi-view datasets:

  • K-hairstyle: A dataset of 500,000 high-resolution images featuring over 6,400 identities with diverse viewing angles (0 to 360 degrees).
  • VoxCeleb: A dataset of over 100,000 "utterance" videos. The authors sampled frames from these videos to act as multi-view images of the same person.

Key Insights and Ideas

  • Explicit Warping vs. Latent Optimization: While previous models like LOHO try to optimize in a latent space to find a fit, HairFIT uses explicit geometric warping (optical flow). This makes the model much more robust to significant pose differences.
  • Inpainting is Semantic: The "aha moment" here is that an inpainting mask shouldn't be a single "fill this hole" command. By dividing the mask into semantic categories (face, clothes, background), the generator can apply specialized textures to each area, preventing "color bleeding" where background colors might leak onto a reconstructed shoulder.
  • Hair-Agnostic Training: To prepare the model for real-world use where identities differ, they trained the model to reconstruct a source image by removing its hair and "re-applying" it from a different view of the same person.

Key Results

  • Quantitative Superiority: HairFIT achieved a state-of-the-art Fréchet Inception Distance (FID) score of 18.53 on the K-hairstyle dataset, significantly outperforming MichiGAN (30.52) and LOHO (62.44).
  • Robustness to Difficulty: In tests categorized as "Extremely Difficult" (large pose differences), HairFIT maintained a low FID (24.60), while LOHO’s performance plummeted (95.89).
  • Identity Preservation: Using the ArcFace face recognition model, the authors showed that HairFIT preserves the source person's identity much better than StarGAN v2, which often inadvertently changes skin tone or face shape during the transfer.

Limitations and Future Work

  • Target Occlusions: The model relies on warping existing pixels. If the target hairstyle image has significant occlusions (e.g., a hand covering the hair), the model cannot "invent" the missing hair pixels and will produce an incomplete transfer.
  • Complex Textures: While the SIM estimator helps, the model still struggles to inpaint very complex clothing patterns (like intricate lace or specific logos) in the regions revealed by hair removal.
  • Segmentation Reliance: The quality of the output is heavily dependent on the accuracy of the initial hair segmentation masks. If the mask is noisy or includes parts of the forehead, the final result will reflect those inaccuracies.

Summary updated

BibTeX
@inproceedings{chung2021hairfit,
  author = {Chaeyeon Chung and Taewoo Kim and Hyelin Nam and Seunghwan Choi and Gyojung Gu and Sunghyun Park and Jaegul Choo},
  title = {{HairFIT: Pose-invariant Hairstyle Transfer via Flow-based Hair Alignment and Semantic-region-aware Inpainting}},
  booktitle = {BMVC},
  year = {2021},
  url = {https://openreview.net/forum?id=5tG_Gw00nf},
}
Figure