Resolution-robust Large Mask Inpainting with Fourier Convolutions

Roman Suvorov, Elizaveta Logacheva, Anton Mashikhin, Anastasia Remizova, Arsenii Ashukha, Aleksei Silvestrov, Naejin Kong, Harshith Goka, Kiwoong Park, Victor Lempitsky

Abstract

Modern image inpainting systems, despite significant progress, often struggle with large missing areas, complex geometric structures, and high-resolution images. We find that one of the main reasons for this is the lack of an effective receptive field in both the inpainting network and the loss function. To alleviate this issue, we propose a new method called large mask inpainting (LaMa). LaMa is based on: i) a new inpainting network architecture that uses fast Fourier convolutions (FFCs), which provide an image-wide receptive field; ii) a high receptive field perceptual loss; and iii) large training masks, which unlock the potential of the first two components. Our inpainting network improves the state-of-the-art across a range of datasets and achieves excellent performance even in challenging scenarios, such as the completion of periodic structures. Our model generalizes surprisingly well to resolutions higher than those seen at train time, achieving this at lower parameter and time costs than competitive baselines.

Introduction

Image inpainting—the process of filling in missing pixels—has advanced significantly with deep learning. However, current state-of-the-art systems still face three primary challenges:

  1. Large Missing Areas: Filling massive holes requires a global understanding of the scene to maintain coherence.
  2. Complex Geometric Structures: Standard convolutions often fail to reconstruct repetitive patterns like windows or fences.
  3. High-Resolution Generalization: Models trained on low-resolution patches often produce blurry or repetitive artifacts when applied to high-resolution images.

The authors identify the limited effective receptive field of standard Convolutional Neural Networks (CNNs) as the root cause. In typical CNNs, neurons only gain a global view deep within the network, which is often too late for coherent large-scale reconstruction.

Methods

The LaMa framework addresses these limitations through three core innovations designed to maximize the receptive field from the outset.

Fast Fourier Convolutions (FFCs)

Standard convolutions operate on local neighborhoods. In contrast, FFCs transform features into the frequency domain using a Fast Fourier Transform (FFT). Because convolutions in the frequency domain have a global receptive field, every output pixel is influenced by every input pixel from the very first layers. This allows the network to capture global context immediately.

Architecture of the LaMa inpainting network featuring Fast Fourier Convolutions (FFC) and Spectral Transforms.

High Receptive Field Perceptual Loss (HRF PL)

Traditional perceptual losses often rely on VGG networks. LaMa instead utilizes a ResNet-50 backbone trained on semantic segmentation with dilated convolutions. This ensures the loss function itself is sensitive to global structures and shapes, guiding the network toward semantically coherent completions rather than just local texture matching.

Aggressive Mask Generation

To fully leverage the global receptive field, the model is trained with a strategy involving very large and wide masks, such as polygonal chains and large boxes. This forces the network to rely on distant context rather than simple local interpolation from nearby edges.

Evaluation and Results

LaMa was evaluated on the Places (512×512) and CelebA-HQ (256×256) datasets. Despite being trained on 256×256 crops, the model demonstrates remarkable "resolution robustness," generalizing to resolutions up to 2K without additional training.

Qualitative results of LaMa on large mask inpainting tasks, including removal of people and complex urban structures.

Key Performance Metrics

  • Quantitative Superiority: On the Places dataset with wide masks, LaMa achieved an FID score of 2.21, significantly outperforming baselines like DeepFill v2 (5.20) and AOT GAN (5.94).
  • Structural Fidelity: Qualitative results show LaMa is uniquely capable of reconstructing periodic structures like grids and windows that other models typically distort into visual artifacts.
  • Efficiency: With only 27M parameters, LaMa is more lightweight and faster at inference than competitors like CoModGAN (109M) or MADF (85M).

Discussion

LaMa demonstrates that global context is essential for high-quality inpainting. By operating in the frequency domain, it achieves a degree of scale equivariance, allowing it to learn patterns (like brick spacing) that remain valid across different resolutions. This prevents the "checkerboard" artifacts common in upscaled CNN outputs.

However, limitations remain. The model can struggle with extreme perspective distortion where periodic patterns undergo significant 3D warping. Future work may explore Vision Transformers (ViTs) as an alternative high-receptive-field architecture for high-resolution synthesis.

The code and pre-trained models are available at https://github.com/saic-mdal/lama.

Summary updated

BibTeX
@inproceedings{suvorov2022resolution,
  author = {Roman Suvorov and Elizaveta Logacheva and Anton Mashikhin and Anastasia Remizova and Arsenii Ashukha and Aleksei Silvestrov and Naejin Kong and Harshith Goka and Kiwoong Park and Victor Lempitsky},
  title = {{Resolution-robust Large Mask Inpainting with Fourier Convolutions}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2022},
  url = {https://openreview.net/forum?id=WuMx5BGmw_},
}
Figure