Abstract
We develop a method for user-controllable semantic image inpainting: Given an arbitrary set of observed pixels, the unobserved pixels can be imputed in a user-controllable range of possibilities, each of which is semantically coherent and locally consistent with the observed pixels. We achieve this using a deep generative model bringing together: an encoder which can encode an arbitrary set of observed pixels, latent variables which are trained to represent disentangled factors of variations, and a bidirectional PixelCNN model. We experimentally demonstrate that our method can generate plausible inpainting results matching the user-specified semantics, but is still coherent with observed pixels. We justify our choices of architecture and training regime through more experiments.
Introduction
Traditional image inpainting focuses on filling holes using local textures and patterns. "Semantic" inpainting goes a step further, using a high-level understanding of the scene (e.g., knowing that a face needs an eye). However, existing semantic inpainting methods are typically "black boxes": they provide a single deterministic result or a set of random samples, leaving the user with no control over the generated content.
This paper introduces a deep generative model for image inpainting that allows users to specify high-level semantic features—like facial expressions or lip color—in the missing regions of an image. By combining a disentangled latent variable model with a novel bidirectional PixelCNN, the system generates results that are both semantically coherent and locally consistent with the surrounding pixels without requiring adversarial training or complex post-processing.
Problem Statement
The challenge lies in creating a model where latent variables are disentangled (one variable controls one specific feature) and informative (the model actually uses the variable to generate the image), while ensuring the new content blends perfectly with the original unmasked pixels.
Methodology
The authors propose a hybrid architecture that splits the task into two streams:
- Disentangled PixelVAE: This component handles high-level semantics. It uses an encoder to map partially observed images into a latent space. To ensure these latent variables are interpretable and controllable, they use the InfoVAE-MMD objective. This specific objective is chosen to solve the "information preference problem," where powerful decoders often ignore latent codes in favor of their own autoregressive modeling.
- Bidirectional PixelCNN: This component handles low-level texture and local consistency. Standard PixelCNNs generate pixels in a raster-scan order, which often creates visible seams at the bottom and right edges of a hole. The authors introduce a "reverse" PixelCNN that scans in the opposite direction, providing context from all sides to ensure local harmony.
The model is trained in two stages. First, the PixelVAE is trained to learn global semantics. Second, the bidirectional PixelCNN is trained to handle local details while the VAE weights are kept fixed. This prevents the powerful PixelCNN from "stealing" the semantic learning task from the latent variables.
Key Results
The primary result is the ability to perform controllable inpainting. Users can independently adjust features like mouth openness, smiles, and lip color within the masked area by varying individual latent variables.
Qualitatively, the model produces plausible completions even for very large missing regions. Unlike previous methods, it achieves local consistency at the boundaries without needing Poisson blending or GAN-based adversarial losses.
Discussion and Insights
- The Power of MMD: The authors found that standard VAE objectives often led to "latent code ignorance" when paired with a PixelCNN decoder. The InfoVAE-MMD objective was critical for forcing the model to actually use the latent variables for generation.
- Fixing the "Jarring Line": By using a bidirectional approach, the model avoids the boundary artifacts common in autoregressive models. The reverse stream acts as a location-dependent bias that informs the forward stream about what lies "ahead" in the scan order.
- Two-Stage Training is Essential: If trained end-to-end, the autoregressive decoder tends to ignore the latent variables. Separating the training ensures the latent space captures the user-controllable features.
Conclusion
While current experiments are limited to 32x32 images, this work demonstrates a robust framework for controllable semantic editing. Future work includes scaling to higher resolutions and incorporating semi-supervision to make latent factors even more reliable and easier for users to navigate.
Summary updated