NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Structure-guided Generative Adversarial Network for Image Inpainting

Huan Liang, Zhao Li, Lei CaoInternational Journal of Advanced Network Monitoring and Controls 2024

Abstract

Generative Adversarial Network (GAN) based image inpainting algorithms often struggle with arbitrary masked areas because standard convolutional operations treat all input pixels—including missing ones—as valid data. This paper introduces a structure-guided GAN that utilizes gated convolutions within residual blocks to effectively capture the relationship between known and masked regions. The proposed architecture employs a two-stage restoration process: structural restoration followed by texture restoration. By first reconstructing the edges of the damaged area and then using this structural "skeleton" to guide texture synthesis, the model achieves superior visual fidelity. Experimental results on the Places2 dataset demonstrate a 4.3% improvement in Peak Signal-to-Noise Ratio (PSNR) and a 3.7% enhancement in Structural Similarity (SSIM) compared to existing two-stage methods.

Introduction

Image inpainting is a critical task in computer vision, involving the reconstruction of missing or corrupted parts of an image. While deep learning models have significantly advanced this field, they face two primary challenges. First, the "Blind Convolution Problem" occurs when standard layers treat every pixel equally, leading to artifacts as the network "smears" information from empty masked regions into valid areas. Second, maintaining structural consistency—such as the sharp lines of a building or facial features—is difficult when large or irregular holes are present.

Methodology

The proposed solution is a two-stage generative adversarial network designed to decouple structural reconstruction from texture filling.

Two-Stage Architecture

The restoration process is divided into two sequential phases:

  1. Structural Restoration (G1): The model first detects the structural information of the known regions using an edge detection algorithm (HED). The generator $G_1$ then predicts the missing edges within the masked area, creating an "intact edge" map.
  2. Texture Restoration (G2): This stage takes the predicted edges from the first stage along with the original damaged image to perform color and texture synthesis. The completed edge map serves as a geometric guide, ensuring the final output maintains structural integrity.
Two-stage generative adversarial restoration network architecture.

Gated Convolutions

The core innovation lies in the replacement of traditional convolutions with gated convolutions within the network's residual blocks. Unlike standard convolutions, gated convolutions learn a dynamic feature selection mechanism. For every spatial location, the network computes a "soft gate" (a value between 0 and 1) that determines the importance of the input features. This allows the model to ignore invalid pixels within the mask and focus on relevant information from the surrounding context, adapting seamlessly to any mask shape.

Gated convolution mechanism.

Training Stability and Loss

To improve convergence and accuracy, the authors employ a Spectral Normalization Markovian Discriminator (SN-PatchGAN). Spectral normalization addresses the issue of slow weight changes during iterations, while the PatchGAN structure ensures that generated textures are realistic at a local level. Additionally, a hinge loss function is used during edge recovery to force the network to generate more precise structural information.

Experiments and Results

The model was evaluated using the Places2 dataset (scenes), CelebA (faces), and an Irregular Mask Dataset containing 12,000 free-form masks to simulate real-world damage.

Quantitative analysis shows that the proposed method outperforms state-of-the-art algorithms like Context Encoder (CE), Partial Convolution (Pconv), and EdgeConnect (EC). Specifically, on the Places2 dataset, the model achieved a 4.3% boost in PSNR and a 3.7% boost in SSIM over EdgeConnect. Qualitatively, the structure-guided approach avoids the "melted" or blurry artifacts common in single-stage models, producing sharper edges and more consistent textures even in complex regions.

Conclusion

The structure-guided GAN effectively addresses the limitations of standard convolutions in image inpainting. By prioritizing structural restoration and utilizing gated convolutions, the model achieves significant improvements in both quantitative metrics and visual quality. However, performance tends to degrade when the masked area exceeds 30% of the image. Future work will focus on advanced texture synthesis and exploring more creative content generation for larger missing regions.

Summary updated

BibTeX
@article{liang2024structure,
  author = {Huan Liang and Zhao Li and Lei Cao},
  title = {{Structure-guided Generative Adversarial Network for Image Inpainting}},
  journal = {International Journal of Advanced Network Monitoring and Controls},
  year = {2024},
  doi = {10.2478/ijanmc-2024-0031},
}
Figure