TL;DR
HairFusion is a novel one-stage diffusion framework that enables high-fidelity hairstyle transfer between arbitrary "in-the-wild" face images. By combining a hair-agnostic representation with a pose-aware cross-attention mechanism, it successfully transfers complex hair textures and shapes while strictly preserving the original identity, clothing, and background of the target face.
What Problem Does This Paper Address?
Hairstyle transfer is a deceptively difficult image editing task. You want to take the hair from Image A (the reference) and place it on Image B (the source face) so naturally that it looks like a real photo.
The current state-of-the-art has two major bottlenecks:
- StyleGAN Limitations: Most existing methods rely on StyleGAN, which is excellent at generating faces but only within a very narrow "latent space." It typically requires images to be perfectly cropped and aligned. If a user provides a photo with an extreme head tilt or a non-standard focal length, StyleGAN-based methods often fail or produce blurry results.
- Identity and Background Bleed: While newer diffusion-based inpainting models can handle diverse poses, they often struggle to preserve the "non-hair" parts of the image. They might accidentally change the color of a shirt, alter the background, or subtly shift the person's facial features, ruining the identity preservation.
Methods
HairFusion treats hairstyle transfer as an exemplar-based image inpainting task, built on top of Stable Diffusion v1.4. The authors introduce three key innovations to solve the pose and preservation issues:
- Hair-Agnostic Representation: To prevent the model from being "distracted" by the source's original hair, they preprocess the source image to remove all hair information while carefully preserving the face outline, neck, and shoulders.
- Hair Align Cross-Attention (Align-CA): This is the core architectural change. Standard cross-attention treats the reference hair as a global condition. Align-CA instead uses DensePose features (spatial maps that define the 3D surface of the head) to guide the attention. This allows the model to understand the geometric relationship between the reference hair and the target face, effectively "warping" the hair to fit the new head pose.
- Adaptive Hair Blending: During the final steps of the denoising process, the model uses its own internal cross-attention maps to identify exactly where the new hair has been generated. It then blends only these specific pixels back into the original source image. This ensures that the background and clothing remain 100% identical to the original photo.
Datasets
The authors trained and evaluated HairFusion using two large-scale multi-view datasets:
- K-Hairstyle: A dataset of 500,000 high-resolution face images featuring diverse focal lengths and head poses across 6,400 identities.
- CelebV-Text: A large-scale facial video dataset. The authors sampled 6,000 video clips to provide "in-the-wild" variety, including motion and complex backgrounds.
Key Insights and Ideas
- Geometry over Pixels: The most significant "aha moment" is the use of DensePose within cross-attention. By providing the model with a structural map of the head, it learns to transfer the concept of the hairstyle (e.g., "long curls") and adapt it to the target's geometry, rather than just trying to copy-paste pixels.
- Self-Guided Blending: Instead of relying on a static, pre-defined mask for blending, the authors realized the model's own attention maps are the best indicators of where the hair actually ended up. This "adaptive" approach handles hair of different lengths and volumes much better than a fixed mask.
- One-Stage Efficiency: Unlike GAN-based methods that often require complex multi-stage optimization or latent code searching, HairFusion works in a single forward pass during inference, making it more robust for real-world applications.
Key Results
HairFusion achieved state-of-the-art (SOTA) results across both quantitative metrics and qualitative human perception:
- Quantitative: On the K-Hairstyle dataset, HairFusion achieved an FID of 10.82, significantly outperforming diffusion baselines like Paint-by-Example (13.26) and StyleGAN-based methods like SYH (22.84). Lower FID indicates higher image quality and realism.
- Qualitative: As shown in Figure 1 and Figure 5, HairFusion maintains sharp hair textures (like individual curls) and perfectly preserves identity even when the reference and source images have vastly different head poses.
Limitations and Future Work
Despite its strengths, the authors note a few areas for improvement:
- External Dependencies: The quality of the output is tied to the accuracy of external face parsers and landmark detectors. If these models fail to detect a stray lock of hair, HairFusion might miss it too.
- Fine Details near Hair: The model occasionally struggles to reconstruct very fine details (like small text on a background) if they are located immediately adjacent to the generated hair region.
- Lack of Explicit Control: Currently, the model transfers the hairstyle "as is." Future work could explore adding control sliders for hair length, volume, or color independent of the reference image.
Summary updated