Controllable Text-to-Image Generation

Bowen Li, Xiaojuan Qi, Thomas Lukasiewicz, Philip H. S. Torr

In the world of AI-generated art, we’ve become accustomed to a "lottery" system. You type a prompt, get a beautiful image, but if you try to change just one word—say, changing a "yellow bird" to a "red bird"—the entire composition often resets. The bird moves, the branch disappears, and the background changes.

Researchers have addressed this "all-or-nothing" problem with ControlGAN, a framework designed for controllable text-to-image generation.

TL;DR

ControlGAN is a generative adversarial network that allows users to manipulate specific visual attributes of an image (like color or texture) using natural language without altering the rest of the scene. By combining channel-wise attention with a word-level discriminator, it achieves state-of-the-art image quality while providing unprecedented "editability."

What Problem Does This Paper Address?

The core challenge in text-to-image (T2I) synthesis is controllability. While models like AttnGAN can generate high-quality images, they struggle with "disentanglement." In these models, the representation of a "bird" is often entangled with its "color" and "pose."

When a user modifies a text prompt to edit an image, the model's latent variables shift unpredictably. This makes it nearly impossible to perform iterative editing—a requirement for real-world applications like graphic design or video game asset creation. The authors aim to create a framework where changing a word only changes the corresponding visual attribute, preserving the "irrelevant" parts of the image (like the background or the object's posture).

Comparison of image manipulation from text. ControlGAN (Ours) successfully changes the bird's color from yellow to red while preserving the original pose and background, unlike previous methods.

Methods

ControlGAN builds upon multi-stage architectures but introduces three critical innovations to achieve fine-grained control:

The ControlGAN architecture, featuring a word-level spatial and channel-wise attention-driven generator, a word-level discriminator, and a perceptual loss network.
  1. Channel-wise Attention Module: Standard spatial attention tells a model where to look in an image. However, different "channels" in a neural network often represent different semantic features (e.g., one channel might represent "stripes," another "blue"). ControlGAN introduces channel-wise attention to help the model focus on the specific feature channels most relevant to a word, allowing for better disentanglement of attributes.
  2. Word-Level Discriminator: Traditional discriminators give a "thumbs up/down" to the whole image. ControlGAN’s discriminator correlates specific words with specific image subregions. This provides the generator with fine-grained feedback: "The bird looks real, but this specific wing region doesn't match the word 'red'."
  3. Perceptual Loss: To prevent the model from "hallucinating" a brand-new image when the text changes, the authors adopt a perceptual loss (using a pre-trained VGG-16 network). This forces the generator to maintain semantic consistency between the original and modified versions of the image, acting as a "semantic anchor."

Datasets

The model was evaluated on two standard benchmarks:

  • CUB (Caltech-UCSD Birds-200-2011): A dataset of 11,788 images of birds with fine-grained text descriptions.
  • MS COCO: A much more complex dataset containing images of various objects in natural scenes.

The authors used these datasets to test both the quality of the generated images and the model's ability to handle "modified" text prompts.

Key Insights and Ideas

  • Spatial vs. Channel Attention: The authors discovered that while spatial attention is great for locating objects, channel-wise attention is superior for capturing specific attributes like color and texture. Using both allows the model to be much more precise.
  • The Importance of Local Feedback: By forcing the discriminator to look at word-region pairs, the model learns that "yellow" refers to the feathers, not the branch. This prevents "color bleeding" where the whole image turns yellow.
  • Handling Out-of-Distribution Queries: One of the most impressive "aha" moments in the paper is showing that ControlGAN can handle nonsensical prompts like "a red zebra on a river." Because it has learned to disentangle "zebra" from "black and white," it can successfully apply the "red" attribute to the zebra's pattern.

Key Results

ControlGAN outperformed previous state-of-the-art models (StackGAN++ and AttnGAN) both qualitatively and quantitatively:

  • Inception Score (IS): On the CUB dataset, ControlGAN achieved a score of 4.58, compared to AttnGAN’s 4.36.
  • Controllability: The researchers measured the $L_2$ reconstruction error between images generated from original vs. modified text. ControlGAN achieved a significantly lower error (0.18 on CUB vs. AttnGAN's 0.26), proving it preserves the "unmodified" parts of the image much better than its predecessors.
  • Visual Consistency: Qualitative results show that when changing a bird's color, ControlGAN keeps the bird in the exact same pose and location, whereas other models generate a completely different bird.

Limitations and Future Work

The authors acknowledge that while ControlGAN performs exceptionally well on fine-grained datasets like CUB, the results on MS COCO are less consistent. COCO contains many more categories and abstract captions, making it harder for the model to learn precise word-to-region correlations.

Future work likely involves scaling these attention mechanisms to even more complex scenes and perhaps integrating them with larger transformer-based architectures to handle the diversity of the COCO dataset more effectively.

Summary updated

BibTeX
@inproceedings{li2019controllable,
  author = {Bowen Li and Xiaojuan Qi and Thomas Lukasiewicz and Philip H. S. Torr},
  title = {{Controllable Text-to-Image Generation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
  url = {https://openreview.net/forum?id=YTBKxJoQJJ},
}
Figure