Large Mask Image Completion with Conditional GAN

Changcheng Shao, Xiaolin Li, Fang Li, Yifan ZhouSymmetry 2022

TL;DR

This paper introduces CF-CGAN, a novel conditional GAN architecture designed for large mask image completion. By employing a coarse-to-fine generator with structural symmetry and a new VGG-16 based perceptual loss, CF-CGAN achieves state-of-the-art results in generating realistic and semantically coherent completions, even for significantly occluded images.

What Problem Does This Paper Address?

Image completion, the task of filling in missing regions of an image, has seen significant advancements with deep learning and Generative Adversarial Networks (GANs). However, existing methods often struggle with large missing areas, leading to ambiguous results, residual artifacts, and a loss of texture and structural information. This is particularly problematic when the missing region is so large that it provides little contextual information for the model to infer the missing content. The paper aims to address this challenge by developing a method that can effectively complete images with large, irregular masks, producing visually appealing and semantically accurate results.

Methods

The core of the proposed solution is the Coarse-to-Fine Conditional GAN (CF-CGAN). The generator is designed with a two-stage, coarse-to-fine approach:

  • Global Generator (G₁): This component operates at a lower resolution (128x128) and is based on an architecture proven effective for images with periodic structures. It leverages residual blocks and fast Fourier convolutions to capture the overall structure and low-frequency semantic information of the image. This stage is crucial for understanding the broader context of the missing region.
  • Local Enhancer Generator (G₂): This component works at a higher resolution (256x256) and focuses on refining details. It takes feature maps from both the global generator and its own front-end, allowing it to integrate global context with local information. This is achieved through a convolutional front-end, residual blocks, and a transposed convolutional back-end.

A key innovation is the new perceptual loss based on VGG-16. This loss function, termed Rich Detailed Information Perceptual Loss (RDPL), utilizes features extracted from a pre-trained VGG-16 network. By replacing max pooling with average pooling and removing fully connected layers, the network is optimized to extract rich detailed information while ensuring a sufficient receptive field. This helps in generating more realistic textures and finer details compared to traditional pixel-wise losses.

The discriminator used is a PatchGAN discriminator, which evaluates local image patches rather than the entire image. This allows the model to focus on and enhance local texture details, which is critical for realistic image completion. The overall loss function combines GAN loss, the proposed perceptual loss, and an R₁ gradient penalty for improved stability.

Datasets

The primary dataset used for training and evaluation is CelebA-HQ. This dataset, derived from CelebA, contains 30,000 high-resolution (1024x1024) celebrity face images. For the experiments, the images were downscaled to 256x256 resolution to manage computational costs. The dataset's diversity in poses and backgrounds makes it suitable for evaluating the model's generalization capabilities.

Key Insights and Ideas

  • Coarse-to-Fine for Large Masks: The paper demonstrates that a hierarchical, coarse-to-fine approach is highly effective for large mask image completion. By first establishing the global structure and then refining local details, the model can better infer missing content even with limited contextual information.
  • Symmetry in Generator: The generator's symmetric structure is highlighted as a contributing factor to its ability to capture and generate plausible image structures.
  • VGG-16 Perceptual Loss for Detail: The novel perceptual loss based on VGG-16 proves crucial for extracting rich, detailed information, leading to more realistic textures and a higher quality of completion compared to methods relying solely on adversarial or pixel-wise losses.
  • PatchGAN for Local Realism: The use of a PatchGAN discriminator allows the model to focus on local image regions, ensuring that the generated textures and details are consistent and realistic.

Key Results

The CF-CGAN model achieved state-of-the-art performance on the CelebA-HQ dataset, outperforming strong baselines like CoModGAN and LaMa-Fourier.

  • Quantitative Evaluation:
    • On the CelebA-HQ dataset (256x256), CF-CGAN achieved an FID of 19.1, LPIPS of 0.177, and SSIM of 0.826.
  • For challenging "40%-50% Masked" scenarios, CF-CGAN achieved an FID of 4.8, LPIPS of 0.105, and SSIM of 0.897, significantly outperforming baselines.
  • Face similarity analysis using FaceNet showed that reconstructed faces had distances consistently below the 1.1 threshold for various mask sizes, indicating high fidelity.
  • Qualitative Results: The paper presents compelling visual examples showcasing the model's ability to generate realistic and semantically coherent completions for large, irregular masks, preserving facial structures and textures effectively.

Limitations and Future Work

The authors acknowledge several limitations:

  • Resolution Constraint: The current model is primarily optimized for images with a resolution of 256x256. Processing higher-resolution images can lead to unsatisfactory results.
  • Generalization to Out-of-Distribution Data: While the model performs well on CelebA-HQ, its performance on face images significantly different from the training distribution (e.g., different ethnicities, extreme poses) is not guaranteed and may result in failure.
  • GAN Training Instability: Like most GANs, the training process can be dynamic, and issues like gradient disappearance can arise if one network (generator or discriminator) becomes too powerful.
  • Domain Specificity: The method has been primarily applied to face image completion. Its effectiveness on other types of datasets (e.g., natural scenes, objects) remains unknown and requires further investigation.

Future work could focus on extending the model to handle higher resolutions, improving its robustness to out-of-distribution data, exploring more stable GAN training techniques, and evaluating its performance across a broader range of image domains.

Summary updated

BibTeX
@inproceedings{shao2022large,
  author = {Changcheng Shao and Xiaolin Li and Fang Li and Yifan Zhou},
  title = {{Large Mask Image Completion with Conditional GAN}},
  booktitle = {Symmetry},
  year = {2022},
  doi = {10.3390/sym14102148},
}
Figure