# Generative Adversarial Text to Image Synthesis

Text descriptions can be turned directly into plausible bird and flower images

Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, Honglak Lee · arXiv · 2016-5-17

- **Problem** Generating an image from one sentence is hard because a description fits very many pixel arrangements. Detailed visual attributes are also costly to collect for each category.
- **Method** GAN-CLS is a conditional GAN whose generator and discriminator both take a character-level text embedding. Its discriminator also scores real images paired with mismatched text as fake, and the generator adds an interpolation regularizer.
- **Results** On CUB and Oxford-102, the interpolation variants produce plausible bird and flower images from captions of unseen categories. Interpolation also gives the best style-prediction AU-ROC.

## Why text-to-pixel synthesis is hard

The goal is to turn one human-written sentence, such as a description of a bird's beak or a flower's petals, directly into image pixels. Earlier work captured this kind of detail with attribute vectors, which are discriminative but may need domain-specific knowledge to build. Text encoders trained on words and characters now produce representations that generalise to unseen categories, and deep decoders have made realistic image synthesis possible for some domains.

The difficulty is that a single description is compatible with a very large number of pixel configurations, so the conditional distribution of images is highly multimodal. Going from image to text avoids this problem in practice because a word sequence can be predicted one token at a time, but no such sequential decomposition exists for pixels.

A conditional GAN fits this setting because the discriminator can act as an adaptive loss that pushes generated images toward the description.

The evaluation covers the Caltech-UCSD Birds and Oxford-102 Flowers datasets with five descriptions per image, using held-out categories for zero-shot tests, and the MS COCO dataset for more general scenes.

## GANs and the text embedding the model builds on

A GAN pits a generator G against a discriminator D in a two-player minimax game. D learns to separate real training data from synthetic images, and G learns to make its outputs pass as real. The value function is \\\[ V(D,G) = E\_{x\\sim p\_{data}(x)}\[\\log D(x)\] + E\_{z\\sim p\_z(z)}\[\\log(1-D(G(z)))\] \\\] and, in practice, the generator maximizes \\(\\log(D(G(z)))\\) rather than minimizing \\(\\log(1-D(G(z)))\\).

Under mild capacity conditions, the cited analysis gives a global optimum at which \\(p\_g\\) equals \\(p\_{data}\\).

The text encoder comes from a joint embedding trained with images. A text encoding should score higher with images of its own class than with images of any other class, and the score is a dot product between an image encoding and a text encoding. Gradients from that structured objective are passed back into the text encoder, so the encoder becomes discriminative for visual content.

The encoder used in the model is a hybrid of a character-level convolutional network and a recurrent network, which the earlier work chose for robustness to typos and a large vocabulary.

## Generator and discriminator design

The model is a deep convolutional GAN whose generator and discriminator both run feed-forward conditioned on the text feature produced by the hybrid character-level encoder. The generator maps a noise vector of dimension Z and a text embedding of dimension T to an image of dimension D, and the discriminator takes an image and a text embedding and returns a score in the range 0 to 1.

In the generator, a noise sample is drawn from a unit normal distribution and the text embedding is first compressed by a fully connected layer to 128 dimensions, followed by leaky ReLU. The compressed embedding is concatenated with the noise vector, and the result goes through deconvolutional layers to produce a synthetic image.

The discriminator applies several stride-2 convolutions with spatial batch normalization and leaky ReLU to the image. Its text embedding is reduced by a separate fully connected layer, then replicated spatially and concatenated with the feature maps once the spatial size is 4 by 4, followed by a 1 by 1 convolution and a 4 by 4 convolution that give the final score.

## Matching-aware discriminator

The naive way to train a conditional GAN treats text-image pairs as joint observations, but the discriminator then has no explicit way to check whether a real image matches the text. Early in training the discriminator ignores the text and rejects generated samples for being implausible, so the text condition only becomes useful after the generator produces plausible images.

The matching-aware variant, GAN-CLS, adds a third input: real images paired with mismatched text, which the discriminator must score as fake. This gives the generator an extra signal about image and text agreement.

Algorithm 1 encodes the matching text and a mismatched text, draws noise, and generates a fake image. It then computes three scores: sr for a real image with its own text, sw for a real image with the wrong text, and sf for the fake image with its own text. The discriminator objective is \\\[ L\_D = \\log(s\_r) + (\\log(1-s\_w) + \\log(1-s\_f))/2 \\\] and the generator objective is \\\[ L\_G = \\log(s\_f) \\\], with both networks updated by gradient steps.

## Manifold interpolation for the generator

Learned representations tend to place interpolations between two embeddings near the data manifold, so interpolated caption embeddings can be used as extra training inputs at no labelling cost.

