TL;DR
QueryOTR reframes image outpainting as a patch-wise sequence-to-sequence autoregression problem, moving away from traditional CNN-based architectures. By combining a Vision Transformer (ViT) with a novel Query Expansion Module (QEM), the framework achieves superior global context modeling and faster convergence, producing seamless and realistic image extrapolations.
What Problem Does This Paper Address?
Image outpainting—the task of generating new, harmonious content beyond an image's original boundaries—is notoriously difficult. Most existing solutions rely on Convolutional Neural Networks (CNNs). While effective, CNNs are limited by their inherent inductive biases: locality and weight sharing. These constraints make it hard for models to capture the long-range dependencies needed to ensure that a newly generated patch on the far left of an image is semantically consistent with a patch on the far right.
Furthermore, while pure Transformers offer the global modeling capacity CNNs lack, they typically suffer from slow convergence, especially when trained on the relatively small datasets common in the outpainting field.
Methods
The authors introduce the Query Outpainting TRansformer (QueryOTR), a hybrid encoder-decoder framework that treats outpainting as a sequence-to-sequence task.
- Transformer Encoder: A standard ViT processes the input image as a sequence of non-overlapping patches.
- Query Expansion Module (QEM): This is a key innovation. Instead of learning queries from scratch (which is slow), QEM uses stacked CNN blocks to predict expanded queries based on the encoder's output. This "hybrid" approach uses CNN inductive bias to jump-start the Transformer's learning process.
- Transformer Decoder: Uses multi-head cross-attention to allow every predicted patch to attend to all input patches, ensuring global consistency.
- Patch Smoothing Module (PSM): To avoid the "checkerboard" artifacts common in patch-based generation, PSM allows for overlapping regions between predicted patches and averages them, resulting in seamless transitions.
Datasets
The model was evaluated on three diverse datasets:
- Scenery: ~6,000 images of natural landscapes (mountains, valleys, etc.).
- Building Facades: ~17,500 images of urban architecture.
- WikiArt: ~65,000 fine-art paintings across various genres.
Key Insights and Ideas
- Autoregression for Images: By treating outpainting as a sequence problem, the model can generate patches one by one (or in groups) while maintaining a "memory" of the entire visual context.
- The Hybrid Advantage: The QEM proves that you don't have to choose between CNNs and Transformers. Using CNNs to generate the initial queries for a Transformer decoder speeds up convergence by approximately 3.3x.
- Locality via Overlap: While Transformers are great at global context, they can struggle with local pixel-to-pixel continuity. The PSM's simple strategy of overlapping and averaging patches effectively solves the boundary discontinuity problem.
Key Results
QueryOTR consistently outperformed state-of-the-art (SOTA) CNN-based methods (like NSIPO and SRN) and other Transformer-based models (like Uformer) across all metrics:
- Quantitative: It achieved the best (lowest) FID (Fréchet Inception Distance) and highest IS (Inception Score) across all three datasets. For example, on the Scenery dataset (1x outpainting), QueryOTR reached an FID of 20.366, significantly lower than the CNN-based SRN at 47.781.
- Efficiency: QueryOTR is roughly 3x faster during inference than the Swin-Transformer-based Uformer, thanks to its streamlined architecture.
- Qualitative: Visual results show more realistic details, such as coherent ripples in water and structurally sound architecture, compared to the "blunt" or "abrupt" generations of previous models.
Limitations and Future Work
While QueryOTR significantly improves convergence, the authors note that Transformers generally still benefit from larger datasets to reach full performance saturation. The current implementation focuses on all-side extrapolation; future iterations might explore more complex, non-symmetrical outpainting masks. Additionally, while the PSM handles patch boundaries well, integrating even more sophisticated local constraints within the attention mechanism itself could be a promising direction.
Summary updated