A Wasserstein GAN for Joint Learning of Inpainting and Spatial Optimisation

Pascal Peter

TL;DR

This paper introduces the first Generative Adversarial Network (GAN) capable of jointly learning both image inpainting and the optimal selection of pixels (mask) to be kept for reconstruction. By leveraging a Wasserstein distance, their approach generates more visually realistic inpainted images and significantly outperforms existing methods in terms of both speed and quality, particularly for sparse data scenarios.

What Problem Does This Paper Address?

Image inpainting, the task of filling in missing or damaged parts of an image, has a classical formulation where the known pixels are fixed. However, a more challenging and practical problem is spatial optimisation for inpainting. This involves finding the minimal set of known pixels that still allows for a high-quality reconstruction. This is crucial for applications like image compression and adaptive sampling, where data efficiency is paramount. Traditional methods for this spatial optimisation are often model-based, slow, and tailored to specific inpainting algorithms. While neural networks have shown promise in inpainting, existing approaches either struggle with joint optimization of the inpainting and mask selection processes or require post-processing steps. This paper aims to bridge this gap by proposing a unified deep learning framework for simultaneous inpainting and mask optimization.

Methods

The core contribution is a novel Generative Adversarial Network (GAN) architecture designed for joint inpainting and spatial optimization. This GAN comprises three key components:

  • Inpainting Generator (g): This network takes a random seed and the known pixels (guided by a mask) to generate the inpainted image. It's designed to produce results that mimic the statistics of natural images.
  • Mask Generator (m): This is a novel component that directly generates a binary inpainting mask (i.e., deciding which pixels to keep). This is a significant departure from previous methods that produced non-binary confidence maps, which caused training difficulties. The paper addresses the non-differentiability of binarization using a specific block and approximating gradients.
  • Discriminator (d): This network distinguishes between real natural images and the inpainted images produced by the generator. The use of a Wasserstein distance is key here, as it provides a more stable training process and better quality results compared to traditional GAN loss functions.

The training objective is a combination of:

  1. Wasserstein Loss: Encourages the generator to produce images that are indistinguishable from real images.
  2. Mean Absolute Error (MAE): Ensures the inpainted result is close to the original image where pixels are known.
  3. Density Loss: A novel addition that penalizes the mask generator if the proportion of known pixels deviates from a target density, crucial for sparse data applications.

Datasets

The paper uses the ImageNet dataset for training and validation, specifically a subset of 100,000 images. For evaluation, they utilize the ImageNet test set provided by Dai et al. [11] for comparison with NetM. They also use the Berkeley shape database BSDS500 for comparison with probabilistic methods, noting its better public availability.

Key Insights and Ideas

  • Joint Learning is Crucial: The paper strongly argues that simultaneously learning the inpainting process and the mask selection is essential for achieving optimal results, especially for sparse data. Training these components separately or relying on pre-trained inpainting models with learned masks leads to suboptimal performance.
  • Binary Masks Directly: Generating binary masks directly, rather than confidence maps, is a key enabler for effective joint training. This bypasses issues with non-differentiability and provides a clear signal to the inpainting network.
  • Wasserstein GAN for Stability and Quality: The choice of Wasserstein GAN is not just for theoretical elegance; it demonstrably leads to more stable training and visually superior inpainted results that better capture natural image statistics.
  • Density Loss for Sparse Data: The introduction of a density loss is a clever way to guide the mask generator towards producing sparse masks, which is the primary focus for applications like compression.

Key Results

  • Outperforms State-of-the-Art: The proposed method significantly outperforms existing methods, including the neural network-based NetM and classical probabilistic methods like PS and NLPE, across various metrics (PSNR, MAE, SSIM).
  • Substantial Speedup: The GAN-based approach offers a dramatic speedup, being orders of magnitude faster than classical methods (e.g., >400x on CPU, >12,000x on GPU). This speed is independent of mask density.
  • Visual Quality: Qualitative results show that the proposed method produces more natural-looking inpainted images, especially for sparse data, avoiding artifacts like singularities often seen in diffusion-based methods.
  • Competitive Performance: Even when compared against methods that optimize for PSNR (while the proposed method doesn't explicitly maximize it), the GAN achieves superior results.

Limitations and Future Work

  • Computational Cost: While significantly faster than classical methods, GANs are still computationally intensive to train.
  • Further Refinements: The authors are actively working on refining the network architecture and exploring individual component impacts through ablation studies.
  • Broader Applications: They hope their work will contribute to practical applications like image compression and adaptive sampling.
  • Evaluation of Components: Future work will involve a more in-depth evaluation of the impact of individual components of their proposed framework.

Summary updated

BibTeX
@inproceedings{peter2022wasserstein,
  author = {Pascal Peter},
  title = {{A Wasserstein GAN for Joint Learning of Inpainting and Spatial Optimisation}},
  booktitle = {PSIVT},
  year = {2022},
  url = {https://openreview.net/forum?id=TKG2fn5jBm},
}
Figure