Because the interpolated embeddings have no paired real image, the discriminator is not able to check them against real data directly, but it does learn whether an image and a text pair match. The interpolation regularizer improves generated sample quality, including on held-out zero-shot categories of CUB.

## Inverting the generator for style transfer

If the text encoding holds the content, the noise sample has to hold style factors such as background colour and pose. To transfer style from a query image onto a text description, a convolutional network is trained to invert the generator. At run time the query image gives a style vector s = S(x), which is then combined with the text encoding to generate the result image G(s, phi(t)).

## Datasets, training and text pre-training

CUB has 11,788 images of birds in 200 categories, and Oxford-102 contains 8,189 images of flowers in 102 categories. During mini-batch selection the training images are randomly cropped or flipped, and one of the captions is chosen at random.

The text encoder is pre-trained as a structured joint embedding with 1,024-dimensional GoogLeNet image embeddings, and the same char-CNN-RNN encoder is used for both datasets. Pre-training is not required by the method, and the end-to-end variant GAN-E2E is reported in the supplement. Pre-training was used to speed up the training of the other components.

The same GAN architecture is used on all datasets, with training images of size 64×64×3 and 1,024-dimensional text embeddings projected to 128 dimensions in both networks. Training uses a base learning rate of 0.0002, the ADAM solver with momentum 0.5, a 100-dimensional unit-normal noise vector, a minibatch size of 64, and 600 epochs.

## Qualitative results on CUB and Oxford-102

The four variants are the baseline GAN, GAN-CLS, GAN-INT and GAN-INT-CLS, which combines the matching-aware discriminator with interpolation. The figure uses zero-shot captions from test-set categories, and the authors state that the interpolation regulariser was needed to reliably get visually plausible results.

On Oxford-102, all four methods generate plausible flower images that match the description. The baseline GAN has the most variety in petal morphology when the caption leaves that part unspecified, while the other methods produce more class-consistent images. The authors speculate that flowers are easier to generate than birds, because birds have stronger structural regularities across species, which makes a fake bird easier for D to spot.

## How well style and content separate

Captions rarely mention background or pose, so the noise vector must account for style if the images are to look realistic.

Two verification tasks use the noise as input, one for pose and one for background colour. Image pairs are grouped into 100 clusters with K-means, background colour is taken from the average RGB value of the background, and pose from six keypoint coordinates. Style vectors come from the trained style encoder, pairs are scored by cosine similarity, and AU-ROC is averaged over 5 folds, with text features from the text encoder as a baseline.

Captions alone are not informative for style prediction, which the baseline confirms. Models with the interpolation regulariser, GAN-INT and GAN-INT-CLS, perform best on this task, consistent with the qualitative results.

## Style transfer and generalisation to new pairings

GAN-INT-CLS with a trained style encoder transfers style from an unseen query image onto a text description. The generated images capture pose information, and in several cases they keep background detail such as a tree branch the bird is perched on.

Because style and content are separated, previously seen content can be paired with previously seen styles in new combinations, which yields images unlike any single training image. Attributes seen in training, such as blue wings or a yellow belly, can also be recombined into a new bird, as in the parakeet-like example.

## Interpolating text and noise

Interpolating between two sentence embeddings produces bird images that transition smoothly, while the noise is held fixed.

Interpolating between two random noise vectors, with the text encoding fixed, produces a gradual change of style while the content stays fixed.

## General scenes on MS COCO

GAN-CLS is trained on MS-COCO with the same text encoder architecture, GAN architecture and hyperparameters as for CUB. Because COCO has no single object category per class, the model learns an instance-level matching function in the same spirit as an earlier visual-semantic embedding.

The validation samples are shown beside their ground-truth images and captions, and they are sharp and diverse when several noise vectors are drawn for one caption. From a distance the results look encouraging, but close inspection shows that the generated scenes are often not coherent, and the human-like shapes in baseball scenes lack articulated parts.

A qualitative comparison with AlignDRAW is given in the supplement, where GAN-CLS produces sharper, higher-resolution samples that roughly match the query. AlignDRAW reflects single-word changes in the query more clearly, and the authors suggest that adding temporal structure to the GAN-CLS generator could help with such variations.

## Limitations

Most of the image results on CUB, Oxford-102 and MS COCO are qualitative figures, and the only reported quantitative score is the style AU-ROC. The MS COCO results are shown on validation images only, and the generated multi-object scenes are not coherent.

The comparison with AlignDRAW is confined to the supplement, so it is not measured in the main text. The main results use a pre-trained text encoder, and the end-to-end variant is reported only in the supplement.

## Paper info

