Introduction
Hair editing is a notoriously difficult sub-field of semantic face editing. The goal is to change a person's hairstyle or color based on a text description (e.g., "a purple ombre bob") or a reference image, all while keeping the person's identity, makeup, accessories, and background perfectly intact.
For years, StyleGAN was the go-to architecture for this task. However, due to its limited spatial distribution, StyleGAN struggles to represent complex, non-uniform color patterns and often "leaks" hair changes into facial features, erasing earrings or altering eye makeup. While newer Diffusion Models offer better generative capabilities, they face their own hurdles: they lack precise control for transferring specific colors from one image to another and often struggle with the nuanced vocabulary of hair styling (e.g., "dip-dyed" vs. "streaked").
HairDiffusion leverages Latent Diffusion Models (LDMs) to perform high-fidelity hair editing, excelling specifically at complex multi-color styles like ombre or split-dye. By introducing a novel Multi-stage Hairstyle Blend (MHB) and a dedicated warping module, the framework achieves superior identity preservation and color accuracy from both text and image prompts.
Methodology: Decoupling Style and Color
The authors propose a two-stage pipeline built on Stable Diffusion that treats hair editing as a sophisticated inpainting task.
- Hair-Agnostic Masking: To ensure the face and background remain untouched, the system generates masks that specifically isolate the hair region while preserving the forehead, ears, and neck.
- Style and Color Proxies:
- Style Proxy: Generates a target hairstyle shape using text or a reference image, guided by facial keypoints to ensure the new hair "fits" the head correctly.
- Color Proxy & Warping Module: To transfer color from a reference image, the authors adapted a warping module (commonly used in virtual try-on tasks) to align the reference hair to the target person's pose. This prevents "color bleeding" and ensures the color structure (like a gradient) lands in the right place.
- Multi-stage Hairstyle Blend (MHB): This is the core innovation. Instead of trying to generate everything at once, MHB decouples style and color in the diffusion latent space. It blends the color proxy and the style proxy at specific timesteps during the denoising process, allowing the model to prioritize shape first and then "fill in" the complex color textures.
- Fine-tuned CLIP: Standard vision-language models are surprisingly bad at niche hair terms. To bridge this semantic gap, the researchers fine-tuned the CLIP text encoder on a custom dataset of ~4,600 high-quality images of multi-colored hair, complete with GPT-4 generated and human-verified captions.
Key Insights
- Decoupling is Essential: You cannot simply prompt a model to "change everything" at once. By separating the shape (style proxy) from the texture (color proxy) and injecting them into the diffusion process at different stages, the model avoids the "identity blur" common in GAN-based methods.
- Warping Overcomes Pose Mismatch: Using a reference image as a color guide fails if the reference person is looking left and the target is looking right. Warping the reference hair to match the target's geometry before diffusion provides a much stronger spatial prior.
- The Vocabulary of Hair: Domain-specific fine-tuning is the difference between a generic "purple hair" result and a vivid "purple-to-pink dip-dye."
Results and Performance
HairDiffusion was tested against heavyweights like HairCLIP, TediGAN, and ControlNet-Inpainting, using the CelebAMask-HQ dataset as a primary benchmark.
- Quantitative: It achieved an Identity Similarity (IDS) score of 0.94, significantly higher than HairCLIPv2 (0.84). It also led in PSNR (33.1) and SSIM (0.95), indicating much better preservation of non-hair details.
- Qualitative: The visual results are striking. While GAN methods often produce "flat" colors or blurry faces, HairDiffusion maintains sharp details in earrings and skin texture while successfully rendering complex "split color" and "ombre" transitions that look physically plausible.
- User Study: In human evaluations, HairDiffusion was preferred for "Accuracy" (42.9% vs. the next best at 21.3%) and "Naturalness."
Limitations and Future Work
Despite its success, the model has a few limitations:
- Extreme Poses: Transferring hair from a profile view to a frontal view remains challenging and can result in empty areas or artifacts.
- Length Discrepancies: Going from very short hair to very long hair can sometimes confuse the warping module, leading to misaligned hair ends.
- Segmentation Reliance: The quality of the edit is heavily dependent on the accuracy of the initial face/hair segmentation. If the mask is off, the edit will be too.
The authors suggest that moving to even more advanced, higher-resolution diffusion backbones could further resolve these fine-grained texture issues in future iterations.
Summary updated