3D-Consistent Image Inpainting with Diffusion Models

Leonid Antsfeld, Boris ChidlovskiiarXiv 2024 · DOI

Abstract

Traditional image inpainting methods often struggle to maintain geometric consistency when filling large masked regions, frequently hallucinating textures that clash with the scene's underlying 3D structure. We present InConDiff, a novel generative approach that introduces 3D awareness to image inpainting without requiring explicit 3D supervision. By conditioning a Diffusion Transformer (DiT) on an "in-context" second view of the same scene, the model learns to reconstruct masked areas with 3D-consistent geometry and textures. Our results demonstrate that InConDiff significantly outperforms standard 2D diffusion models in complex urban and indoor environments.

Introduction

Image inpainting—the task of filling missing or masked parts of an image—has advanced rapidly with the advent of Denoising Diffusion Probabilistic Models (DDPMs). However, these models are primarily "2D-native," excelling at local texture synthesis but often failing to grasp global 3D perspective. For instance, when masking a vehicle on a street, a standard model might generate a plausible background that is geometrically inconsistent with the rest of the scene's vanishing points. Existing solutions typically rely on expensive 3D labels or explicit geometric priors. InConDiff seeks to bake 3D "common sense" into the inpainting process using only pairs of unlabelled images.

Methodology

InConDiff shifts the inpainting paradigm from single-image processing to in-context guidance. The architecture and training pipeline are built on three pillars:

  1. Diffusion Transformers (DiTs): Unlike the standard U-Net architecture, DiTs allow for more flexible integration of contextual information through cross-attention mechanisms.
  2. Cross-View Completion: During training, the model receives a pair of images from the same scene but different viewpoints. One image is noised (the target), while the other is kept clean (the context). A ViT-based encoder-decoder allows noised tokens from the target to "attend" to clean tokens from the context, creating an inductive bias that forces the model to learn 3D relationships.
  3. Harmonization and Efficiency: To ensure seamless blending between original and generated pixels, the model employs a resampling schedule that iterates between diffusion and denoising. To mitigate the computational cost, a Laplace noise schedule is used, focusing computation on intermediate noise levels where critical structural decisions are made, effectively halving the overhead of harmonization.

Experimental Setup

The model was evaluated on a diverse set of synthetic and real-world datasets:

  • HM3D (Habitat-Matterport): 1,000 high-resolution 3D indoor scans.
  • MegaDepth: 300,000 internet photos of global landmarks with varying viewpoints.
  • StreetView & WalkingTour: Over 100,000 street-level images and egocentric videos from urban environments in Europe and Asia.

Key Results

InConDiff was benchmarked against state-of-the-art models including RePaint, Stable Diffusion (v1.5), and Stable Diffusion XL (SD-XL).

Quantitative Performance

InConDiff consistently achieved superior scores across all datasets. On the HM3D dataset, InConDiff reached a PSNR of 26.43, significantly higher than SD-XL's 24.33. It also showed marked improvements in Structural Similarity (SSIM) and Perceptual Similarity (LPIPS), demonstrating its ability to maintain both structural fidelity and visual realism.

Qualitative Analysis

Visual comparisons reveal that while SD-XL often hallucinations irrelevant objects or distorted perspectives in large masked areas, InConDiff correctly reconstructs background geometry—such as continuing a building's facade or a room's corner—by leveraging the secondary viewpoint. The model proved particularly robust at high masking ratios, maintaining consistency even when up to 70% of the image was missing.

Conclusion and Future Work

InConDiff demonstrates that 3D consistency can be an emergent property of multi-view conditioning. By using a second view as a structural anchor, the model effectively "sees" behind obstacles. Future work will explore extending this framework to multiple context images or video sequences to further improve consistency in highly crowded scenes and enable consistent object removal across entire video clips.

Summary updated

BibTeX
@misc{antsfeld2024d,
  author = {Leonid Antsfeld and Boris Chidlovskii},
  title = {{3D-Consistent Image Inpainting with Diffusion Models}},
  year = {2024},
  eprint = {2412.05881},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.05881},
}
Figure