Outpainting by Queries

Kai Yao, Penglei Gao, Xi Yang, Jie Sun, Rui Zhang, Kaizhu Huang

Abstract

Image outpainting requires generating semantically consistent content beyond an image's original boundaries, a task traditionally dominated by Convolutional Neural Networks (CNNs). However, CNNs often struggle with long-range dependencies due to their inherent inductive biases. This paper presents QueryOTR (Query Outpainting TRansformer), a novel framework that treats outpainting as a patch-wise sequence-to-sequence problem. By combining a Vision Transformer (ViT) with a Query Expansion Module (QEM) and a Patch Smoothing Module (PSM), QueryOTR achieves state-of-the-art results with 3.3x faster convergence than pure transformer models.

Introduction

The challenge of image outpainting lies in balancing local texture fidelity with global structural logic. While CNNs excel at local patterns, their "locality" and "weight sharing" constraints often lead to repetitive or incoherent structures in large-scale extrapolations. Transformers offer a solution through global modeling but typically suffer from slow convergence and high data requirements. QueryOTR bridges this gap by introducing a hybrid architecture that leverages the strengths of both paradigms.

Methodology

QueryOTR utilizes a hybrid encoder-decoder transformer framework. The process begins with a standard Vision Transformer (ViT) encoder extracting representations from input image patches.

The core innovation is the Query Expansion Module (QEM). Unlike standard transformers that use static learnable query tokens, QEM employs CNN-based blocks to predict queries based on the encoder’s output. This reintroduces a controlled amount of CNN inductive bias, which significantly accelerates training. Following the transformer decoder, the Patch Smoothing Module (PSM) addresses the "checkerboard" artifacts common in patch-based generation. By allowing overlapping regions and averaging pixel values, PSM ensures seamless transitions between generated patches.

The Query Expansion Module (QEM) significantly accelerates convergence, while the Patch Smoothing Module (PSM) eliminates patch-edge artifacts.

Experimental Setup

The model was evaluated on three distinct datasets: Scenery (natural landscapes), Building Facades (geometric structures), and WikiArt (complex artistic styles). Training employed a multi-part loss function comprising Patch-wise Reconstruction Loss (L2), Perceptual Loss (VGG-19), and Adversarial Loss (PatchGAN).

Results and Discussion

QueryOTR consistently outperformed state-of-the-art CNN-based models (SRN, NSIPO) and transformer-based competitors (Uformer). On the Scenery dataset, it achieved a leading FID of 20.366 and an Inception Score of 3.955.

QueryOTR demonstrates superior structural stability and semantic consistency across multiple outpainting steps (1x to 4x) in diverse domains.

Key insights from the results include:

  • The Hybrid Advantage: Integrating CNN blocks within the QEM provides a structural "starting point," allowing the transformer to focus on global alignment rather than learning basic local features from scratch.
  • Convergence Efficiency: The QEM-enabled architecture converges 3.3 times faster than pure transformer setups, making it a viable option for specialized or smaller datasets.
  • Recursive Stability: Unlike many CNN baselines that degrade quickly during recursive outpainting, QueryOTR maintains structural integrity even at 4x expansion.

Conclusion

QueryOTR demonstrates that reframing outpainting as a query-based sequence task, supported by targeted CNN-based modules, overcomes the limitations of both pure CNN and pure transformer architectures. Future work will explore scaling this approach to high-definition synthesis and temporal video outpainting.

Summary updated

BibTeX
@inproceedings{yao2022outpainting,
  author = {Kai Yao and Penglei Gao and Xi Yang and Jie Sun and Rui Zhang and Kaizhu Huang},
  title = {{Outpainting by Queries}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  doi = {10.1007/978-3-031-20050-2\_10},
}
Figure