Interactive Portrait Harmonization

Jeya Maria Jose Valanarasu, He Zhang, Vishal M. Patel · DOI

TL;DR

This paper introduces "Interactive Portrait Harmonization," a novel approach that allows users to select specific regions within a reference image to guide the harmonization of a composite foreground. This offers significantly more control than traditional methods that rely on the entire background, leading to more visually pleasing and realistic portrait edits.

What Problem Does This Paper Address?

Image harmonization aims to seamlessly blend a foreground object into a new background, ensuring consistent color and lighting. Existing methods typically use the entire background as a reference, which can be problematic. For instance, if a background has complex or varying lighting conditions, or if the user wants to match the foreground to a specific element (like another person) rather than the whole scene, these methods fall short. This is particularly true for portrait editing, a common use case where users often want to match the lighting of a newly added person to an existing person in the photo. The paper addresses this limitation by enabling user-guided harmonization through the selection of a specific reference region.

Methods

The core of the proposed solution is an "Interactive Harmonization" framework with two main components:

  • Harmonizer Network: This is an encoder-decoder architecture that takes the masked composite foreground image as input. Crucially, it also incorporates a "style code" derived from a reference region. This style code is injected into the decoder via adaptive instance normalization (AdaIN) layers, allowing the network to learn and apply the visual characteristics of the reference region to the foreground.
  • Style Encoder Network: This network takes the user-selected reference region as input and extracts a "style code" that captures its color and luminance properties.

A key innovation is the Luminance Matching Loss. Inspired by professional photo editing techniques, this loss function explicitly matches the highlight, mid-tone, and shadow intensity points between the reference region and the harmonized foreground. This goes beyond simple global statistics matching and ensures a more precise alignment of visual appearance. Additionally, the framework uses Triplet Losses to ensure the style code of the harmonized foreground is closer to the reference region's style code and further from the original composite foreground's style code.

Datasets

The authors introduce two datasets:

  • IntHarmony: A newly curated synthetic dataset designed for interactive harmonization. It includes composite images, ground truth, foreground masks, and importantly, a "guide mask" indicating the reference region. This dataset is built upon MS-COCO and MHP datasets, utilizing instance masks and extensive augmentations to simulate various scenarios.
  • PortraitTest: A real-world dataset of high-resolution composite portraits, annotated by professional experts. This dataset is used for evaluating the method's performance on realistic, in-the-wild scenarios.

Key Insights and Ideas

  • User-guided harmonization is crucial for portraits: Professional editors often match specific elements (like people) rather than the entire background. This paper formalizes this intuition into a computational framework.
  • Region-specific style transfer is more effective than global background matching: By allowing users to select a reference region, the method achieves better control and more realistic results, especially when background lighting is complex or inconsistent.
  • Mimicking professional editing techniques yields better results: The proposed luminance matching loss, inspired by how professionals match highlight, mid-tone, and shadow points, significantly improves harmonization quality.
  • Flexibility is key: The framework can be easily adapted for tasks beyond harmonization, such as interactive color transfer, by modifying the loss functions and style code generation.

Key Results

  • Quantitative Improvements: The proposed method, IPH, achieves state-of-the-art results on both the PortraitTest and IntHarmony datasets, outperforming existing methods like Dove-Net, Bargain-Net, and Rain-Net in PSNR, SSIM, and MSE metrics. For example, on PortraitTest, IPH achieves a PSNR of 36.52, significantly higher than other methods.
  • Qualitative Improvements: Visual comparisons show that IPH produces more visually pleasing and consistent results, closely matching the appearance of the reference region. Generic harmonization methods often fail to capture local lighting nuances, leading to unnatural composites, whereas IPH effectively addresses this.
  • User Study Validation: A human subjective review ranked IPH as the best-performing method, consistent with the quantitative metrics.
  • Parameter Efficiency: IPH is noted to be lighter than previous methods, with 27M parameters compared to Bargain-Net's 58M.

Limitations and Future Work

  • Object Material Peculiarities: The method's performance can decrease when harmonizing objects with peculiar materials (e.g., shiny surfaces) because the style encoder struggles to extract meaningful texture/material reflectance.
  • Potential for Misuse: The ability to create realistic fake images raises concerns about potential misuse for harassment or fraud. The authors suggest gated release of trained models as a potential mitigation.
  • Automatic Region Selection: While the current framework is user-guided, the authors suggest future work could involve using saliency detection models to automatically identify salient objects/people as reference regions, making the process more automatic.

Summary updated

BibTeX
@inproceedings{valanarasu2023interactive,
  author = {Jeya Maria Jose Valanarasu and HE Zhang and Vishal M. Patel},
  title = {{Interactive Portrait Harmonization}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=AP0iZoaRaS},
}
Figure