SSH: A Self-Supervised Framework for Image Harmonization

Yifan Jiang, He Zhang, Jianming Zhang, Yilin Wang, Zhe Lin, Kalyan Sunkavalli, Simon Chen, Sohrab Amirghodsi, Sarah Kong, Zhangyang Wang · DOI

Introduction

Image harmonization is a critical task in photo editing that involves adjusting the appearance of a foreground object to match its new background. The goal is to ensure that lighting, color temperature, and contrast are consistent across the composite image. Traditionally, training deep learning models for this task required expensive, manually retouched datasets. SSH (Self-Supervised Harmonization) addresses this bottleneck by leveraging a self-supervised approach that uses unlabeled natural images and 3D Look-Up Tables (LUTs).

The SSH Framework

The core of SSH is a "representation fusion" architecture. Instead of processing a single composite, the framework splits the task into two specialized branches:

  1. Content Network ($G_c$): Captures the structural and textural details of the foreground.
  2. Reference Network ($G_r$): Extracts the global appearance (lighting and color) from the background.
  3. Fusion Network ($F$): Integrates these features to produce the final harmonized image.

To train without ground truth, SSH employs Dual Data Augmentation. It creates "pseudo-triplets" by taking different crops of a single image and applying 3D LUTs to simulate complex, non-linear color shifts. This allows the model to learn realistic harmonization without needing human-annotated masks during training.

Example of a disharmonized composite illustrating the challenge of matching foreground lighting to a sunset background.

Experimental Results

The authors evaluated SSH on RealHM (Real-world HarMonization), a new benchmark of 216 high-resolution pairs retouched by professionals. SSH achieved state-of-the-art performance, reaching a PSNR of 27.91 and an MSE of 206.85, significantly outperforming supervised models like DoveNet (MSE 214.11) and $S^2$AM (MSE 283.27).

Qualitative comparison showing SSH's superior performance in maintaining natural skin tones and lighting consistency compared to existing methods like DoveNet and S2AM.

Qualitatively, SSH avoids the "washed out" appearance common in other methods. In a human study with 50 participants, SSH received a score of 2.295, nearly double the score of the popular DIH method (1.201).

Conclusion

SSH demonstrates that self-supervised learning, combined with 3D LUT-based augmentation, can surpass supervised methods in image harmonization. By disentangling content from appearance, the model effectively handles large foreground objects and complex lighting scenarios without the need for costly labeled data. Future work may focus on spatial-attention mechanisms to better handle backgrounds with highly varied lighting conditions.

Summary updated

BibTeX
@inproceedings{jiang2021ssh,
  author = {Yifan Jiang and He Zhang and Jianming Zhang and Yilin Wang and Zhe Lin and Kalyan Sunkavalli and Simon Chen and Sohrab Amirghodsi and Sarah Kong and Zhangyang Wang},
  title = {{SSH: A Self-Supervised Framework for Image Harmonization}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  url = {https://openreview.net/forum?id=XN1St50AIK},
}
Figure