Abstract
Hair editing is a critical image synthesis task that aims to edit hair color and hairstyle using text descriptions or reference images, while preserving irrelevant attributes such as identity, background, and clothing. Many existing methods rely on StyleGAN; however, due to the limited spatial distribution of StyleGAN, these models often struggle with multi-color hair editing and facial preservation. We introduce HairDiffusion, a framework utilizing Latent Diffusion Models (LDMs) for hairstyle editing. Our approach introduces Multi-stage Hairstyle Blend (MHB), effectively separating control of hair color and hairstyle in diffusion latent space. Additionally, we train a warping module to align hair color with the target region and fine-tune a CLIP model using a specialized multi-color hairstyle dataset. Extensive experiments demonstrate the superiority of our method in editing complex multi-color hairstyles while preserving facial attributes.
Introduction
Hair editing is a surprisingly difficult sub-field of semantic face editing. For years, StyleGAN was the gold standard for generating realistic faces. However, its latent space representation is spatially restricted, leading to two primary failures:
- Complex Color Structures: StyleGAN struggles with non-uniform patterns like "ombre" (top-to-bottom gradients) or "split-color" (left-to-right transitions).
- Attribute Preservation: Editing hair often "leaks" into the rest of the face, altering identity or removing fine details like jewelry and makeup.
While Diffusion Models offer better localized inpainting, they typically lack the fine-grained control required to precisely transfer specific hair textures or color patterns from a reference image. HairDiffusion addresses these gaps by treating hair editing as a sophisticated, decoupled inpainting task within a latent diffusion framework.
Methodology
The HairDiffusion pipeline is built on Latent Diffusion Models (LDMs) and introduces three core innovations to achieve high-fidelity editing.
Multi-stage Hairstyle Blend (MHB)
The MHB module acts as the central control mechanism, separating hair color and hairstyle within the diffusion latent space. By blending a "color proxy" and a "style proxy" at different timesteps during the denoising process, the model generates the desired shape without losing the specific color pattern. This decoupling allows the model to treat hairstyle (shape/texture) and hair color (pigment/pattern) as separate conditions.
Hair Warping Module
To ensure color information is accurately placed, we utilize a warping module inspired by virtual try-on research. This module uses facial keypoints and DensePose to "stretch" the reference hair to align with the target subject's head. This provides a spatial "hint" to the diffusion process, significantly reducing artifacts at the boundaries where hair meets skin.
Multi-color CLIP Fine-tuning
Standard CLIP models often lack the nuanced vocabulary required for complex hair patterns. To bridge this gap, we fine-tuned CLIP on a custom dataset of multi-colored hair. This ensures the model understands specific semantic terms like "dip-dyed," "streaked," or "split-tone," allowing for more accurate text-to-image synthesis.
Datasets and Training
Our research utilized a combination of standard benchmarks and a newly curated dataset:
- CelebAMask-HQ & CelebA-HQ: Used for training the warping module and general evaluation.
- Custom Multi-color Dataset: To address the lack of variety in existing datasets, we curated 4,625 high-quality multi-color text-image pairs. We scraped tens of thousands of images and used GPT-4 to generate precise text annotations for fine-tuning the CLIP model.
Experimental Results
HairDiffusion significantly outperforms previous GAN-based and Diffusion-based methods in both quantitative and qualitative metrics:
- Identity Preservation: HairDiffusion achieved an Identity Similarity (IDS) score of 0.94, outperforming the previous state-of-the-art, HairCLIPv2 (0.84).
- Reconstruction Quality: The model reached a PSNR of 33.1, indicating much higher reconstruction accuracy than TediGAN (22.5) or HairCLIP (21.6).
- Visual Fidelity: Qualitatively, HairDiffusion is the first model to reliably produce natural-looking "split-color" and "ombre" effects that follow the natural flow of hair strands, whereas competing models often produce muddy or monochromatic results.
Conclusion and Future Work
HairDiffusion represents a significant step forward in localized image editing. By decoupling style and color through MHB and utilizing a spatial warping prior, we achieve unprecedented control over complex hair patterns.
However, some challenges remain. The warping module can struggle with extreme pose differences or significant gaps in hair length between the reference and target. Additionally, transferring color from side-profile references to front-facing targets remains difficult due to a lack of 3D spatial understanding. Future work will explore integrating 3D hair modeling and utilizing more powerful base models like SDXL to further enhance fine-grained texture generation.
Summary updated