In&Out : Diverse Image Outpainting via GAN Inversion

Yen-Chi Cheng, Chieh Hubert Lin, Hsin-Ying Lee, Jian Ren, Sergey Tulyakov, Ming-Hsuan Yang

Image outpainting—the task of extending an image beyond its original borders—is a fascinating but notoriously difficult problem. Unlike inpainting, where the surrounding pixels provide strong constraints, outpainting is wide open. How should a mountain range continue? With a forest, a lake, or more jagged peaks?

Most existing methods treat this as a deterministic image-to-image (I2I) translation task. The result? They often produce repetitive, "safe" textures that lack diversity and creative flair. In their paper, "In&Out: Diverse Image Outpainting via GAN Inversion," Yen-Chi Cheng and colleagues propose a shift in perspective: instead of translating, why not invert?

TL;DR

The authors propose In&Out, a framework that treats image outpainting as a GAN inversion task. By using a coordinate-conditioned generator to synthesize micro-patches, the model can generate diverse, high-quality, and user-controllable image extensions that far surpass traditional deterministic methods.

What Problem Does This Paper Address?

The core challenge in outpainting is the lack of constraints. Because there are infinitely many ways to extend a scene, deterministic I2I models struggle. They tend to "leak" textures from the input into the output, leading to repetitive patterns. Furthermore, these models usually provide a single output, ignoring the inherent multi-modality of the problem. If you want to add a specific element—like a tower or a tree—to the extended area, standard models offer little to no control.

Methods

The authors' solution, In&Out, consists of two main stages: training a specialized generator and then performing outpainting via inversion.

1. Coordinate-Conditioned Generator

Instead of generating a full image at once, the generator (based on StyleGAN2) is trained to produce micro-patches. Each patch is conditioned on two things:

  • A global latent code that ensures semantic consistency across the whole image.
  • A unique coordinate label that tells the generator where that patch belongs in the final composition.

This architecture, inspired by COCO-GAN, allows the model to handle arbitrary output shapes and sizes, such as long panoramas.

2. Outpainting via GAN Inversion

To outpaint an image, the model doesn't just "predict" the next pixels. Instead, it searches for a latent code in the GAN's pre-trained space that perfectly reconstructs the existing input image. Once this "optimal" latent code is found, the generator can simply be asked to render patches for the new coordinates outside the original frame.

Overview of the In&Out framework showing the inversion process and diverse outputs.

3. Diversity and Control

To avoid the "one-size-fits-all" problem, the authors introduce a diversity loss during the inversion process. This encourages the search to find multiple, distinct latent codes that all match the input but lead to different outpainted results.

Additionally, they propose a categorical setting. By providing categorical labels (e.g., "sky," "mountain," "sea") as extra conditioning, users can explicitly guide what appears in the outpainted regions.

Datasets

The model was evaluated on three main datasets:

  • Places365: A standard benchmark for scene recognition and synthesis. The authors used a subset of 25 scenery classes (62,500 images).
  • Flickr-Scenery: A new, large-scale dataset collected by the authors, containing 54,710 high-quality scenery images from Flickr.
  • LSUN Church: Used to demonstrate the model's ability to handle structured, man-made objects.

Key Insights and Ideas

  • Inversion as a Prior: By formulating outpainting as GAN inversion, the model leverages the rich, learned prior of the GAN. This allows it to synthesize novel objects and complex structures that weren't in the original input, rather than just repeating textures.
  • Gaussianized Latent Space: The authors found that mapping the standard StyleGAN latent space ($W$) to a Gaussianized space ($V$) significantly improved inversion stability and visual quality, preventing the model from "drifting" into unrealistic regions of the latent space.
  • Patch-Based Flexibility: The micro-patch approach is a game-changer for outpainting. It allows for multi-directional extensions (up, down, left, right) and even irregular boundary handling without retraining the model.

Key Results

In&Out outperformed state-of-the-art baselines like Boundless and NS-outpaint across both quantitative and qualitative metrics.

  • Quantitative: On the Places365 dataset, In&Out achieved a Fréchet Inception Distance (FID) of 23.57, a significant improvement over Boundless (35.02). It also showed much higher diversity, measured by the LPIPS metric.
  • Qualitative: As shown in the figures below, the model produces much more realistic and varied results. While baselines often create blurry or repetitive extensions, In&Out can introduce entirely new, semantically appropriate elements.
Diverse outpainting results showing multiple valid extensions for a single input.
Categorical manipulation allowing users to specify objects like towers or mountains in the outpainted area.

Limitations and Future Work

Despite its strengths, the authors note a few hurdles:

  • Out-of-Distribution Inputs: If the input image contains objects the GAN hasn't seen during training (e.g., a specific type of tropical villa), the inversion process struggles to find a matching latent code, leading to artifacts.
  • Rare Category Combinations: Asking the model to place a "tower" in the middle of a "valley" might fail if that specific combination was rare in the training data.
  • Seams: While a blending algorithm is used, tiny seams can occasionally appear between micro-patches, especially in complex foreground objects.

Future work could involve exploring more robust inversion techniques or expanding the generator's vocabulary to handle even more diverse real-world scenes.

Summary updated

BibTeX
@inproceedings{cheng2022out,
  author = {Yen-Chi Cheng and Chieh Hubert Lin and Hsin-Ying Lee and Jian Ren and Sergey Tulyakov and Ming-Hsuan Yang},
  title = {{In\&Out : Diverse Image Outpainting via GAN Inversion}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
  doi = {10.1109/cvpr52688.2022.01114},
}
Figure