Learning Feature-Preserving Portrait Editing from Generated Pairs

Bowei Chen, Tiancheng Zhi, Peihao Zhu, Shen Sang, Jing Liu, Linjie LuoarXiv 2024 · DOI

Abstract

Portrait editing requires a delicate balance between applying significant stylistic changes and maintaining the subject's unique identity. Current methods often suffer from "identity drift" or require scarce paired real-world data. We present a novel framework that utilizes a Multi-Conditioned Diffusion Model (MCDM) trained on high-quality synthetic image pairs. By generating side-by-side training data with shared identity and pose conditions, and employing a mask-guided inference strategy, our approach achieves state-of-the-art performance in costume and expression editing while strictly preserving fine-grained facial features.

1. Introduction

Portrait editing, encompassing changes in attire, accessories, or facial expressions, is a fundamental task in digital photography and creative media. The primary challenge lies in the "identity drift" problem: modifying specific attributes (e.g., adding a Santa hat) often inadvertently alters the subject's underlying facial structure or distinctive features. Existing training-free methods frequently fail to maintain these details, while training-based approaches are hindered by the lack of large-scale, high-quality paired datasets of the same individual in different states.

2. Methodology

Our framework addresses these challenges through a three-stage pipeline designed for high-fidelity feature preservation.

2.1 Paired Data Generation

To overcome the data scarcity issue, we leverage Composable Diffusion to generate synthetic image pairs. By generating a single wide image containing two versions of the same subject side-by-side, and enforcing shared identity and pose conditions (via OpenPose), we ensure the "source" and "target" images are perfectly aligned in all aspects except the intended edit. This simultaneous generation process allows internal attention mechanisms to naturally enforce consistency between the pair.

2.2 Multi-Conditioned Diffusion Model (MCDM)

The MCDM is trained to learn specific editing directions anchored by three primary signals:

  • Spatial Embeddings: Maintain layout and hair shape consistency.
  • Text Embeddings: Guide the target edit (e.g., "in royal costume") through natural language.
  • Image Embeddings: Inject visual cues from the original face directly into the model's attention layers using a CLIP encoder and MLP.

2.3 Mask-Guided Inference

During inference, the model performs a reconstruction "dry run" to identify regions requiring modification. An automatic editing mask is generated, ensuring that background elements and untouched facial features remain bit-for-bit identical to the input image, effectively eliminating hallucinations in non-target areas.

Original source portrait used for editing.

3. Datasets and Evaluation

We curated two primary synthetic datasets: a Costume Editing Dataset (including flower, sheep, Santa, and royal themes) and a Cartoon Expression Dataset (neutral, angry, shocked, laughing, and crying). In total, 69,900 image pairs were generated.

Evaluation on real-world "in-the-wild" portraits demonstrates the model's robust generalization. Quantitatively, our method achieved a Structural Similarity Index (SSIM) of 0.791 and a Fréchet Inception Distance (FID) of 52.56 in costume editing tasks, outperforming baselines like DiffEdit and BBDM. Qualitative user studies further confirmed a strong preference for our method, with participants favoring it 3.3x more than DiffEdit for costume editing.

Portrait edited into a Santa costume, demonstrating high-fidelity identity preservation.

4. Conclusion

By combining synthetic paired data generation with a multi-conditioned diffusion architecture, we provide a robust solution for identity-preserving portrait editing. Our approach successfully mitigates identity drift and produces realistic results across diverse domains, from realistic costumes to stylized cartoon expressions. Future work will focus on expanding the system to support open-ended, instruction-based editing while maintaining this high level of identity preservation.

Summary updated

BibTeX
@misc{chen2024learning,
  author = {Bowei Chen and Tiancheng Zhi and Peihao Zhu and Shen Sang and Jing Liu and Linjie Luo},
  title = {{Learning Feature-Preserving Portrait Editing from Generated Pairs}},
  year = {2024},
  eprint = {2407.20455},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.20455},
}
Figure