Mask-Guided Portrait Editing with Conditional GANs

Shuyang Gu, Jianmin Bao, Hao Yang, Dong Chen, Fang Wen, Lu Yuan

Abstract

Portrait editing is a popular subject in photo manipulation. The Generative Adversarial Network (GAN) advances the generating of realistic faces and allows more face editing. In this paper, we argue about three issues in existing techniques: diversity, quality, and controllability for portrait synthesis and editing. To address these issues, we propose a novel end-to-end learning framework that leverages conditional GANs guided by provided face masks for generating faces. The framework learns feature embeddings for every face component (e.g., mouth, hair, eye), separately, contributing to better correspondences for image translation, and local face editing. With the mask, our network is available to many applications, like face synthesis driven by mask, face Swap+ (including hair in swapping), and local manipulation. It can also boost the performance of face parsing a bit as an option of data augmentation.

Introduction

While Generative Adversarial Networks (GANs) have made massive strides in creating realistic faces, they often struggle with fine-grained control and consistency. Existing methods frequently suffer from a lack of diversity, quality artifacts (such as blurry backgrounds), and limited controllability. Most models operate on the "global" face, making it difficult to edit a specific part—like the shape of the mouth—without affecting the rest of the image. This paper proposes that using a facial mask—a pixel-level map of facial components—is the key to providing the geometric constraints needed for truly realistic and editable portraits.

Methodology

The proposed end-to-end framework consists of three specialized sub-networks designed to disentangle facial features and ensure seamless integration:

  • Local Embedding Sub-Network: Instead of a single global encoder, this uses five separate auto-encoders to learn feature embeddings for specific components: left eye, right eye, mouth, skin/nose, and hair.
  • Mask-Guided Generative Sub-Network: This sub-network "assembles" the face by mapping the learned embeddings from a source image onto a target mask. This enables both "Component Editing" (changing mask shapes) and "Component Transfer" (swapping parts between individuals).
  • Background Fusion Sub-Network: To eliminate boundary artifacts, this network learns to fuse the generated foreground with the original background seamlessly.
The framework uses a semantic mask (inset) to provide geometric constraints, allowing for high-fidelity portrait synthesis and component-level control.

Training is guided by a combination of local and global reconstruction losses, multi-scale adversarial losses, and a Face Parsing Loss that ensures the generated face strictly adheres to the intended mask geometry.

Key Results and Applications

The framework demonstrates a significant quantitative edge, achieving a Fréchet Inception Distance (FID) score of 8.92, compared to over 11.0 for simplified variants. Qualitatively, the model produces much more diverse results in terms of skin color and texture when compared to state-of-the-art models like pix2pixHD.

Example of local facial manipulation: adding a mustache and beard while preserving the subject's identity and background integrity.

Beyond editing, the model enables "Face Swap+," which includes the complex task of swapping hair styles. Additionally, the framework serves as a powerful tool for data augmentation. By generating realistic faces with known masks, the authors improved the accuracy of a face parsing model from 0.728 to 0.871, demonstrating that generative AI can effectively solve discriminative tasks.

Conclusion

By treating the face as a collection of distinct parts rather than a single block, this mask-guided approach achieves unprecedented local control and realism. While the system's performance is dependent on the accuracy of the input mask, it provides a robust foundation for advanced portrait manipulation and improved facial analysis models.

Summary updated

BibTeX
@inproceedings{gu2019mask,
  author = {Shuyang Gu and Jianmin Bao and Hao Yang and Dong Chen and Fang Wen and Lu Yuan},
  title = {{Mask-Guided Portrait Editing with Conditional GANs}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2019},
  url = {https://openreview.net/forum?id=MtC2UcboJlTZ},
}

Loading related content...

Figure