SketchHairSalon: Deep Sketch-based Hair Image Synthesis

Chufeng Xiao, Deng Yu, Xiaoguang Han, Youyi Zheng, Hongbo Fu

TL;DR

SketchHairSalon is a two-stage deep learning framework that synthesizes photo-realistic hair images directly from freehand sketches without requiring tedious, user-provided binary masks. By predicting soft hair mattes and leveraging self-attention modules, the system faithfully captures complex hair boundaries and intricate structures like braids, all within an interactive interface featuring smart stroke auto-completion.

What Problem Does This Paper Address?

Generating realistic hair from sketches is a notoriously difficult problem in computer vision and graphics. Hair possesses highly complex geometry, intricate layering, and soft boundaries that blend into the background.

Existing sketch-to-hair synthesis methods suffer from two major drawbacks:

  1. The Mask Burden: They typically require users to manually draw a binary mask to define the hair's shape. This is labor-intensive and forces a "hard boundary" that looks unnatural because real hair naturally diffuses into the background.
  2. Structural Loss: Most pipelines convert sketches into intermediate orientation maps to guide texture generation. While orientation maps capture local hair flow, they wash away global structural information, such as the coherence of individual wisps and the complex occlusions found in hairstyles like braids.

SketchHairSalon addresses these gaps by showing that colored sketches alone implicitly contain enough information to define shape, structure, and appearance simultaneously.

Methods

The authors propose a two-stage pipeline driven by deep generative networks, designed to transition from coarse shape to fine texture:

Fig. 5. The pipeline of our SketchHairSalon, a two-stage framework for sketch-based hair image synthesis from coarse to fine. Given a hair sketch, the first stage S2M-Net focuses on hair matte generation (Top). Then the generated matte representing a target hair shape is fused with the hair sketch indicating the local structure of a certain hairstyle. Based on that, the second stage S2I-Net manages to synthesize a realistic hair image (Bottom), by blending the background region on the feature levels guided by the generated matte. The background input (in the bottom-right corner) is derived by replacing the hair region of the original image with Gaussian noise. Both S2M-Net and S2I-Net apply the self-attention modules to capture the long-range dependencies of the input sketch. Note that we use skip connections, which are omitted in the figure for simplicity. Original image courtesy of Charcharius.
  1. Sketch-to-Matte (S2M-Net): The user draws sparse hair strokes and optional black "non-hair" strokes to define the outer boundaries. S2M-Net uses an encoder-decoder architecture to predict a soft hair matte (alpha channel), automatically inferring natural, soft boundaries.
  2. Sketch-to-Image (S2I-Net): This network takes both the original sketch and the generated matte to synthesize the final photo-realistic hair image. Crucially, it features a background blending module that merges the synthesized hair with an existing portrait image at the feature level.

Key Technical Innovations:

  • Self-Attention Modules: Because freehand sketches are sparse, standard convolutional layers struggle to connect distant strokes. The authors integrate self-attention modules into the decoders of both networks to capture long-range dependencies and ensure global structural coherence.
  • Shape Reconstruction Loss: To prevent braided sketches from melting into flat textures, a specialized Gaussian-blurred shape loss forces S2I-Net to maintain distinct, clear knot boundaries.
  • Smart Auto-Completion: Drawing repetitive hair strands or complex braids is tedious. The system includes a procedural engine that automatically expands a few boundary strokes into fully formed 3D braid sketches, alongside a diffusion-based tool to fill out unbraided hair regions.

Datasets

A major contribution of this work is the introduction of a high-quality, manually annotated hair sketch dataset, as existing datasets were either too small or relied on low-quality synthetic strokes.

  • The Dataset: Contains 4,500 hair sketch-image pairs (4,000 for training, 500 for testing). It covers straight (1K), wavy (2K), and braided (1K) hairstyles across various views (front, side, back).
  • Annotation Process: The authors used state-of-the-art matting algorithms to extract ground-truth soft mattes from real portrait images. Student helpers then meticulously traced sparse strokes over the images to capture true human sketching patterns, ensuring the network learned from realistic user inputs.
Fig. 3. Illustration of hair matte and hair sketch preparation. Given each hair image (a), its hair matte (b) is produced via the hair segmentation method [Muhammad et al. 2018], followed by the image matting algorithm [Li and Lu 2020]. Upon the matted image (b), (d) is our manually drawn sketch depicting the hair structures, while (c) is generated by a synthetic approach [Olszewski et al. 2020]. Original images courtesy of Nicole Geri and Wicker Paradise.

Key Insights and Ideas

  • Mattes Over Masks: Moving from binary masks to soft alpha mattes is a game-changer for hair synthesis. It allows the network to generate fine, realistic hair strands that naturally blur into the background.
  • Bypassing Orientation Maps: Directly mapping sketches to images—rather than routing through an orientation map—preserves critical geometric junctions (like T-junctions and overlapping wisps). This is what allows the network to successfully render complex structures like braids where previous methods failed.
  • Color as a Structural Guide: By assigning slightly different colors to neighboring strokes during training, the network learns to better distinguish occlusions and boundaries between overlapping hair wisps.

Key Results

SketchHairSalon was evaluated against state-of-the-art generative models including Pix2Pix, HIS, and MichiGAN.

Quantitative Performance

The proposed method significantly outperformed competitors on the Fréchet Inception Distance (FID) metric, which measures the visual quality and realism of generated images (lower is better):

  • SketchHairSalon (Ours): 15.553
  • MichiGAN: 24.327
  • HIS: 29.857
  • Pix2Pix: 31.336

User Studies

  • Perception Study: In a blind test comparing matte-based synthesis to mask-based synthesis, human evaluators preferred the matte-based results 95.8% of the time due to their natural boundaries.
  • Efficiency Gains: The interactive auto-completion tools drastically reduced user workload, saving an average of 17.15 seconds per unbraided hairstyle and 47.94 seconds per braided hairstyle. The system provides interactive feedback, generating an image in roughly 0.5 seconds.

Limitations and Future Work

Despite its strong performance, SketchHairSalon has a few limitations:

  • Complex Layering: It struggles with hairstyles that have too many overlapping layers because 2D sketches lack explicit depth information.
  • Extreme Textures: Hairstyle types like dreadlocks, tight spirals, or coils are difficult to represent with simple 2D lines, often causing the system to default to standard wavy hair patterns.
  • Lighting Inconsistencies: The network does not explicitly harmonize the lighting between the generated hair and the original background image, which can occasionally cause visual mismatch.

Future work aims to extend this framework from hairstyle synthesis (from scratch) to fine-grained hairstyle editing, and explore portrait relighting techniques to achieve perfect background integration.

Summary updated

BibTeX
@article{xiao2021sketchhairsalon,
  author = {Chufeng Xiao and Deng Yu and Xiaoguang Han and Youyi Zheng and Hongbo Fu},
  title = {{SketchHairSalon: Deep Sketch-based Hair Image Synthesis}},
  journal = {ACM Trans. Graphics},
  year = {2021},
  doi = {10.1145/3478513.3480502},
}
Figure