Interactive Portrait Harmonization

Jeya Maria Jose Valanarasu, He Zhang, Jianming Zhang, Yilin Wang, Zhe Lin, Jose Echevarria, Yinglan Ma, Zijun Wei, Kalyan Sunkavalli, Vishal M. Patel

TL;DR

This paper introduces Interactive Portrait Harmonization, a novel framework that allows users to select a specific reference region (like another person) within a background image to guide the color and lighting adjustments of a composited foreground element. By combining a style encoder-decoder architecture with a novel luminance matching loss that targets highlights, mid-tones, and shadows, the proposed method significantly outperforms traditional global background harmonization techniques while using half the parameters.

What Problem Does This Paper Address?

Image harmonization is the art of adjusting a newly pasted foreground object so it blends seamlessly with the lighting, color, and contrast of a background image. Traditional state-of-the-art (SOTA) methods treat the entire background as a single, monolithic source of style guidance.

However, this global approach fails in two very common real-world scenarios:

  1. Studio Portraits: The background is often a solid screen or backdrop that provides zero useful illumination context for the newly inserted subject.
  2. Spatially Varying Illumination: In complex scenes, lighting changes dramatically across the frame. If you paste a portrait next to someone standing directly under a warm spotlight, a global model will average out the entire room's lighting, resulting in an unrealistic blend.

The authors address this gap by shifting the paradigm from automatic global harmonization to user-guided interactive harmonization, allowing editors to explicitly define which region or person should dictate the foreground's appearance.

Fig. 1. Testing with in-the-wild portrait composites. Top row- Professional Studio Por- trait, Bottom row- Casual portrait. It can be observed that the current SOTA harmo- nization method [15] fails to give realistic results as it tries to match the appearance of foreground to the entire background. Our proposed interactive harmonization frame- work produces a visually pleasing portrait harmonization as it matches the appearance of the original portrait in the reference region instead of the entire background as selected by the user.

Methods

The proposed framework consists of two primary sub-networks: a Harmonizer Network and a Style Encoder.

  • Interactive Style Injection: The user provides a mask selecting a reference region ($R$). The Style Encoder uses partial convolutional layers to extract a 1D style code ($\phi$) from this arbitrary region. This code is then injected into the decoder block of the main harmonization network via Adaptive Instance Normalization (AdaIN) layers, aligning the foreground's style with the reference region while preserving its original spatial structure.
  • Luminance Matching Loss ($L_{LM}$): To mimic the workflow of professional photo editors, the authors introduce a loss function that explicitly matches the luminance statistics between the harmonized foreground ($H$) and the ground truth ($\hat{I}$). It calculates the L1 distance across three distinct bands:
  • Highlights: The 90th percentile of luminance points.
  • Shadows: The 10th percentile of luminance points.
  • Mid-tones: The mean luminance.
  • Triplet & Consistency Losses: To ensure robust training, the network employs a consistency loss to keep the style codes of the reference and harmonized regions tightly bound, alongside triplet losses that force the harmonized foreground's style closer to the reference region and away from the unharmonized composite input.

Datasets

Because existing public datasets (like iHarmony4) only support global background harmonization, the authors curated two new datasets:

  • IntHarmony: A synthetic dataset built on MS-COCO using instance masks to define both a foreground object and a distinct reference guide region. It contains 118,287 training images and 959 testing images, heavily augmented with varying luminance, contrast, and color profiles.
  • PortraitTest: A real-world testing benchmark consisting of 50 high-resolution composite portrait images. The ground truths were manually annotated by professional graphic designers using Photoshop curve adjustments to ensure maximum visual realism.
  • MHP Augmentation: The authors also leveraged the Multi-Human People Parsing (MHP) dataset, applying their augmentation scheme to fine-tune the network specifically for human portraits.

Key Insights and Ideas

  • Style Bleeding Prevention: The authors discovered that feeding an entire composite image into the harmonizer network caused the style code information to "bleed" into the background, reducing its impact on the foreground. Masking out the background entirely and feeding only the isolated foreground region concatenated with the style code yielded significantly better training stability.
  • Mimicking Human Experts: Rather than relying solely on abstract deep feature representations, explicitly forcing statistical alignment at the highlight, mid-tone, and shadow levels provides a powerful inductive bias that directly mirrors professional color-grading workflows.

Key Results

The proposed interactive model (IPH++) achieved dominant quantitative and qualitative performance over existing SOTA models:

  • Quantitative Performance: On the PortraitTest dataset, IPH++ achieved a PSNR of 36.52 and an MSE of 18.33. In comparison, the leading generic SOTA method, RainNet, trailed significantly with a PSNR of 28.55 and an MSE of 129.64. Even when competing architectures were adapted to accept interactive reference regions (BargainNet (R)++), they only achieved a PSNR of 30.10.
  • User Study: In a subjective review involving 30 human subjects ranking visual consistency, the proposed method scored the highest mean rank (28.33), outperforming adapted Bargain-Net (26.40) and Rain-Net (12.26).
  • Efficiency: Despite its superior performance, the IPH architecture is highly compact, containing just 27M parameters—roughly half the size of Bargain-Net (58M) and Rain-Net (54M).

Limitations and Future Work

  • Complex Materials: The framework's performance degrades when dealing with object portraits that feature highly peculiar or reflective materials (e.g., shiny metallic or glassy surfaces), as the style encoder struggles to map complex material reflectance into a simple 1D style code.
  • Moving Toward Automation: While user interaction is a core feature, the authors note that the pipeline could be made fully automatic in the future by integrating saliency detection models to predict and select the most logical reference person or object in the background automatically.

Summary updated

BibTeX
@inproceedings{valanarasu2023interactive,
  author = {Jeya Maria Jose Valanarasu and He Zhang and Jianming Zhang and Yilin Wang and Zhe Lin and Jose Echevarria and Yinglan Ma and Zijun Wei and Kalyan Sunkavalli and Vishal M. Patel},
  title = {{Interactive Portrait Harmonization}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=AP0iZoaRaS},
}
Figure