Abstract
To enhance the quality of image harmonization, we propose a region-aware image harmonization method based on adaptive feature calibration. First, multi-layer encoders are utilized to extract multi-scale features. Then, adaptive feature calibration modules are designed in the middle of the skip connection to reduce the impact of local biased features on the decoder’s generation process. Subsequently, the region-aware Transformer is employed to enhance context information interaction and modulate foreground features with statistical information from background features at different scales. Finally, harmonization results are generated through multi-layer decoders. Experimental results on the publicly available iHarmony4 image harmonization dataset demonstrate that the proposed method achieves superior performance, with PSNR, MSE, and fMSE scores of 39.83 dB, 19.25, and 206.40, respectively, outperforming current state-of-the-art methods.
Introduction
Image harmonization is the art of making a "cut-and-paste" composite image look real. When an object (the foreground) is placed into a new scene (the background), visual mismatches in lighting, color temperature, and style are inevitable. Existing deep learning approaches often struggle with two main issues: the limited receptive field of standard Convolutional Neural Networks (CNNs) and the "feature bias" introduced by skip connections in U-Net architectures. These skip connections often pass original, unharmonized foreground features directly to the decoder, which can interfere with the final harmonization quality.
Methodology
The proposed architecture addresses these challenges by integrating local feature extraction with global context modeling through a hybrid CNN-Transformer design.
Adaptive Feature Calibration (AFC)
The AFC module is strategically placed within the skip connections. It utilizes Partial Convolutions to isolate foreground and background features. By applying Adaptive Instance Normalization (AdaIN), the module "calibrates" the foreground features using the style statistics of the background before they reach the decoder. This prevents the leakage of mismatched colors and ensures that the decoder receives features that are already partially aligned with the target environment.
Region-Aware Transformer
To capture global context, the model employs a Region-Aware Transformer at the bottleneck. Unlike standard Transformers, this component uses Region-aware Adaptive Instance Normalization (RAIN). By incorporating the foreground mask, RAIN allows the Transformer to distinguish between regions and modulate foreground features based on background statistics across multiple scales, facilitating sophisticated global information interaction.
Experimental Setup
The model was evaluated on the iHarmony4 dataset, the industry standard for image harmonization. This dataset includes four sub-datasets—HCOCO, HAdobe5k, HFlickr, and Hday2night—covering a wide range of synthetic and real-world scenarios, including extreme lighting variations. The standard split of 65,742 training and 7,404 testing images was used to ensure a fair comparison with existing benchmarks.
Results and Discussion
The proposed method demonstrates state-of-the-art performance on the iHarmony4 benchmark, particularly in cases where the foreground object occupies a significant portion of the image (>15%), where previous methods often produced inconsistent results.
| Method | MSE ↓ | PSNR ↑ | fMSE ↓ |
|---|---|---|---|
| DoveNet (2020) | 52.33 | 34.76 | 549.96 |
| RainNet (2021) | 40.29 | 36.12 | 469.60 |
| HDNet (2023) | 23.42 | 38.58 | 258.80 |
| Ours (This Paper) | 19.25 | 39.83 | 206.40 |
Qualitative analysis reveals that the model excels at maintaining texture while achieving superior color consistency, even under challenging lighting conditions.
Conclusion
By combining the local modeling capabilities of CNNs with the global context of Transformers through adaptive calibration, this method sets a new standard for image harmonization. Future research will focus on optimizing the computational efficiency of the AFC and Transformer modules to support real-time applications and ultra-high-resolution image processing.
Summary updated