Image Inpainting Guided by Coherence Priors of Semantics and Textures

Liang Liao, Jing Xiao, Zheng Wang, Chia-Wen Lin, Shin'ichi Satoh

Abstract

Traditional image inpainting methods often struggle with "texture mix-up," where the model incorrectly borrows patterns from adjacent but semantically different regions. This paper introduces a novel framework that leverages "coherence priors"—the intrinsic relationship between an object's semantic category and its specific texture. By jointly optimizing semantic segmentation and image completion through a Semantic-Wise Attention Propagation (SWAP) module, the proposed method achieves sharper boundaries and more realistic details in complex scenes.

Introduction

Image inpainting, the task of filling missing or corrupted regions in an image, has advanced significantly with deep learning. However, a persistent challenge remains: ambiguity. When a missing region (a "hole") spans multiple object categories—such as a car partially occluding a building and a tree—existing models often produce blurry or "mushy" results.

Many current methods rely on mid-level structural cues like edges to guide the reconstruction. While edges provide a layout, they lack the high-level information needed to distinguish between textures like brick, foliage, or fur. This leads to texture mix-up, where the model fails to maintain semantic consistency. This research addresses this by utilizing semantic labels as strong priors to guide texture synthesis.

Methodology

The core of the proposed framework is a multi-scale joint optimization approach that simultaneously performs semantic segmentation and image inpainting. This synergy allows the model to use predicted scene layouts to inform the texture-filling process.

Semantic-Wise Attention Propagation (SWAP)

Standard attention mechanisms in inpainting look across the entire known portion of an image to find candidate patches for the missing area. The SWAP module refines this by using the predicted semantic map to constrain the search. For example, if a missing region is predicted to be "sky," SWAP ensures the model only borrows information from known "sky" regions, effectively filtering out noise from irrelevant categories like grass or buildings.

The overall framework (a) and the Semantic-wise Attention Propagation (SWAP) module (b), which constrains texture search to relevant semantic regions.

Coherence Losses

To enforce consistency between the generated textures and the predicted layout, the authors introduce two specialized loss functions:

  1. Structure Coherence Loss: Employs conditional discriminators to ensure the global layout of the completed image aligns with the predicted segmentation map.
  2. Non-local Patch Coherence Loss: Evaluates texture distributions at a local level, encouraging generated patches to be statistically similar to real-world examples of the same semantic class.

Experiments and Results

The model was evaluated on three major benchmarks: Outdoor Scenes, Cityscapes, and Places2. It consistently outperformed state-of-the-art baselines, including GatedConv, EdgeConnect, and SGE-Net.

Quantitative Performance

On the Outdoor Scenes dataset, the model achieved a PSNR of 21.18 and an SSIM of 0.81, surpassing all competitors. It also recorded significantly lower Fréchet Inception Distance (FID) scores, which correlates with higher perceived visual quality.

Qualitative Comparison

Visual results demonstrate that the proposed method produces much sharper boundaries between objects and fewer artifacts in high-frequency texture areas. In a blind user study with 20 subjects, the authors' method was ranked as the "best" in 51.8% of cases, nearly triple the score of the next closest competitor.

Qualitative comparison of the proposed method against state-of-the-art baselines across various scene types.

Conclusion

By integrating high-level semantic understanding with low-level texture synthesis, this framework effectively mitigates the problem of texture mix-up in image inpainting. The mutual benefit of joint segmentation and completion leads to more coherent and realistic results. Future work may extend these "coherence priors" to video inpainting, where maintaining temporal consistency across frames presents an additional layer of complexity.

Summary updated

BibTeX
@inproceedings{liao2021image,
  author = {Liang Liao and Jing Xiao and Zheng Wang and Chia-Wen Lin and Shin'ichi Satoh},
  title = {{Image Inpainting Guided by Coherence Priors of Semantics and Textures}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  doi = {10.1109/cvpr46437.2021.00647},
}
Figure