Abstract
Hairstyle transfer aims to synthesize a target hairstyle onto a source face while maintaining the source's identity and background. Traditional GAN-based methods often fail in unconstrained "in-the-wild" settings due to rigid alignment requirements. We present HairFusion, a novel one-stage diffusion framework that addresses these challenges through a hair-agnostic representation and a pose-aware cross-attention mechanism. Our approach ensures high-fidelity transfer even under significant pose and focal length mismatches, outperforming state-of-the-art baselines in both quantitative metrics and qualitative realism.
Introduction
The task of hairstyle transfer involves extracting the hair from a reference image and seamlessly integrating it onto a source face. While Generative Adversarial Networks (GANs) like StyleGAN have shown promise, they are typically limited to well-aligned, front-facing portraits. Real-world photography often involves varied head poses and camera angles where GANs struggle to generalize. Furthermore, existing methods frequently suffer from "identity leakage," where the source's facial features or background elements are inadvertently altered during the transfer process.
Methodology
HairFusion treats hairstyle transfer as a specialized exemplar-based inpainting problem. The framework incorporates three primary technical innovations:
1. Hair-Agnostic Representation
To prevent the source's original hairstyle from interfering with the generation process, we preprocess the source image to remove hair while preserving the face, neck, and shoulders. This "clean slate" approach ensures that the new hairstyle is generated without "bleeding" from the original.
2. Hair Align Cross-Attention (Align-CA)
A significant challenge in hairstyle transfer is the geometric mismatch between the reference hair and the source head. We introduce Align-CA, which leverages DensePose features—a mapping of 3D human geometry to 2D pixels. By injecting these pose-aware features into the cross-attention layers of a latent diffusion model, the network learns to warp the reference hair to fit the target head's specific geometry.
3. Adaptive Hair Blending
To ensure 100% preservation of the background and clothing, we employ an adaptive blending technique during inference. The model utilizes its internal attention maps to identify the precise region where the new hair was generated. This allows for a seamless merge of the generated hair pixels back into the original source image, eliminating reconstruction errors in non-target areas.
Experiments and Results
We evaluated HairFusion using the K-hairstyle dataset (500,000 high-resolution images) and the CelebV-Text dataset (70,000 in-the-wild video clips).
Quantitative Performance
HairFusion achieves a state-of-the-art FID (Fréchet Inception Distance) of 10.82 on the K-hairstyle dataset. This represents a significant improvement over the leading diffusion-based baseline, Paint-by-Example (FID: 13.26), and nearly doubles the performance of GAN-based methods like StyleYourHair (FID: 22.84). Lower FID scores indicate higher image realism and better alignment with the target distribution.
Qualitative Analysis
Visual comparisons demonstrate HairFusion's ability to preserve fine-grained textures and individual curls, even when the reference and source images have vastly different poses. The model successfully maintains the source subject's identity and background integrity.
Conclusion
HairFusion provides a robust solution for faithful hairstyle transfer in unconstrained environments. By decoupling geometry from texture through pose-aware attention and utilizing hair-agnostic representations, it achieves superior identity preservation. Future work will focus on improving robustness to extreme facial occlusions and reducing the computational overhead inherent in diffusion-based generation.
Summary updated