Structure Matters: Tackling the Semantic Discrepancy in Diffusion Models for Image Inpainting

Haipeng Liu, Yang Wang, Biao Qian, Meng Wang, Yong Rui
2/9/2026

No official code found. Best implementation: htyjers/StrDiffusion (127 stars, Apache-2.0, last commit 2025-10-07).

Abstract

Denoising diffusion probabilistic models (DDPMs) for image inpainting aim to add the noise to the texture of the image during the forward process and recover the masked regions with the unmasked ones of the texture via the reverse denoising process. Despite the meaningful semantics gen-eration, the existing arts suffer from the semantic discrep-ancy between the masked and unmasked regions, since the semantically dense unmasked texture fails to be completely degraded while the masked regions turn to the pure noise in diffusion process, leading to the large discrepancy between them. In this paper, we aim to answer how the unmasked se-mantics guide the texture denoising process; together with how to tackle the semantic discrepancy, to facilitate the con-sistent and meaningful semantics generation. To this end, we propose a novel structure-guided diffusion model for image inpainting named StrDiffusion, to reformulate the conventional texture denoising process under the structure guidance to derive a simplified denoising objective for im-age inpainting, while revealing: 1) the semantically sparse structure is beneficial to tackle the semantic discrepancy in the early stage, while the dense texture generates the rea-sonable semantics in the late stage; 2) the semantics from the unmasked regions essentially offer the time-dependent structure guidance for the texture denoising process, ben-efiting from the time-dependent sparsity of the structure semantics. For the denoising process, a structure-guided neural network is trained to estimate the simplified denoising objective by exploiting the consistency of the denoised structure between masked and unmasked regions. Besides, we devise an adaptive resampling strategy as aformal criterion as whether the structure is competent to guide the texture denoising process, while regulate their semantic corre-lations. Extensive experiments validate the merits of StrDif-fusion over the state-of-the-arts. Our code is available at https://github.com/htyjers/StrDiffusion.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

[CVPR 2024] Structure Matters: Tackling the Semantic Discrepancy in Diffusion Models for Image Inpainting

12716C++, CudaMar 9, 20241 years agoApache-2.0

Cite this paper

@article{liu2026structure,
  title  = {Structure Matters: Tackling the Semantic Discrepancy in Diffusion Models for Image Inpainting},
  author = {Haipeng Liu and Yang Wang and Biao Qian and Meng Wang and Yong Rui},
  year   = {2026},
  eprint = {2403.19898},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/pdf/2403.19898},
  journal = {CVPR 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2403.19898.svg)](https://codeofpaper.com/paper/2403.19898)

Discussion