Barbershop: GAN-based image compositing using segmentation masks

Seamlessly blending features from multiple images is extremely challenging because of complex relationships in lighting, geometry, and partial occlusion which cause coupling between different parts of the image. Even though recent work on GANs enables synthesis of realistic hair or faces, it remains difficult to combine them into a single, coherent, and plausible image rather than a disjointed set of image patches. We present a novel solution to image blending, particularly for the problem of hairstyle transfer, based on GAN-inversion. We propose a novel latent space for image blending which is better at preserving detail and encoding spatial information, and propose a new GAN-embedding algorithm which is able to slightly modify images to conform to a common segmentation mask. Our novel representation enables the transfer of the visual properties from multiple reference images including specific details such as moles and wrinkles, and because we do image blending in a latent-space we are able to synthesize images that are coherent. Our approach avoids blending artifacts present in other approaches and finds a globally consistent image. Our results demonstrate a significant improvement over the current state of the art in a user study, with users preferring our blending solution over 95 percent of the time. Source code for the new approach is available at

Zhu, P., Abdal, R., Femiani, J., & Wonka, P. (2021). Barbershop. ACM Transactions on Graphics, 40(6), 1–13. doi:10.1145/3478513.3480537

We would also like to thank the anonymous reviewers for their insightful comments and constructive remarks. This work was supported by the KAUST Office of Sponsored Research (OSR) and the KAUST Visual Computing Center (VCC).

Association for Computing Machinery (ACM)

ACM Transactions on Graphics



Additional Links

Permanent link to this record

Version History

Now showing 1 - 2 of 2
2023-03-26 07:05:25
Published in journal
2021-12-12 10:45:50
* Selected version