Retrieval-based Spatially Adaptive Normalization for Semantic Image Synthesis

Yupeng Shi, Xiao Liu, Yuxiang Wei, Zhongqin Wu, Wangmeng Zuo

TL;DR

Researchers have developed RESAIL (REtrieval-based Spatially AdaptIve normaLization), a novel architecture that significantly sharpens semantic image synthesis. By retrieving real image patches from a database to serve as pixel-level "templates," the model moves beyond blurry, uniform object generation to produce highly detailed, photo-realistic scenes.

What Problem Does This Paper Address?

Semantic image synthesis—the task of turning a "label map" (like a color-coded drawing of a street) into a photo—has seen massive gains thanks to Generative Adversarial Networks (GANs). However, a persistent "blurriness" problem remains.

Most state-of-the-art models, like SPADE or SEAN, use coarse-level guidance. They apply normalization parameters uniformly across an entire semantic class (e.g., treating every pixel of a "car" the same way). But a car isn't uniform; a wheel has a vastly different texture and structure than a window. Because these models lack fine-grained, pixel-level instructions, they often produce "mushy" textures and lack sharp internal details, especially in large objects.

Comparison of SPADE, SEAN, and RESAIL. Note how RESAIL produces much sharper details in the car and building textures.

Methods

The authors introduce a two-pronged approach to inject fine-grained detail into the synthesis process:

  1. Retrieval-based Guidance: Instead of generating textures from scratch, the system looks at the input semantic mask and searches a training database for real image segments with the most similar shapes. These retrieved segments are stitched together to form a "guidance image" ($I^r$). This provides the network with a pixel-accurate "cheat sheet" of what real-world textures and structures should look like for those specific shapes.
  2. The RESAIL Module: The core of the generator is the RESAIL ResBlock. Unlike standard blocks that only look at the semantic map, RESAIL learns two sets of modulation parameters:
  3. Coarse parameters from the semantic map (capturing the general class).
  4. Fine-grained parameters from the retrieved guidance image (capturing pixel-level textures). These are weighted and summed to modulate the feature activations, as shown in the architecture overview below.
Overview of the RESAIL architecture, showing the retrieval paradigm and the detailed ResBlock structure.
  1. Data Distortion for Training: A major challenge is that retrieved images don't perfectly match the target ground truth, making standard perceptual losses difficult to use. To solve this, the authors introduced a data distortion mechanism. During training, they take the actual ground-truth image and intentionally distort its color, shape, and resolution to "mimic" the imperfect quality of a retrieved image. This allows the model to learn how to refine "messy" guidance into clean, photo-realistic outputs.
The data distortion process used during training to bridge the gap between perfect ground truth and imperfect retrieved guidance.

Datasets

The model was evaluated on four widely recognized benchmarks for semantic synthesis:

  • Cityscapes: Urban street scenes.
  • ADE20K & ADE20K-outdoor: Diverse indoor and outdoor scenes with 150 semantic categories.
  • COCO-Stuff: A massive dataset of complex real-world scenes.

Key Insights and Ideas

  • Shape as a Proxy for Texture: The authors realized that objects with similar shapes in a semantic map often share similar internal structures. By retrieving based on shape similarity, they provide the GAN with a highly relevant starting point for texture synthesis.
  • Moving Beyond Uniformity: The shift from class-level normalization to pixel-level modulation is the "aha moment." It allows the network to treat different parts of the same object differently, which is essential for realism.
  • Multi-modal & Local Editing: Because the guidance is based on retrieved segments, users can swap out specific retrieved parts (e.g., changing just the "bed" segment) to locally edit the synthesized image or generate multiple diverse versions of the same scene.
Demonstration of multi-modal synthesis and local editing capabilities.

Key Results

RESAIL consistently outperformed previous leaders like SPADE, CC-FPSE, and OASIS across multiple metrics:

  • FID (Fréchet Inception Distance): Achieved lower (better) scores on Cityscapes (45.5 vs. SPADE's 71.8) and ADE20K-outdoor (48.6 vs. OASIS's 48.6, but with significantly better mIoU).
  • mIoU (Mean Intersection-over-Union): Showed superior semantic alignment, reaching 69.7 on Cityscapes.
  • User Preference: In a blind study, volunteers preferred RESAIL's results over SPADE, CC-FPSE, and OASIS more than 80% of the time. Remarkably, RESAIL's outputs were mistaken for real ground-truth images about 17% of the time.

Limitations and Future Work

The primary bottleneck for RESAIL is inference speed. The retrieval process—searching a large database for matching shapes and compositing them—is computationally expensive and time-consuming. This currently prevents the model from being used for real-time applications. The authors suggest that future work will focus on accelerating or bypassing the explicit retrieval step to make the system more efficient. Additionally, they note the potential for misuse in creating deepfakes, highlighting the need for responsible deployment of such high-fidelity synthesis tools.

Summary updated

BibTeX
@misc{shi2022retrieval,
  author = {Yupeng Shi and Xiao Liu and Yuxiang Wei and Zhongqin Wu and Wangmeng Zuo},
  title = {{Retrieval-based Spatially Adaptive Normalization for Semantic Image Synthesis}},
  year = {2022},
  eprint = {2204.02854},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2204.02854},
}
Figure