Spatial-Separated Curve Rendering Network for Efficient and High-Resolution Image Harmonization

Jingtang Liang, Xiaodong Cun, Chi-Man Pun

TL;DR

This paper introduces S²CRNet, a novel network for image harmonization that treats the problem as learning global color curves rather than pixel-wise translation. This approach significantly reduces model parameters and computational cost, enabling efficient, high-resolution image harmonization on edge devices and achieving state-of-the-art results.

What Problem Does This Paper Address?

Image harmonization is the process of making a composited image (where a foreground object is placed onto a background) look natural by adjusting the foreground's color and lighting to match the background. Traditional methods often treat this as a pixel-to-pixel image translation task, typically using complex encoder-decoder architectures like UNets. While effective, these models are computationally expensive, have large parameter counts, and struggle with high-resolution images or deployment on resource-constrained devices. This limits their practical application in real-world editing scenarios.

Methods

The core innovation is the Spatial-Separated Curve Rendering Network (S²CRNet). Instead of pixel-wise operations, S²CRNet models harmonization as learning a global, image-adaptive color transformation.

Here's a breakdown of the key components:

  • Spatial-Separated Feature Extraction: The input composite image and its mask are first downscaled to create thumbnails. These thumbnails are then split into foreground and background regions. A shared backbone network (like SqueezeNet or VGG16) extracts features from these separated regions independently.
  • Curve Rendering Module (CRM): This module takes the spatial-separated features and learns parameters for a piecewise linear color curve. This curve is then used to transform the original foreground pixels. The key idea is that the parameters of the curve are learned, not the direct pixel mapping.
  • Extensions:
    • Semantic-CRM (SCRM): Incorporates semantic labels of the foreground object (e.g., "person," "animal") to guide the curve learning, allowing for more category-specific harmonization.
  • Cascaded-CRM: Applies the CRM in multiple stages, allowing for a cascaded refinement of the harmonization process, similar to how image editing is done in layers.

The final harmonized image is created by combining the rendered foreground with the original background.

Datasets

  • iHarmony4: A synthesized dataset used for training and evaluation, consisting of four sub-datasets (HCOCO, HAdobe5k, HFlickr, Hday2night).
  • DIH99: A real-world dataset used for evaluating performance on actual composite images.

Key Insights and Ideas

  • Global Curves vs. Pixel-wise Translation: Reframing harmonization as learning global color curves, rather than pixel-wise transformations, is the key to efficiency and high-resolution handling. This mirrors how human editors often adjust global color properties.
  • Spatial Separation is Crucial: Separating foreground and background features before learning allows the model to capture domain-specific characteristics more effectively, leading to better harmonization.
  • Efficiency Through Parameter Reduction: By learning curve parameters instead of dense pixel mappings, the model drastically reduces its parameter count (over 90% fewer than previous methods) without sacrificing performance.
  • Resolution Invariance: The fixed-size feature extraction and curve parameter generation make the method inherently robust to input image resolution, a significant advantage over pixel-wise methods.

Key Results

  • State-of-the-Art Performance: S²CRNet achieves state-of-the-art results on both iHarmony4 and DIH99 datasets, measured by metrics like PSNR and MSE.
  • Massive Parameter Reduction: The SqueezeNet-based S²CRNet uses only 0.95M parameters, a ~90% reduction compared to methods like DoveNet (40.8M) and S2AM (58.74M). Even the VGG16-based version uses significantly fewer parameters.
  • Exceptional Efficiency: The method is remarkably fast, processing a 2048x2048 image in approximately 0.1 seconds on a GPU, significantly outperforming other methods. It also shows good performance on CPU.
  • High-Resolution Handling: The framework handles high-resolution images (up to 2048x2048) smoothly, maintaining performance and speed, unlike previous methods that struggle or run out of memory.

Limitations and Future Work

  • Lack of Semantic/Local Information: The global color curves do not inherently capture fine-grained semantic or local scene details, which can limit further improvements.
  • Real-World Scenarios: While performing well, the model can still produce unsatisfactory results on complex real-world composites, especially when the inserted foreground has a very different style or context than typical training data.
  • Potential for Misuse: The paper acknowledges that image harmonization technology could be used to create realistic fake media, though it notes that it doesn't change the identity of subjects and might be detectable by forgery detection methods.

Future work could involve incorporating more explicit semantic understanding and local context into the curve generation process. The authors also suggest that the community might need to redefine harmonization tasks to better address complex real-world scenarios.

Summary updated

Abstract

Image harmonization aims to modify the color of the composited region with respect to the specific background. Previous works model this task as a pixel-wise image-to-image translation using UNet family structures. However, the model size and computational cost limit the ability of their models on edge devices and higher-resolution images. To this end, we propose a novel spatial-separated curve rendering network(S$^2$CRNet) for efficient and high-resolution image harmonization for the first time. In S$^2$CRNet, we firstly extract the spatial-separated embeddings from the thumbnails of the masked foreground and background individually. Then, we design a curve rendering module(CRM), which learns and combines the spatial-specific knowledge using linear layers to generate the parameters of the piece-wise curve mapping in the foreground region. Finally, we directly render the original high-resolution images using the learned color curve. Besides, we also make two extensions of the proposed framework via the Cascaded-CRM and Semantic-CRM for cascaded refinement and semantic guidance, respectively. Experiments show that the proposed method reduces more than 90% parameters compared with previous methods but still achieves the state-of-the-art performance on both synthesized iHarmony4 and real-world DIH test sets. Moreover, our method can work smoothly on higher resolution images(eg., $2048\times2048$) in 0.1 seconds with much lower GPU computational resources than all existing methods. The code will be made available at \url{http://github.com/stefanLeong/S2CRNet}.
BibTeX
@inproceedings{liang2022spatial,
  author = {Jingtang Liang and Xiaodong Cun and Chi-Man Pun},
  title = {{Spatial-Separated Curve Rendering Network for Efficient and High-Resolution Image Harmonization}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  doi = {10.1007/978-3-031-20071-7\_20},
}
Figure