Skip to main content
QUICK REVIEW

[Paper Review] Incremental Transformer Structure Enhanced Image Inpainting with Masking Positional Encoding

Qiaole Dong, Chenjie Cao|arXiv (Cornell University)|Mar 2, 2022
Generative Adversarial Networks and Image SynthesisComputer Science14 citations
TL;DR

This paper proposes an incremental Transformer-based image inpainting framework, ZITS, that enhances structural recovery by learning a normalized grayscale sketch space via a transformer structure restorer and integrating it with pretrained models using Zero-initialized Residual Addition. A novel Masking Positional Encoding (MPE) improves performance on large irregular masks, achieving state-of-the-art results on 1024×1024 images with superior structure preservation and reduced blur compared to SOTA methods like LaMa.

ABSTRACT

Image inpainting has made significant advances in recent years. However, it is still challenging to recover corrupted images with both vivid textures and reasonable structures. Some specific methods only tackle regular textures while losing holistic structures due to the limited receptive fields of convolutional neural networks (CNNs). On the other hand, attention-based models can learn better long-range dependency for the structure recovery, but they are limited by the heavy computation for inference with large image sizes. To address these issues, we propose to leverage an additional structure restorer to facilitate the image inpainting incrementally. The proposed model restores holistic image structures with a powerful attention-based transformer model in a fixed low-resolution sketch space. Such a grayscale space is easy to be upsampled to larger scales to convey correct structural information. Our structure restorer can be integrated with other pretrained inpainting models efficiently with the zero-initialized residual addition. Furthermore, a masking positional encoding strategy is utilized to improve the performance with large irregular masks. Extensive experiments on various datasets validate the efficacy of our model compared with other competitors. Our codes are released in https://github.com/DQiaole/ZITS_inpainting.

Motivation & Objective

  • To address the challenge of recovering realistic textures and holistic structures in high-resolution images with large irregular masks.
  • To overcome the limitations of CNNs in capturing long-range dependencies and the high computational cost of full-scale transformers in image inpainting.
  • To improve performance on weak-texture and complex structural scenes by incorporating explicit positional information in masked regions.
  • To enable efficient integration of structural priors into pretrained inpainting models without full retraining.

Proposed method

  • A Transformer Structure Restorer (TSR) with alternating axial and standard attention blocks learns holistic structures in a low-resolution grayscale sketch space derived from edges and lines.
  • The sketch space is upsampled via a 4-layer CNN to preserve structural details at higher resolutions.
  • A Structure Feature Encoder (SFE) with gated convolutions fuses structural features into a Fast Fourier Convolution (FFC)-based inpainting model using Zero-initialized Residual Addition (ZeroRA).
  • A novel Masking Positional Encoding (MPE) encodes both distance and direction from unmasked to masked regions, improving reconstruction fidelity in large irregular masks.
  • The framework enables incremental training, allowing fast convergence and efficient adaptation of pretrained models.
  • The method is trained end-to-end and can be applied to high-resolution images (up to 2048×2048) without retraining.
Figure 1 : High quality 1024 $\times$ 1024 inpainted results. From left to right, masked inputs, results of LaMa [ 45 ] , results of our method.
Figure 1 : High quality 1024 $\times$ 1024 inpainted results. From left to right, masked inputs, results of LaMa [ 45 ] , results of our method.

Experimental results

Research questions

  • RQ1Can a lightweight, incremental Transformer-based structure restorer improve holistic structure recovery in image inpainting without retraining the main model?
  • RQ2How does Masking Positional Encoding (MPE) enhance performance on large, irregular masks compared to standard positional encoding?
  • RQ3Can a normalized grayscale sketch space derived from edges and wireframes effectively guide high-resolution structure reconstruction?
  • RQ4Does the ZeroRA-based integration strategy enable faster convergence and better performance than full fine-tuning?

Key findings

  • On the 1k Places(512) dataset with 40% center rectangular masks, the proposed method achieved a PSNR of 19.65, FID of 55.85, and LPIPS of 0.239, outperforming Co-Mod and LaMa in FID and LPIPS while matching PSNR.
  • On 1024×1024 MatterPort3D images, the method produced more consistent and structurally accurate results than LaMa, especially in scenes with weak textures and complex geometry.
  • In user studies on Indoor and Places2 datasets, the method was ranked as the best by volunteers in 72.3% and 74.1% of comparisons, respectively, significantly outperforming LaMa.
  • On 512×512 texture images with strong periodic patterns, the method achieved competitive PSNR (25.67) and FID (11.67), slightly better than LaMa in FID and LPIPS.
  • For 2048×2048 images, the method maintained consistent structure and reduced blur compared to LaMa, demonstrating scalability to ultra-high resolutions.
  • The method failed on distant views in complex urban scenes due to limited resolution of the sketch space (256×256), indicating a limitation in capturing distant structural details.
Figure 2 : The overview of our ZITS. At first, the TSR model is used to restore structures with low resolutions. Then the simple CNN based upsampler is leveraged to upsample edge and line maps. Moreover, the upsampled sketch space is encoded by the SFE model, and added to the FTR through ZeroRA to r
Figure 2 : The overview of our ZITS. At first, the TSR model is used to restore structures with low resolutions. Then the simple CNN based upsampler is leveraged to upsample edge and line maps. Moreover, the upsampled sketch space is encoded by the SFE model, and added to the FTR through ZeroRA to r

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.