Introduction
Virtual hair try-on is a deceptively complex task in computer vision. To transfer a hairstyle from a reference source to a target face, models must overcome pose mismatches, preserve facial identity, and maintain realistic hair textures. Existing methods typically fall into two camps: slow, high-quality optimization-based approaches (like Barbershop) or fast, low-quality encoder-based models. HairFastGAN bridges this gap, offering a feed-forward architecture that matches state-of-the-art (SOTA) quality in near real-time.
Methodology
HairFastGAN decomposes hair transfer into four specialized modules to handle the distinct aspects of the task:
- Pose Alignment: A Rotate Encoder operates in StyleGAN’s $W+$ space to align the reference hair with the target's pose, preventing the warping artifacts common in previous models.
- Shape Alignment: By operating in the FS latent space (combining spatial feature maps $F$ and global style $S$), the model uses a modified SEAN architecture to inpaint areas where hair is added or removed.
- Color Alignment: A dedicated encoder leverages CLIP embeddings to transfer hair color independently of shape and lighting conditions.
- Refinement Alignment: To counteract the identity loss often seen in GAN inversion, a final post-processing encoder generates a high-resolution $F$ tensor to restore fine facial details and background.
Performance and Results
HairFastGAN delivers a significant breakthrough in the speed-accuracy trade-off for hair editing.
- Efficiency: On an Nvidia V100, the full transfer process takes just 0.78 seconds. This is a massive improvement over Barbershop, which requires over 10 minutes per image.
- Quality: The model achieves a Fréchet Inception Distance (FID) of 13.12, outperforming Barbershop (15.94) and HairCLIP (34.95).
- Robustness: The system remains stable even under extreme pose differences (up to 90-degree rotations) where competing models often fail.
Discussion and Limitations
The success of HairFastGAN lies in its use of the FS latent space, which retains more spatial information than the standard $W+$ bottleneck. However, some challenges remain. The model occasionally struggles with "long-to-short" transitions where it must inpaint large areas of newly revealed skin. Additionally, complex non-hair accessories (like ribbons) and perfectly bald styles can still produce artifacts.
Future developments aim to refine the inpainting logic and potentially introduce text-based color editing via the CLIP-based encoder.
Code is available at: https://github.com/AIRI-Institute/HairFastGAN
Summary updated