Introduction
Image inpainting—the process of reconstructing missing or masked regions within an image—has seen significant progress with deep learning. However, as image resolutions scale toward 2K and 4K, traditional convolutional neural networks (CNNs) encounter a "high-resolution hurdle." Most existing architectures suffer from extreme computational redundancy, as they synthesize the entire image matrix rather than focusing solely on the masked areas. Furthermore, capturing the global context necessary for coherent filling requires expansive receptive fields, which are prohibitively expensive in terms of memory and compute at high resolutions.
CoordFill addresses these challenges by reframing inpainting as a coordinate querying task. By utilizing an implicit neural representation, CoordFill decouples the resolution of the context-gathering phase from the resolution of the final output, enabling real-time performance on high-resolution imagery.
Methodology: The CoordFill Framework
CoordFill splits the inpainting process into two distinct phases: a global context-aware parameter generation phase and a local pixel-wise synthesis phase.
Phase 1: Parameter Generation Network (PGN)
The PGN is responsible for understanding the global structure and context of the image. Instead of predicting pixel values directly, the PGN predicts the weights and biases for a secondary network. It operates on a downsampled version of the input image, utilizing Attentional Fast Fourier Convolution (AttFFC) blocks. The FFCs allow the model to capture global context in the frequency domain, while the integrated attention mechanism ensures the network prioritizes the boundaries and internal structure of the masked regions.
Phase 2: Pixel-wise Querying Network (PQN)
The PQN is a lightweight Multi-Layer Perceptron (MLP) that treats the image as a continuous function. To fill a hole, the system queries the $(x, y)$ coordinates of the missing pixels. The MLP uses the specific parameters generated by the PGN to transform these coordinates into RGB values.
This architecture provides two major advantages. First, because the PQN is a coordinate-based query, the system can selectively synthesize only the pixels within the mask, pasting the original background back in. Second, the use of continuous coordinate encoding (sinusoidal positional embeddings) allows the model to "re-sample" the image at any resolution, effectively bypassing the need for high-resolution convolutional layers.
Experimental Results
The authors evaluated CoordFill on three major benchmarks: Places2 for general scenes, CelebA-HQ for facial structures, and Unsplash for high-resolution photography.
Efficiency and Speed
CoordFill demonstrates remarkable efficiency. On a 2048×2048 image, CoordFill achieves an inference time of just 24ms on a GTX 2080 Ti. This is approximately 25 times faster than the previous state-of-the-art method, LaMa, which requires 598ms for the same task.
Memory Management
While many contemporary models (such as MAT, ZITS, and DeepFillv2) encounter "Out of Memory" (OOM) errors when processing 4096×4096 images, CoordFill handles 4K resolutions on a single consumer GPU without issue. This memory efficiency stems from the model's ability to avoid high-resolution feature maps in the encoder-decoder pipeline.
Visual Quality
On the Unsplash dataset (1024×1024), CoordFill achieved a PSNR of 33.093, outperforming both LaMa (32.434) and ZITS (32.532). The model maintains superior visual textures and structural alignment, particularly in complex real-world photographs.
Limitations and Future Directions
While CoordFill offers a significant leap in efficiency, it is not without limitations. The model can occasionally produce artifacts when dealing with extremely intricate or stochastic textures. Additionally, because the PGN currently operates on a fixed 256×256 downsampled input, some ultra-fine details present only at the 4K scale may be lost during the initial encoding phase.
Future research may explore adaptive encoding resolutions or multi-scale coordinate querying to further refine the balance between global context and high-frequency local detail.
Summary updated