Diffusion-Based Image Inpainting with Internal Learning

Nicolas Cherel, Andrés Almansa, Yann Gousseau, Alasdair Newson

TL;DR

This paper introduces a lightweight diffusion-based approach for image inpainting that learns "internally" from a single image rather than massive external datasets. By training a tiny model (just 160k parameters) on the available parts of a test image, the authors achieve results that rival state-of-the-art models while drastically reducing computational costs and better preserving the physical correlations in complex data like material maps.

What Problem Does This Paper Address?

Image inpainting—the art of filling in missing or damaged parts of an image—has traditionally followed two paths. "Internal" methods use patches from the same image to fill holes, which works great for textures but fails on complex structures. "External" methods (like modern deep learning and diffusion models) learn from millions of images.

While external models are powerful, they have three major drawbacks:

  1. Computational Cost: They are massive (often hundreds of millions of parameters) and require significant GPU power.
  2. Hallucination: Because they are trained on general data, they might "hallucinate" features (like a random red square in a stone texture) that don't belong in the specific context of the test image.
  3. Data Scarcity: For specialized modalities like line drawings or SVBRDF (material maps used in 3D rendering), large-scale datasets simply don't exist, making it hard to train a "general" model.

Methods

The authors propose a "lightweight diffusion" framework designed for internal learning. Instead of a general-purpose model, they train a specialized model for each specific image.

  • The Architecture: They use a small UNet-style network without the memory-heavy attention layers found in standard models. This reduces the parameter count to just 160k, compared to the 450M parameters used by state-of-the-art models like RePaint.
  • Training Strategy: The model is trained on sub-regions of the test image that are not masked. It learns to reconstruct these regions after they've been corrupted by noise and synthetic "brushstroke" masks.
  • Direct Prediction: Unlike standard diffusion models that predict the noise added to an image, this model directly predicts the clean image ($x_0$). The authors found this simplification yields equivalent results for their specific use case.
  • Multi-Map Handling: For material data (SVBRDF), the model processes multiple maps (diffuse, normal, roughness, specular) simultaneously by concatenating them. This forces the network to learn the physical correlations between, for example, a bump in the "normal" map and a highlight in the "specular" map.

Datasets

The researchers evaluated their method on three distinct types of data:

  • Textures: 100 images from a standard texture synthesis dataset.
  • Line Drawings: A dataset of clean, high-contrast line art.
  • SVBRDF (Material Maps): 50 examples of spatially varying material properties (diffuse, normal, roughness, and specular maps).

Key Insights and Ideas

  • Overfitting as a Feature: In this context, "overfitting" to a single image is a strength. It ensures the inpainted content perfectly matches the local style, grain, and color palette without interference from "external" biases.
  • Adaptive Receptive Fields: Unlike traditional patch-based methods where you have to manually choose a patch size, the UNet’s multi-scale architecture automatically finds the right "receptive field" to understand both fine details and larger structures.
  • Preserving Physical Correlation: This is the "aha moment" for material science. External models often inpaint different material maps (like color vs. roughness) independently, leading to a "flat" or unrealistic look. By training internally on all maps at once, this method ensures the maps remain physically coherent.

Key Results

  • Speed and Efficiency: Training takes approximately 15 minutes on a single NVIDIA V100 GPU. Once trained, inference for a line drawing takes only 3 seconds, compared to 10 minutes for the RePaint model.
  • Texture Quality: On texture datasets, the model achieved an SSIM (Structural Similarity Index) of 0.908, outperforming the much larger RePaint (0.899) and DeepFill (0.870) models.
  • Material Accuracy: In SVBRDF inpainting, the model achieved significantly lower Mean-Squared Error (MSE) across all map types. Qualitatively, it avoided the "flat" look of RePaint by maintaining the alignment between surface normals and lighting reflections.

Limitations and Future Work

  • Lack of Semantic Knowledge: Because the model only sees the test image, it cannot reconstruct unique semantic features that aren't present elsewhere. For example, if you mask an eye on a face and there isn't another eye visible, the model won't know what to put there.
  • Per-Image Training: While 15 minutes is fast for a research paper, it is still a hurdle for real-time interactive applications.
  • Future Directions: The authors suggest exploring quantization and pruning techniques to make the model even lighter and faster, potentially moving toward real-time interactive use.

Summary updated

BibTeX
@inproceedings{cherel2024diffusion,
  author = {Nicolas Cherel and Andrés Almansa and Yann Gousseau and Alasdair Newson},
  title = {{Diffusion-Based Image Inpainting with Internal Learning}},
  booktitle = {EUSIPCO},
  year = {2024},
}

Loading related content...

Figure