Texture Memory-Augmented Deep Patch-Based Image Inpainting

Rui Xu, Minghao Guo, Jiaqi Wang, Xiaoxiao Li, Bolei Zhou, Chen Change Loy · DOI

Abstract

Patch-based methods and deep networks have been employed to tackle image inpainting problem, with their own strengths and weaknesses. Patch-based methods are capable of restoring a missing region with high-quality texture through searching nearest neighbor patches from the unmasked regions. However, these methods bring problematic contents when recovering large missing regions. Deep networks, on the other hand, show promising results in completing large regions. Nonetheless, the results often lack faithful and sharp details that resemble the surrounding area. By bringing together the best of both paradigms, we propose a new deep inpainting framework where texture generation is guided by a texture memory of patch samples extracted from unmasked regions. The framework has a novel design that allows texture memory retrieval to be trained end-to-end with the deep inpainting network. In addition, we introduce a patch distribution loss to encourage high-quality patch synthesis. The proposed method shows superior performance both qualitatively and quantitatively on three challenging image benchmarks, i.e., Places, CelebA-HQ, and Paris Street-View datasets.

Introduction

Image inpainting—the process of restoring missing or corrupted parts of an image—is a fundamental challenge in computer vision. Historically, the field has been divided between classic patch-based methods and modern deep learning approaches. Patch-based techniques, such as PatchMatch, excel at synthesizing sharp, realistic textures by borrowing from unmasked regions but often fail to maintain global structural coherence in large missing areas. Conversely, deep learning models (CNNs and GANs) are effective at hallucinating global structures but frequently produce blurry results that lack the textural fidelity of the original image.

This paper presents T-MAD (Texture Memory-Augmented Deep Patch-Based Image Inpainting), a novel framework that integrates the structural intelligence of deep networks with the textural precision of patch-based methods. By utilizing a differentiable "texture memory," the system can be trained end-to-end to recover both coherent global structures and sharp, realistic local textures.

Methodology

The T-MAD framework consists of three integrated modules designed to bridge the gap between global structure and local texture:

Coarse Network

The process begins with a Coarse Network that generates a low-frequency estimate of the missing region. This stage focuses on establishing the global semantic structure, providing a blueprint for subsequent refinement.

Texture Memory and Retrieval Module

The core innovation is the Texture Memory and Retrieval Module. The system extracts a "memory pool" of real texture patches from the unmasked regions of the input image. A differentiable retrieval module then identifies the most similar "real" textures for the patches generated by the coarse network. To overcome the non-differentiable nature of discrete selection, the authors utilize a Gumbel-Softmax-inspired sampling strategy, allowing the retrieval process to be optimized during training.

Patch Synthesis Module (PSNet)

The Patch Synthesis Module (PSNet) takes the coarse structural estimate and the retrieved high-quality texture patches as inputs. It fuses these components to generate final results that are both structurally accurate and texturally sharp. To further enhance quality, the authors introduce a Patch Distribution Loss, which encourages the distribution of synthesized patches to match the distribution of real patches in the texture memory.

Key Results and Discussion

The proposed method was evaluated on three high-difficulty benchmarks: Places, CelebA-HQ, and Paris Street View.

Quantitative Evaluation

T-MAD consistently outperformed state-of-the-art methods like DeepFill and EdgeConnect. On the Places dataset, T-MAD achieved a PSNR of 17.203 and an FID of 8.131, demonstrating superior performance in both pixel-wise accuracy and perceptual quality.

Qualitative Comparison

Visual results highlight T-MAD's ability to maintain sharp details and straight lines in complex architectural and natural scenes. Unlike previous deep learning methods that often produce blurry "hallucinated" textures, T-MAD's output remains faithful to the surrounding unmasked areas.

Qualitative comparison of inpainting results: (a) Input Image, (b) Ground-Truth, (c) PatchMatch, (d) DeepFill, and (e) the proposed T-MAD method.

Efficiency and Memory Usage

Despite the inclusion of a memory module, T-MAD is highly efficient. It achieves an inference speed of 47 FPS on a V100 GPU. Furthermore, because the PSNet operates on individual patches, the model achieves a 20% reduction in memory usage compared to models that process the entire image at once.

Conclusion

T-MAD represents a significant advancement in image inpainting by effectively bridging the gap between patch-based and deep learning paradigms. By incorporating a differentiable texture memory and a patch distribution loss, the framework produces results that are both structurally sound and texturally rich. While the method's performance is tied to the accuracy of the initial coarse estimate, its efficiency and high-fidelity output make it a promising approach for various image restoration tasks.

Summary updated

BibTeX
@article{xu2020texture,
  author = {Rui Xu and Minghao Guo and Jiaqi Wang and Xiaoxiao Li and Bolei Zhou and Chen Change Loy},
  title = {{Texture Memory-Augmented Deep Patch-Based Image Inpainting}},
  journal = {IEEE Trans. Image Process.},
  year = {2020},
  doi = {10.1109/tip.2021.3122930},
}
Figure