- **Authors**: Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, Honglak Lee
- **Venue**: arXiv · Preprint
- **First published**: 2016-5-17
- **Added**: 2026-11-12
- **Updated**: 2016-6-5
- **Version**: v2
- **arXiv**: 1605.05396
- **Category**: cs.NE · cs.CV
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1605.05396v2) · [PDF ↗](https://arxiv.org/pdf/1605.05396v2)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, Honglak Lee (2016). Generative Adversarial Text to Image Synthesis. arXiv:1605.05396v2. https://arxiv.org/abs/1605.05396v2

**BibTeX**

```
@misc{reed2016generative,
  title = {{Generative Adversarial Text to Image Synthesis}},
  author = {Scott Reed and Zeynep Akata and Xinchen Yan and Lajanugen Logeswaran and Bernt Schiele and Honglak Lee},
  year = {2016},
  eprint = {1605.05396},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1605.05396v2}
}
```

## Other paper commentary

- [Adversarial Autoencoders](https://refivu.com/en/papers/8e20edb4-f017-4781-86f9-478c6059260f-adversarial-autoencoders.md)
- [Stable Video Diffusion: Scaling Latent Video Diffusion Models to Large Datasets](https://refivu.com/en/papers/82291bd9-5c41-4b81-bfde-a025a948f4b9-stable-video-diffusion-scaling-latent-video-diffusion-models.md)
- [Ensemble Adversarial Training: Attacks and Defenses](https://refivu.com/en/papers/c363c126-7d65-4e0a-aa01-0b7a02e39200-ensemble-adversarial-training-attacks-and-defenses.md)
- [Virtual Adversarial Training: A Regularization Method for Supervised and Semi-Supervised Learning](https://refivu.com/en/papers/e553048e-8e0b-413a-97b2-7c98f997c30c-virtual-adversarial-training-a-regularization-method-for.md)
- [Conditional Image Synthesis With Auxiliary Classifier GANs](https://refivu.com/en/papers/cbb27823-75f1-4fb6-b4c8-dcc645b1f162-conditional-image-synthesis-with-auxiliary-classifier-gans.md)
- [StackGAN: Text to Photo-realistic Image Synthesis with Stacked Generative Adversarial Networks](https://refivu.com/en/papers/5f81473c-85d8-4d1a-acd2-1cc917ea3535-stackgan-text-to-photo-realistic-image-synthesis-with.md)
- [BEiT: BERT Pre-Training of Image Transformers](https://refivu.com/en/papers/de9cda9f-90f4-48cc-9bb3-e6f03f9683c7-beit-bert-pre-training-of-image-transformers.md)
- [European Union regulations on algorithmic decision-making and a "right to explanation"](https://refivu.com/en/papers/8d7d2fe1-f155-44ca-8f0a-551e154b6b3a-european-union-regulations-on-algorithmic-decision-making.md)
- [Don't Stop Pretraining: Adapt Language Models to Domains and Tasks](https://refivu.com/en/papers/0864e409-68d0-4d61-98fd-5ab02360285a-don-t-stop-pretraining-adapt-language-models-to.md)
- [Training Region-based Object Detectors with Online Hard Example Mining](https://refivu.com/en/papers/3c16d5fe-9eb6-4481-9b4d-f4eefd0171ee-training-region-based-object-detectors-with-online-hard.md)
- [Unsupervised Learning of Visual Features by Contrasting Cluster Assignments](https://refivu.com/en/papers/8f949bbf-9733-4844-b3ee-a88f5313c480-unsupervised-learning-of-visual-features-by-contrasting.md)
- [Abstractive Text Summarization Using Sequence-to-Sequence RNNs and Beyond](https://refivu.com/en/papers/7a55aaf9-654e-4a97-8efc-d0b4a9fccb7a-abstractive-text-summarization-using-sequence-to-sequence.md)

## Terms in this paper

- [Generative adversarial networks](https://refivu.com/en/terms/889f2a50b737-generative-adversarial-networks)
- [MS COCO](https://refivu.com/en/terms/1a7c38d39825-ms-coco)
- [GAN](https://refivu.com/en/terms/ae488c240045-gan)
- [style transfer](https://refivu.com/en/terms/00f82d672737-style-transfer)
- [ADAM solver](https://refivu.com/en/terms/81f05a5fefb9-adam-solver)
- [GAN-INT-CLS](https://refivu.com/en/terms/83822fb4409b-gan-int-cls)
- [spatial batch normalization](https://refivu.com/en/terms/a56fa63cca43-spatial-batch-normalization)
- [style encoder](https://refivu.com/en/terms/dc12337ccb3d-style-encoder)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/e3b168a4-0572-44b9-b18e-ca2f31dfdc4a-generative-adversarial-text-to-image-synthesis)
