Abstract
Inharmonious Region Localization (IRL) is the task of identifying regions in a composite image that exhibit visual inconsistencies due to mismatched lighting, color, or shadows. Current methods often struggle with subtle global inconsistencies or complex object boundaries. This paper presents RSRNet, a novel architecture that treats IRL as an iterative clustering problem. By leveraging a Recurrent Self-Reasoning (RSR) module, the network progressively refines its estimation of background style to better isolate the inharmonious foreground. Experimental results on the iHarmony4 dataset demonstrate that RSRNet achieves state-of-the-art performance, significantly outperforming existing baselines in both precision and mask quality.
1. Introduction
With the proliferation of sophisticated image editing tools, creating composite images—where an object is cropped from one source and pasted into another—has become trivial. However, these composites often suffer from "inharmonious" appearances because the foreground object’s illumination and color characteristics do not match the new background. While image harmonization techniques can rectify these discrepancies, they typically require a pre-defined mask of the edited area.
Inharmonious Region Localization (IRL) aims to automate the detection of these manipulated regions. Unlike traditional image forgery detection, which often looks for local artifacts like compression inconsistencies or edge manipulation, IRL must identify higher-level stylistic mismatches. This paper introduces RSRNet, which employs a recurrent reasoning mechanism to iteratively distinguish between background and foreground styles.
2. Methodology
2.1 RSRNet Architecture
RSRNet is built upon a standard UNet-like encoder-decoder structure, but it introduces a specialized Recurrent Self-Reasoning (RSR) module at the bottleneck. The network processes two distinct types of information: "style" features, which capture color and illumination distributions, and "conventional" features, which capture the underlying shapes and textures of the scene.
2.2 The Recurrent Self-Reasoning (RSR) Module
The core innovation of RSRNet is the RSR module, which draws inspiration from the K-means clustering algorithm. The module treats localization as a binary clustering problem (Background vs. Inharmonious Region) and proceeds through an iterative loop:
- Background Style Estimation: The module calculates a representative background style feature by averaging the pixels outside the current predicted mask.
- Similarity Mapping: It generates a Multi-scale Similarity Map by comparing every pixel in the image to the estimated background style. This helps identify which regions deviate from the global background norm.
- Iterative Refinement: A Convolutional Gated Recurrent Unit (ConvGRU) takes the similarity map, the current mask, and the conventional features to "reason" about the location of the inharmonious region. This allows the model to progressively "clean up" its predictions as the estimate of the background style becomes more accurate.
2.3 Adaptive Mask Combination
The RSR module produces a coarse but compact mask that excels at identifying the core of the inharmonious object. To ensure sharp, detailed edges, this coarse mask is adaptively combined with a high-resolution mask from the UNet decoder using a learned weight map. This dual-path approach ensures the final output is both globally accurate and locally precise.
3. Experiments and Results
3.1 Dataset and Evaluation
The model was evaluated using the iHarmony4 dataset, the benchmark for image harmonization and localization. The dataset includes four sub-categories: HCOCO, HFlickr, HAdobe5K, and Hday2night, representing a wide variety of synthetic and professionally retouched inconsistencies. The evaluation focused on standard segmentation metrics: Average Precision (AP), F1 Score, and Intersection over Union (IoU).
3.2 Quantitative Performance
RSRNet established a new state-of-the-art across all metrics on the iHarmony4 dataset:
- Average Precision (AP): 82.57% (a 3.2% improvement over the previous leader, DIRL).
- F1 Score: 0.7607 (a 4% improvement).
- IoU: 71.63% (a 5.6% improvement).
These results indicate that the recurrent reasoning mechanism is significantly more effective at capturing subtle inconsistencies than single-pass segmentation models or general-purpose architectures like SegFormer.
3.3 Qualitative Analysis
Visual inspections reveal that RSRNet is particularly robust when dealing with complex scenarios. It successfully localizes objects with fine-grained structures, such as thin branches or hair, and maintains accuracy even when the inharmonious object is partially occluded by background elements. The iterative nature of the RSR module allows it to ignore local noise and focus on the broader illumination trends that signal a composite.
4. Conclusion and Future Work
RSRNet demonstrates that treating inharmonious region localization as an iterative self-reasoning process yields superior results. By progressively refining the distinction between background and foreground styles, the model overcomes the limitations of static, single-shot detection methods.
Despite its success, the model faces challenges with fragmented regions—where an inharmonious area is split into several disconnected parts. In such cases, the model may only detect the most obvious segment. Future research will explore the integration of more global semantic context to better link disconnected but related inharmonious regions.
Summary updated