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

Introduction

Image inpainting—the process of filling in missing or corrupted pixels in an image—has evolved significantly with the advent of Deep Learning. Despite these advances, two persistent challenges remain: handling large masks and maintaining performance across high resolutions. Traditional Convolutional Neural Networks (CNNs) often struggle with these "boss battles" due to their limited receptive fields. In a standard architecture, neurons in the center of a large missing region may only "see" other masked pixels, depriving them of the context needed for accurate reconstruction.

The LaMa Architecture

To address these limitations, the authors propose LaMa (Large Mask Inpainting). The core philosophy of LaMa is to provide the network with an image-wide receptive field from its very first layers. This is achieved through a combination of architectural innovations and a specialized training regimen.

The LaMa architecture overview, featuring the inpainting network with Fast Fourier Convolution (FFC) residual blocks.

The system consists of three primary components:

  1. Fast Fourier Convolutions (FFCs): These blocks allow for global context processing by operating in the frequency domain.
  2. High Receptive Field Perceptual Loss (HRF PL): A loss function designed to ensure global structural consistency by utilizing a backbone with a large receptive field.
  3. Aggressive Mask Generation: A training strategy that uses large, diverse masks to force the model to rely on its global context-gathering capabilities.

Fast Fourier Convolutions: A Global Perspective

The defining feature of LaMa is the use of Fast Fourier Convolutions. Unlike standard convolutions that are restricted to a small local neighborhood (e.g., $3 \times 3$), FFCs utilize the Fast Fourier Transform (FFT) to shift the signal into the frequency domain. In this domain, every update has a global impact, effectively giving the network a receptive field that covers the entire image immediately.

This global awareness is particularly effective for reconstructing periodic structures. Patterns like brickwork, window grids, or fences have clear signatures in the frequency domain, allowing LaMa to complete them with a level of fidelity that traditional CNNs, which often produce garbled or blurry textures in these areas, cannot match.

Results and Resolution Robustness

LaMa was evaluated on major benchmarks including the Places and CelebA-HQ datasets. Quantitatively, it consistently outperformed significantly larger models (such as CoModGAN and MADF) in metrics like Fréchet Inception Distance (FID) and Learned Perceptual Image Patch Similarity (LPIPS), particularly when faced with wide masks. A scaled-up version, "Big LaMa" (51M parameters), demonstrated even more robust performance on real-world, high-resolution photography.

Qualitative results of LaMa on large masks, demonstrating successful reconstruction of complex periodic structures like garage slats and architectural windows.

One of the most remarkable properties of LaMa is its zero-shot resolution scaling. Even when trained on low-resolution images (e.g., $256 \times 256$), the model generalizes exceptionally well to high-resolution photos (up to $1920 \times 1536$). This robustness stems from the scale equivariance of the $1 \times 1$ convolutions used within the FFC blocks in the frequency domain. The model learns structural completion logic that is not strictly tied to specific pixel dimensions.

Conclusion

LaMa represents a significant step forward in image synthesis. By integrating Fourier transforms directly into the convolutional pipeline, it overcomes the receptive field bottlenecks that have long hindered large-mask inpainting. While it can still struggle with extreme perspective distortions where patterns change scale rapidly, its efficiency (at only 27M parameters) and resolution robustness make it a powerful tool for real-world image editing and restoration.

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