Structure-aware Image Inpainting with Two Parallel Streams

Zhilin Huang, Chujun Qin, Ruixin Liu, Zhenyu Weng, Yuesheng ZhuarXiv 2021

Abstract

Image inpainting often struggles to maintain structural integrity when filling large or complex missing regions. This paper proposes a novel end-to-end architecture featuring two parallel UNet-based streams: a Main Stream for general image reconstruction and a dedicated Structure Stream for recovering structural information. By utilizing a novel Gated Unit to filter out distracting textures and an Adaptive Fusion Block to merge structural cues back into the main reconstruction, the model achieves state-of-the-art results with sharper boundaries and fewer artifacts across diverse datasets.

Introduction

Image inpainting—the task of filling missing parts of a damaged image—is a fundamental challenge in computer vision. While deep learning has significantly advanced the field, standard models often face a trade-off between structure (edges and shapes) and texture (fine details). Traditional single-stream models frequently produce blurry results or checkerboard artifacts because they attempt to learn both domains simultaneously without explicit guidance. Previous two-stage approaches, which reconstruct a coarse structure before refining textures, often suffer from complex training schedules and lose valuable feature-level information between stages.

Proposed Architecture

The researchers introduce a single-stage, parallel architecture designed to allow continuous, feature-level interaction between structure and texture domains. The framework consists of two primary components:

  1. Main Stream (MS): A standard UNet-based encoder-decoder that reconstructs the full detailed image.
  2. Structure Stream (SS): A parallel UNet that focuses exclusively on structural representations, receiving hierarchical guidance from the MS encoder.

To facilitate effective communication between these streams, two key modules were developed:

  • Gated Unit (GU): Positioned between the MS and SS, this unit acts as a filter. It uses a $3 \times 3$ convolution and a sigmoid function to create a "gate map" that suppresses texture-heavy activations from the Main Stream, ensuring the Structure Stream only receives cues relevant to shapes and edges.
  • Adaptive Fusion Block (AFBlk): Located in the MS decoder, this block integrates multi-scale structural feature maps from the SS. It employs channel and spatial attention mechanisms to intelligently decide what structural information is important and where it should be applied.
The proposed parallel architecture featuring the Main Stream and Structure Stream, connected by Gated Units and Adaptive Fusion Blocks.

The model is optimized using a combination of Pyramid Image Reconstruction Loss, Perceptual Loss, Style Loss, and Adversarial Loss via an SN-PatchGAN discriminator.

Experiments and Results

The model was evaluated on three standard benchmarks: CelebA (faces), Paris StreetView (buildings), and Places2 (diverse scenes). Testing utilized irregular masks with hole-to-image area ratios ranging from 10% to 50%.

Quantitative Performance

The proposed method consistently outperformed state-of-the-art (SOTA) models, including LBAM, EC, SF, and RT. On the CelebA dataset with 40-50% missing area, the model achieved a Fréchet Inception Distance (FID) of 15.46, a significant improvement over the 16.78 achieved by the previous best model (SF). It also showed superior performance in $L_1$ error, PSNR, and SSIM metrics.

Qualitative Comparison

Visual results demonstrate that the parallel stream approach produces much sharper edges and more coherent structures, especially in large holes where competing models tend to produce distorted or "mushy" results.

Qualitative comparison of the proposed method against SOTA inpainting models across multiple datasets.

Conclusion

This work highlights the advantages of parallelism over sequentiality in image inpainting. By decoupling structure and texture into separate but interacting streams, the model prevents "texture washout" and ensures that both global semantic shapes and local structural details are preserved. While the dual-stream approach introduces some computational overhead and depends on the quality of structural ground truth labels, it sets a new standard for structural coherence in deep image inpainting.

Summary updated

BibTeX
@misc{huang2021structure,
  author = {Zhilin Huang and Chujun Qin and Ruixin Liu and Zhenyu Weng and Yuesheng Zhu},
  title = {{Structure-aware Image Inpainting with Two Parallel Streams}},
  year = {2021},
  eprint = {2111.03414},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2111.03414},
}
Figure