Controlling Style and Semantics in Weakly-Supervised Image Generation

Dario Pavllo, Aurelien Lucchi, Thomas Hofmann · DOI

TL;DR

This paper introduces a weakly-supervised framework for generating complex images using sparse semantic masks and natural language descriptions. By decomposing the generation process into separate background and foreground steps, the authors achieve unprecedented local control over image editing while outperforming state-of-the-art fully-supervised models.

What Problem Does This Paper Address?

Generative Adversarial Networks (GANs) have become remarkably good at creating realistic images, but they often lack fine-grained user control. Current approaches generally fall into two camps:

  1. Weak Conditioning: Using a single sentence to describe a scene. This is easy for users but often leads to incoherent results on complex datasets like COCO.
  2. Rich Conditioning: Using dense, pixel-perfect segmentation masks. While high-quality, these masks are incredibly expensive to label and difficult for users to manipulate manually.

Furthermore, most existing models suffer from "entanglement": changing one small part of an image (like moving a dog) often causes the entire background to shift because the model has learned global correlations between objects and their environments.

Methods

The authors propose three key innovations to bridge the gap between ease-of-use and high-quality control:

  • Sparse Masks from Object Detectors: Instead of hand-labeled dense masks, they use an off-the-shelf object detector (like Mask R-CNN) to generate "sparse" masks. These masks only cover the detected objects and leave gaps, which the model learns to fill in autonomously. This allows the use of massive, unlabeled datasets.
  • Two-Step Generation: The architecture consists of two concatenated generators. The first ($G_1$) generates a background, and the second ($G_2$) generates foreground objects. These are combined using a learned alpha-blending mask. This separation ensures that manipulating a foreground object doesn't trigger a global "hallucination" in the background.
  • Semantic Attention for Style: To control style via text (e.g., "a red car at night"), they introduce a sentence-semantic attention module. Unlike standard attention that looks at every pixel, this module applies attention directly to the semantic classes. This makes the computational cost independent of image resolution, allowing it to scale to high-resolution generation.
The two-step generation process allows for localized changes without affecting the global scene.

Datasets

The model was evaluated on several standard benchmarks:

  • COCO-Stuff: A standard dataset for scene generation.
  • Visual Genome (VG): Used to extract rich attributes and scene graphs.
  • VG+ (Augmented): The authors created a larger training set by combining VG with 123k unlabeled images from COCO, demonstrating how their weakly-supervised approach scales to data without ground-truth masks.

Key Insights and Ideas

  • Weak Supervision Can Beat Full Supervision: Surprisingly, the model trained on sparse, detector-generated masks achieved better FID scores (a measure of image quality) than the baseline trained on ground-truth COCO masks. This is because the object detector captures fine details—like wheels, windows, and headlights—that are often ignored in standard coarse semantic labels.
  • The "Hole" Problem: Dense masks are hard to edit because deleting an object leaves a "hole" that must be manually filled with another class (like "road" or "building"). Sparse masks avoid this by letting the model's background generator naturally infill the gaps.
Comparison of different input masks and their impact on generation and manipulation.
  • Resolution-Independent Attention: By tying text tokens to semantic classes rather than spatial feature maps, the attention mechanism remains efficient even as image sizes grow.

Key Results

  • Quantitative: On the COCO-Stuff dataset, the proposed sparse mask baseline achieved an FID of 20.02, significantly better than the fully-supervised SPADE baseline of 22.64. When scaled up to the augmented VG+ dataset, the FID improved further to 18.93.
  • Qualitative: The model demonstrates impressive flexibility. Users can change a "red train" to a "green train" via text, or swap a group of zebras for an elephant by simply modifying the sparse mask.
Qualitative results showing style manipulation via text and attributes.

Limitations and Future Work

  • Instance Differentiation: The current attention mechanism cannot distinguish between two different instances of the same class (e.g., if you have two cars, a command to make the car "red" might affect both). The authors suggest adding positional embeddings to the queries as a potential fix.
  • Geometric Precision: While excellent for outdoor scenes, the model sometimes struggles with the rigid geometric details required for close-up indoor photography.
  • Caption Descriptive Power: The model is limited by the quality of training captions; COCO captions often focus on actions rather than the specific visual styles (like lighting or texture) that users might want to control.

Summary updated

BibTeX
@inproceedings{pavllo2020controlling,
  author = {Dario Pavllo and Aurelien Lucchi and Thomas Hofmann},
  title = {{Controlling Style and Semantics in Weakly-Supervised Image Generation}},
  booktitle = {European Conference on Computer Vision},
  year = {2020},
  doi = {10.1007/978-3-030-58539-6\_29},
}
Figure