Although Generative Adversarial Networks (GANs) have shown remarkable success in various tasks, they still face challenges in generating high quality images. In this paper, we propose Stacked Generative Adversarial Networks (StackGAN) aimed at generating high-resolution photorealistic images. First, we propose a two-stage generative adversarial network architecture, StackGAN-v1, for text-to-image synthesis. The Stage-I GAN sketches primitive shape and colors of the object based on given text description, yielding low-resolution images. The Stage-II GAN takes Stage-I results and text descriptions as inputs, and generates high-resolution images with photo-realistic details. Second, an advanced multi-stage generative adversarial network architecture, StackGAN-v2, is proposed for both conditional and unconditional generative tasks. Our StackGAN-v2 consists of multiple generators and discriminators in a tree-like structure; images at multiple scales corresponding to the same scene are generated from different branches of the tree. StackGAN-v2 shows more stable training behavior than StackGAN-v1 by jointly approximating multiple distributions. Extensive experiments demonstrate that the proposed stacked generative adversarial networks significantly outperform other state-of-the-art methods in generating photo-realistic images.READ FULL TEXT VIEW PDF
Synthesizing high-quality images from text descriptions is a challenging...
Generating images via the generative adversarial network (GAN) has attra...
Generating images from word descriptions is a challenging task. Generati...
In this paper, we propose a novel way to interpret text information by
In this paper, we focus on generating realistic images from text
Taking a photo outside, can we predict the immediate future, e.g.,
Astronomy of the 21st century finds itself with extreme quantities of da...
Generative Adversarial Networks (GANs) were proposed by Goodfellow et al. . In the original setting, GANs are composed of a generator and a discriminator that are trained with competing goals. The generator is trained to generate samples towards the true data distribution to fool the discriminator, while the discriminator is optimized to distinguish between real samples from the true data distribution and fake samples produced by the generator. Recently, GANs have shown great potential in simulating complex data distributions, such as those of texts , images  and videos .
Despite the success, GANs are known to be difficult to train. The training process is usually unstable and sensitive to the choices of hyper-parameters. Several papers argued that the instability is partially due to the disjoint supports of the data distribution and the implied model distribution [42, 2]. This problem is more severe when training GANs to generate high-resolution (e.g., 256256) images because the chance is very low for the image distribution and the model distribution to share supports in a high-dimensional space. Moreover, a common failure phenomenon for GANs training is mode collapse, where many of the generated samples contain the same color or texture pattern.
In order to stabilize the GANs’ training process and improve sample diversity, several methods tried to address the challenges by proposing new network architectures 
, introducing heuristic tricks or modifying the learning objectives [3, 5, 1]. But most of the previous methods are designed to approximate the image distribution at a single scale. Due to the difficulty in directly approximating the high-resolution image data distribution, most previous methods are limited to generating low-resolution images. To circumvent this difficulty, we observe that, real world data, especially natural images, can be modeled at different scales . One can view multi-resolution digitized images as samples from the same continuous image signal with different sampling rates. Henceforth, the distributions of images at multiple discrete scales are related. Apart from multiple distributions of different scales, images coupled with or without auxiliary conditioning variables (e.g
., class labels or text descriptions) can be viewed as conditional distributions or unconditional distributions, which are also related distributions. Motivated by these observations, we argue that GANs can be stably trained to generate high resolution images by breaking the difficult generative task into sub-problems with progressive goals. Thus, we propose Stacked Generative Adversarial Networks (StackGANs) to model a series of low-to-high-dimensional data distributions.
First, we propose a two-stage generative adversarial network, StackGAN-v1, to generate images from text descriptions through a sketch-refinement process . Low-resolution images are first generated by our Stage-i@ GAN. On top of the Stage-i@ GAN, we stack Stage-ii@ GAN to generate high-resolution (e.g., 256256) images. By conditioning on the Stage-i@ result and the text again, Stage-ii@ GAN learns to capture the text information that is omitted by Stage-i@ GAN and draws more details. Further, we propose a novel Conditioning Augmentation (CA) technique to encourage smoothness in the latent conditioning manifold . It allows small random perturbations in the conditioning manifold and increases the diversity of synthesized images.
Second, we propose an advanced multi-stage generative adversarial network architecture, StackGAN-v2, for both conditional and unconditional generative tasks. StackGAN-v2 has multiple generators that share most of their parameters in a tree-like structure. As shown in Fig. 2
, the input to the network can be viewed as the root of the tree, and multi-scale images are generated from different branches of the tree. The generator at the deepest branch has the final goal of generating photo-realistic high-resolution images. Generators at intermediate branches have progressive goals of generating small to large images to help accomplish the final goal. The whole network is jointly trained to approximate different but highly related image distributions at different branches. The positive feedback from modeling one distribution can improve the learning of others. For conditional image generation tasks, our proposed StackGAN-v2 simultaneously approximates the unconditional image-only distribution and the image distribution conditioned on text descriptions. Those two types of distributions are complementary to each other. Moreover, we propose a color-consistency regularization term to guide our generators to generate more coherent samples across different scales. The regularization provides additional constraints to facilitate multi-distribution approximation, which is especially useful in the unconditional setting where there is no instance-wise supervision between the image and the input noise vector.
In summary, the proposed Stacked Generative Adversarial Networks have three major contributions. (i) Our StackGAN-v1 for the first time generates images of 256256 resolution with photo-realistic details from text descriptions. (ii) A new Conditioning Augmentation technique is proposed to stabilize the conditional GANs’ training and also improve the diversity of the generated samples. (iii) Our StackGAN-v2 further improves the quality of generated images and stabilizes the GANs’ training by jointly approximating multiple distributions. In the remainder of this paper, we first discuss related work and preliminaries in section 2 and section 3, respectively. We then introduce our StackGAN-v1  in section 4 and StackGAN-v2 in section 5. In section 6, extensive experiments are conducted to evaluate the proposed methods. Finally, we make conclusions in section 7. The source code for StackGAN-v1 is available at https://github.com/hanzhanggit/StackGAN, and the source code for StackGAN-v2 is available at https://github.com/hanzhanggit/StackGAN-v2.
Generative image modeling is a fundamental problem in computer vision. There has been remarkable progress in this direction with the emergence of deep learning techniques. Variational Autoencoders (VAEs)[21, 37]
formulate the problem with probabilistic graphical models with the goal of maximizing the lower bound of data likelihood. Autoregressive models (e.g., PixelRNN) 
that utilize neural networks to model the conditional distribution of the pixel space have also generated appealing synthetic images. Recently, Generative Adversarial Networks (GANs) have shown promising performance for generating sharper images. But the training instability makes it hard for GANs to generate high-resolution (e.g., 256256) images. A lot of works have been proposed to stabilize the training and improve the image qualities [32, 40, 27, 56, 5, 29].
Built upon these generative models, conditional image generation has also been studied. Most methods utilize simple conditioning variables such as attributes or class labels [52, 45, 7, 31]. There are also works conditioned on images to generate images, including photo editing [4, 57], domain transfer [43, 18]
and super-resolution[42, 23]. However, super-resolution methods [42, 23] can only add limited details to low-resolution images and can not correct large defects. In contrast, the latter stages in our proposed StackGANs can not only add details to low-resolution images generated by earlier stages but also correct defects in them. Recently, several methods have been developed to generate images from unstructured text. Mansimov et al. 
built an AlignDRAW model by learning to estimate alignment between text and the generating canvas. Reedet al.  used conditional PixelCNN to generate images using text descriptions and object location constraints. Nguyen et al.  used an approximate Langevin sampling approach to generate images conditioned on text. However, their sampling approach requires an inefficient iterative optimization process. With conditional GANs, Reed et al.  successfully generated plausible 6464 images for birds and flowers based on text descriptions. Their follow-up work  was able to generate 128128 images by utilizing additional annotations on object part locations.
Given the difficulties in modeling details of natural images, many works have been proposed to use multiple GANs to improve sample quality. Wang et al.  utilized a structure GAN and a style GAN to synthesize images of indoor scenes. Yang et al.  factorized image generation into foreground and background generation with layered recursive GANs. Huang et al.  added several GANs to reconstruct the multi-level representations of a pre-trained discriminative model. But they were unable to generate high resolution images with photo-realistic details. Durugkar et al.  used multiple discriminators along with one generator to increase the chance of the generator receiving effective feedback. However, all discriminators in their framework are trained to approximate the image distribution at a single scale. Some methods [8, 19] follow the same intuition as our work. We all agree that it is beneficial to break the high-resolution image generation task into several easier subtasks to be accomplished in multiple stages. Denton et al.  built a series of GANs within a Laplacian pyramid framework (LAPGANs). At each level of the pyramid, a residual image conditioned on the image of the previous stage is generated and then added back to the input image to produce the input for the next stage. Instead of producing a residual image, our StackGANs directly generate high resolution images that are conditioned on their low-resolution inputs. Concurrent to our work, Kerras et al.  incrementally add more layers in the generator and discriminator for high resolution image generation. The main difference in terms of experimental setting is that they used a more restrained upsampling rule: starting from 44 pixels, their image resolution is increased by a factor of 2 between consecutive image generation stages. Furthermore, although StackGANs, LAPGANs  and Progressive GANs  all put emphasis on adding finer details in higher resolution images, our StackGANs can also correct incoherent artifacts or defects in low resolution results by utilizing an encoder-decoder network before the upsampling layers.
Generative Adversarial Networks (GANs)  are composed of two models that are alternatively trained to compete with each other. The generator is optimized to reproduce the true data distribution by generating images that are difficult for the discriminator to differentiate from real images. Meanwhile, is optimized to distinguish real images and synthetic images generated by . Overall, the training procedure is a minmax two-player game with the following objective function,
where is a real image from the true data distribution , and is a noise vector sampled from the prior distribution (e.g
., uniform or Gaussian distribution). In practice, the generatoris modified to maximize instead of minimizing to mitigate the problem of gradient vanishing . We use this modified non-saturating objective in all our experiments.
To generate high-resolution images with photo-realistic details, we propose a simple yet effective two-stage generative adversarial network, StackGAN-v1. As shown in Fig. 1, it decomposes the text-to-image generative process into two stages. Stage-i@ GAN sketches the primitive shape and basic colors of the object conditioned on the given text description, and draws the background layout from a random noise vector, yielding a low-resolution image. Stage-ii@ GAN corrects defects in the low-resolution image from Stage-I and completes details of the object by reading the text description again, producing a high-resolution photo-realistic image.
As shown in Fig. 1, the text description is first encoded by an encoder, yielding a text embedding . In previous works [35, 33], the text embedding is nonlinearly transformed to generate conditioning latent variables as the input of the generator. However, latent space for the text embedding is usually high dimensional ( dimensions). With limited amount of data, it usually causes discontinuity in the latent data manifold, which is not desirable for learning the generator. To mitigate this problem, we introduce a Conditioning Augmentation technique to produce additional conditioning variables . In contrast to the fixed conditioning text variable in [35, 33], we randomly sample the latent variables from an independent Gaussian distribution , where the mean and diagonal covariance matrix are functions of the text embedding . The proposed Conditioning Augmentation yields more training pairs given a small number of image-text pairs, and thus encourages robustness to small perturbations along the conditioning manifold. To further enforce the smoothness over the conditioning manifold and avoid overfitting [9, 22], we add the following regularization term to the objective of the generator during training,
which is the Kullback-Leibler divergence (KL divergence) between the standard Gaussian distribution and the conditioning Gaussian distribution. The randomness introduced in the Conditioning Augmentation is beneficial for modeling text to image translation as the same sentence usually corresponds to objects with various poses and appearances.
Instead of directly generating a high-resolution image conditioned on the text description, we simplify the task to first generate a low-resolution image with our Stage-i@ GAN, which focuses on drawing only rough shape and correct colors for the object.
Let be the text embedding of the given description. The Gaussian conditioning variables for text embedding are sampled from to capture the meaning of with variations. Conditioned on
and random variable, Stage-i@ GAN trains the discriminator and the generator by alternatively maximizing in Eq. (3) and minimizing in Eq. (4),
where the real image and the text description are from the true data distribution . is a noise vector randomly sampled from a given distribution (Gaussian distribution in this paper). is a regularization parameter that balances the two terms in Eq. (4). We set for all our experiments. Using the reparameterization trick introduced in , both and are learned jointly with the rest of the network. To extract a visually-discriminative text embedding of the given description, we follow the approach of Reed et al.  to pre-train a text encoder. It is a character level CNN-RNN model that maps text descriptions to the common feature space of images by learning a correspondence function between texts with images .
Model Architecture. For the generator , to obtain text conditioning variable , the text embedding is first fed into a fully connected layer to generate and ( are the values in the diagonal of ) for the Gaussian distribution . are then sampled from the Gaussian distribution. Our dimensional conditioning vector is computed by (where is the element-wise multiplication, ). Then, is concatenated with a dimensional noise vector to generate a image by a series of up-sampling blocks.
For the discriminator , the text embedding is first compressed to dimensions using a fully-connected layer and then spatially replicated to form a tensor. Meanwhile, the image is fed through a series of down-sampling blocks until it has spatial dimension. Then, the image filter map is concatenated along the channel dimension with the text tensor. The resulting tensor is further fed to a 11 convolutional layer to jointly learn features across the image and the text. Finally, a fully-connected layer with one node is used to produce the decision score.
Low-resolution images generated by Stage-i@ GAN usually lack vivid object parts and might contain shape distortions. Some details in the text might also be omitted in the first stage, which is vital for generating photo-realistic images. Our Stage-ii@ GAN is built upon Stage-i@ GAN results to generate high-resolution images. It is conditioned on low-resolution images and also the text embedding again to correct defects in Stage-i@ results. The Stage-ii@ GAN completes previously ignored text information to generate more photo-realistic details.
Conditioning on the low-resolution result and Gaussian latent variables , the discriminator and generator in Stage-ii@ GAN are trained by alternatively maximizing in Eq. (5) and minimizing in Eq. (6),
Different from the original formulation of GANs, the random noise is not used in this stage with the assumption that the randomness has already been preserved by . Gaussian conditioning variables used in this stage and used in Stage-i@ GAN share the same pre-trained text encoder, generating the same text embedding
. However, Stage-I and Stage-II Conditioning Augmentation have different fully connected layers for generating different means and standard deviations. In this way, Stage-ii@ GAN learns to capture useful information in the text embedding that is omitted by Stage-i@ GAN.
Model Architecture. We design Stage-ii@ generator as an encoder-decoder network with residual blocks . Similar to the previous stage, the text embedding is used to generate the dimensional text conditioning vector , which is spatially replicated to form a tensor. Meanwhile, the Stage-i@ result generated by Stage-i@ GAN is fed into several down-sampling blocks (i.e., encoder) until it has a spatial size of . The image features and the text features are concatenated along the channel dimension. The encoded image features coupled with text features are fed into several residual blocks, which are designed to learn multi-modal representations across image and text features. Finally, a series of up-sampling layers (i.e., decoder) are used to generate a high-resolution image. Such a generator is able to help rectify defects in the input image while add more details to generate the realistic high-resolution image.
For the discriminator, its structure is similar to that of Stage-i@ discriminator with only extra down-sampling blocks since the image size is larger in this stage. To explicitly enforce GANs to learn better alignment between the image and the conditioning text, rather than using the vanilla discriminator, we adopt the matching-aware discriminator proposed by Reed et al.  for both stages. During training, the discriminator takes real images and their corresponding text descriptions as positive sample pairs, whereas negative sample pairs consist of two groups. The first is real images with mismatched text embeddings, while the second is synthetic images with their corresponding text embeddings.
The up-sampling blocks consist of the nearest-neighbor upsampling followed by a 317]
and ReLU activation are applied after every convolution except the last one. The residual blocks consist of 33 stride 1 convolutions, Batch normalization and ReLU. Two residual blocks are used in 128128 StackGAN-v1 models while four are used in 256256 models. The down-sampling blocks consist of 44 stride 2 convolutions, Batch normalization and LeakyReLU, except that the first one does not have Batch normalization.
By default, , , , , , and . For training, we first iteratively train and
of Stage-i@ GAN for 600 epochs by fixing Stage-ii@ GAN. Then we iteratively trainand of Stage-ii@ GAN for another 600 epochs by fixing Stage-i@ GAN. All networks are trained using ADAM  solver with . The batch size is 64, and the learning rate is initialized to be 0.0002 and decayed to of its previous value every 100 epochs. The source code for StackGAN-v1 is available at https://github.com/hanzhanggit/StackGAN for more implementation details.
As discussed above, our StackGAN-v1 has two separate networks, Stage-I GAN and Stage-II GAN, to model low-to-high resolution image distributions. To make the framework more general, in this paper, we propose a new end-to-end network, StackGAN-v2, to model a series of multi-scale image distributions. As shown in Fig. 2, StackGAN-v2 consists of multiple generators (s) and discriminators (
s) in a tree-like structure. Images from low-resolution to high-resolution are generated from different branches of the tree. At each branch, the generator captures the image distribution at that scale and the discriminator estimates the probability that a sample came from training images of that scale rather than the generator. The generators are jointly trained to approximate the multiple distributions, and the generators and discriminators are trained in an alternating fashion. In this section, we explore two types of multi-distributions: (1) multi-scale image distributions; and (2) joint conditional and unconditional image distributions.
Our StackGAN-v2 framework has a tree-like structure, which takes a noise vector as the input and has multiple generators to produce images of different scales. The
is a prior distribution, which is usually chosen as the standard normal distribution. The latent variablesare transformed to hidden features layer by layer. We compute the hidden features for each generator
by a non-linear transformation,
where represents hidden features for the branch, is the total number of branches, and are modeled as neural networks (see Fig. 2 for illustration). In order to capture information omitted in preceding branches, the noise vector is concatenated to the hidden features as the inputs of for calculating . Based on hidden features at different layers (, , …, ), generators produce samples of small-to-large scales (, , …, ),
where is the generator for the branch.
Following each generator , a discriminator , which takes a real image or a fake sample
as input, is trained to classify inputs into two classes (real or fake) by minimizing the following cross-entropy loss,
where is from the true image distribution at the scale, and is from the model distribution at the same scale. The multiple discriminators are trained in parallel, and each of them focuses on a single image scale.
Guided by the trained discriminators, the generators are optimized to jointly approximate multi-scale image distributions (
) by minimizing the following loss function,
where is the loss function for approximating the image distribution at the scale (i.e., ). During the training process, the discriminators and the generators are alternately optimized till convergence.
The motivation of the proposed StackGAN-v2 is that, by modeling data distributions at multiple scales, if any one of those model distributions shares support with the real data distribution at that scale, the overlap could provide good gradient signal to expedite or stabilize training of the whole network at multiple scales. For instance, approximating the low-resolution image distribution at the first branch results in images with basic color and structures. Then the generators at the subsequent branches can focus on completing details for generating higher resolution images.
For unconditional image generation, discriminators in StackGAN-v2 are trained to distinguish real images from fake ones. To handle conditional image generation, conventionally, images and their corresponding conditioning variables are input into the discriminator to determine whether an image-condition pair matches or not, which guides the generator to approximate the conditional image distribution. We propose conditional StackGAN-v2 that jointly approximates conditional and unconditional image distributions.
For the generator of our conditional StackGAN-v2, and are converted to take the conditioning vector as input, such that and . For , the conditioning vector replaces the noise vector to encourage the generators to draw images with more details according to the conditioning variables. Consequently, multi-scale samples are now generated by . The objective function of training the discriminator for conditional StackGAN-v2 now consists of two terms, the unconditional loss and the conditional loss,
The unconditional loss determines whether the image is real or fake while the conditional one determines whether the image and the condition match or not. Accordingly, the loss function for each generator is converted to
The generator at each scale therefore jointly approximates unconditional and conditional image distributions. The final loss for jointly training generators of conditional StackGAN-v2 is computed by substituting Eq. (12) into Eq. (10).
As we increase the image resolution at different generators, the generated images at different scales should share similar basic structure and colors. A color-consistency regularization term is introduced to keep samples generated from the same input at different generators more consistent in color and thus to improve the quality of the generated images.
Let represent a pixel in a generated image, then the mean and covariance of pixels of the given image can be defined by and , where is the number of pixels in the image. The color-consistency regularization term aims at minimizing the differences of and between different scales to encourage the consistency, which is defined as
where is the batch size, and are mean and covariance for the sample generated by the generator. Empirically, we set and by default. For the input vector, multi-scale samples , , …, are generated from generators of StackGAN-v2. can be added to the loss function of the generator defined in Eq. (10) or Eq. (12), where . Therefore, the final loss for training the generator is defined as . Experimental results indicate that the color-consistency regularization is very important (e.g., in this paper) for the unconditional task, while it is not needed () for the text-to-image synthesis task which has a stronger constraint, i.e., the instance-wise correspondence between images and text descriptions.
|Dataset||CUB ||Oxford-102 ||COCO ||LSUN ||ImageNet |
|GAN-INT-CLS||GAWWN||Our StackGAN-v1||GAN-INT-CLS||Our StackGAN-v1||GAN-INT-CLS||Our StackGAN-v1|
|IS||2.88 .04||3.62 .07||3.70 .04||2.66 .03||3.20 .01||7.88 .07||8.45 .03|
|IS*||2.88 .04||3.10 .03||3.02 .03||2.66 .03||2.73 .03||7.88 .07||8.35 .11|
|HR||2.76 .01||1.95 .02||1.29 .02||1.84 .02||1.16 .02||1.82 .03||1.18 .03|
|IS||StackGAN-v1||3.70 .04||3.20 .01||8.45 .03||3.59 .05||2.87 .05||8.84 .08||4.77 .06|
|StackGAN-v2||4.04 .05||3.26 .01||8.30 .10||3.02 .04||2.38 .03||9.55 .11||4.23 .05|
|HR||StackGAN-v1||1.81 .02||1.70 .03||1.45 .04||1.95 .01||1.86 .02||1.90 .01||1.88 .02|
|StackGAN-v2||1.19 .02||1.30 .03||1.55 .05||1.05 .01||1.14 .02||1.10 .01||1.12 .02|
As shown in Fig. 2, our StackGAN-v2 models are designed to generate 256256 images. The input vector (i.e., for unconditional StackGAN-v2, or the concatenated and 111The conditioning variable for StackGAN-v2 is also generated by Conditioning Augmentation for conditional StackGAN-v2) is first transformed to a 4464 feature tensor, where is the number of channels in the tensor. Then, this 4464 tensor is gradually transformed to 64644, 1281282, and eventually 2562561 tensors at different layers of the network by six up-sampling blocks. The intermediate 64644, 1281282, and 2562561 features are used to generate images of corresponding scales with 33 convolutions. Conditioning variables or unconditional variables are also directly fed into intermediate layers of the network to ensure encoded information in or is not omitted. All the discriminators have down-sampling blocks and 33 convolutions to transform the input image to a 448
tensor, and eventually the sigmoid function is used for outputting probabilities. For all datasets, we set, and use two residual blocks between every two generators. ADAM  solver with and a learning rate of 0.0002 is used for all models. The source code for StackGAN-v2 is available at https://github.com/hanzhanggit/StackGAN-v2 for more implementation details.
We conduct extensive experiments to evaluate the proposed methods. In section 6.1, several state-of-the-art methods on text-to-image synthesis and on unconditional image synthesis are compared with the proposed methods. We first evaluate the effectiveness of our StackGAN-v1 for text-to-image synthesis by comparing it with GAWWN  and GAN-INT-CLS . And then, StackGAN-v2 is compared with StackGAN-v1 on different datasets to show its advantages and limitations. Moreover, StackGAN-v2 as a more general framework also works well on unconditional image synthesis tasks, and on such tasks, it is compared with several state-of-the-art methods [32, 56, 3, 26, 13]. In section 6.2, several baseline models are designed to investigate the overall design and important components of our StackGAN-v1. For the first baseline, we directly train Stage-i@ GAN for generating 6464 and 256256 images to investigate whether the proposed two-stage stacked structure and the Conditioning Augmentation are beneficial. Then we modify our StackGAN-v1 to generate 128128 and 256256 images to investigate whether larger images by our method can result in higher image quality. We also investigate whether inputting text at both stages of StackGAN-v1 is useful. In section 6.3, experiments are designed to validate important components of our StackGAN-v2, including designs with fewer multi-scale image distributions, the effect of jointly approximating conditional and unconditional distributions, and the effectiveness of the proposed color-consistency regularization.
Datasets. We evaluate our conditional StackGAN for text-to-image synthesis on the CUB , Oxford-102  and COCO  datasets. CUB  contains 200 bird species with 11,788 images. Since 80% of birds in this dataset have object-image size ratios of less than 0.5 , as a pre-processing step, we crop all images to ensure that bounding boxes of birds have greater-than-0.75 object-image size ratios. Oxford-102  contains 8,189 images of flowers from 102 different categories. To show the generalization capability of our approach, a more challenging dataset, COCO  is also utilized for evaluation. Different from CUB and Oxford-102, the COCO dataset contains images with multiple objects and various backgrounds. Each image in COCO has 5 descriptions, while 10 descriptions are provided by  for every image in CUB and Oxford-102 datasets. Following the experimental setup in , we directly use the training and validation sets provided by COCO, meanwhile we split CUB and Oxford-102 into class-disjoint training and test sets. Our unconditional StackGAN utilizes bedroom and church sub-sets of LSUN , a dog-breed 222Using the wordNet IDs provided by Vinyals et al.,  and a cat-breed 333The wordNet IDs for this dataset: ’n02121808’, ’n02124075’, ’n02123394’, ’n02122298’, ’n02123159’,’n02123478’, ’n02122725’, ’n02123597’, ’n02124484’, ’n02124157’, ’n02122878’, ’n02123917’, ’n02122510’, ’n02124313’, ’n02123045’, ’n02123242’, ’n02122430’. sub-sets of ImageNet  to synthesize different types of images. The statistics of datasets are presented in TABLE I.
Evaluation metrics. It is difficult to evaluate the performance of generative models (e.g., GANs). In this paper, we choose inception score (IS)  and fréchet inception distance (FID)  for quantitative evaluation. Inception score (IS)  is the first well-known metric for evaluating GANs. where denotes one generated sample, and is the label predicted by the inception model 444In our experiments, for fine-grained datasets, CUB and Oxford-102, we fine-tune an inception model for each of them. For other datasets, we directly use the pre-trained inception model.. The intuition behind this metric is that good models should generate diverse but meaningful images. Therefore, the KL divergence between the marginal distribution and the conditional distribution should be large. As suggested in , we compute the inception score on a large number of samples (i.e., 30k samples randomly generated for the test set) for each model555The mean and standard derivation inception scores of ten splits are reported..
Fréchet inception distance (FID)  was recently proposed as a metric that considers not only the synthetic data distribution but also how it compares to the real data distribution. It directly measures the distance between the synthetic data distribution and the real data distribution . In practice, images are encoded with visual features by the inception model. Assuming the feature embeddings follow a multidimensional Gaussian distribution, the synthetic data’s Gaussian with mean and covariance is obtained from and the real data’s Gaussian with mean and covariance is obtained from . The difference between the synthetic and real Gaussians is measured by the Fréchet distance, i.e., . Lower FID values mean closer distances between synthetic and real data distributions. To compute the FID score for a unconditional model, 30k samples are randomly generated. To compute the FID score for a text-to-image model, all sentences in the corresponding test set are utilized to generate samples.
To better evaluate the proposed methods, especially to see whether the generated images are well conditioned on the given text descriptions, we also conduct user studies. We randomly select 50 text descriptions for each class of CUB and Oxford-102 test sets. For COCO dataset, 4k text descriptions are randomly selected from its validation set. For each sentence, 5 images are generated by each model. Given the same text descriptions, 30 users (not including any of the authors) are asked to rank the results by different methods. The average ranks by human users are calculated to evaluate all compared methods.
In addition, we use t-SNE  embedding method to visualize a large number (e.g., 30k on the CUB test set) of high-dimensional images in a two-dimensional map. We observe that t-SNE is a good tool to examine the distribution of synthesized images and identify collapsed modes.
|[5pt](a) StackGAN-v1 has two collapsed modes (in red rectangles).||[5pt](b) StackGAN-v2 contains no collapsed nonsensical mode.|
|[3pt] 6464 samples by DCGAN (Reported in )||[3pt] 6464 samples by WGAN (Reported in )|
|[3pt] 6464 samples by EBGAN-PT (Reported in )||[3pt] 112112 samples by LSGAN (Reported in )|
|[3pt] 128128 samples by WGAN-GP (Reported in )||[3pt] 256256 samples by our StackGAN-v1|
|[3pt] 256256 samples by our StackGAN-v2|
|[3pt] 256256 samples by EBGAN-PT (Reported in )||[3pt] 256256 samples by our StackGAN-v1|
|[3pt] 256256 samples by our StackGAN-v2|
Text-to-image synthesis. We compare our StackGAN models with several state-of-the-art text-to-image methods [33, 35] on CUB, Oxford-102 and COCO datasets. The inception scores, fréchet inception distances and average human ranks for the proposed StackGAN models and compared methods are reported in TABLE III. Representative examples are compared in Fig. 3, Fig. 4. For meaningful and fair comparisons with previous methods, the inception scores (IS/IS*) and fréchet inception distances (FID/FID*) are computed in two settings. In the first setting, 256256 images produced by StackGAN, 128128 images generated by GAWWN  and 6464 images yielded by GAN-INT-CLS  are used directly to compute IS and FID. Thus, in this setting, the different models are compared directly using their generated images, which have different resolutions. In the second setting, before computing IS* and FID*, all generated images are re-sized to the same resolution of 6464 for fair comparison.
Compared with previous GAN models [35, 33], on the text-to-image synthesis task, our StackGAN-v1 model achieves the best FID*, IS and average human rank on all three datasets. As shown in TABLE III, compared with GAN-INT-CLS 
, StackGAN-v1 achieves 28.47% improvement in terms of inception score (IS) on CUB dataset (from 2.88 to 3.70), and 20.30% improvement on Oxford-102 (from 2.66 to 3.20). When we compare images of different models at the same resolution of 6464, our StackGAN-v1 still achieves higher inception scores (IS*) than GAN-INT-CLS, but produces a slightly worse inception score (IS*) than GAAWN  because GAWWN uses additional supervision. Meanwhile, the FID* of StackGAN-v1 is nearly one half of the FID* of GAN-INT-CLS on each dataset. It means that the StackGAN-v1 can better model and estimate the 6464 image distribution. As comparison, the FID of StackGAN-v1 is higher than that of GAN-INT-CLS  on COCO. The reason is that the FID of GAN-INT-CLS is the distance between two 6464 image distributions while the FID of StackGAN-v1 is the distance between two 256256 image distributions. It is clear that estimating the 6464 image distribution is much easier than estimating the 256256 image distribution. It is also the reason why the FID is higher than the FID* for the same model. Finally, the better average human rank of our StackGAN-v1 also indicates our proposed method is able to generate more realistic samples conditioned on text descriptions. On the other hand, representative examples are shown in Fig. 3 and Fig. 4 for visualization comparison. As shown in Fig. 3, the 6464 samples generated by GAN-INT-CLS  can only reflect the general shape and color of the birds. Their results lack vivid parts (e.g., beak and legs) and convincing details in most cases, which make them neither realistic enough nor have sufficiently high resolution. By using additional conditioning variables on location constraints, GAWWN  obtains a better inception score on CUB dataset, which is still slightly lower than ours. It generates higher resolution images with more details than GAN-INT-CLS, as shown in Fig. 3. However, as mentioned by its authors, GAWWN fails to generate any plausible images when it is only conditioned on text descriptions . In comparison, our StackGAN-v1 for the first time generates images of 256256 resolution with photo-realistic details from only text descriptions.
Comparison between StackGAN-v1 and StackGAN-v2. The comparison between StackGAN-v1 and StackGAN-v2 by different quantitative metrics as well as human evaluations are reported in TABLE III. For unconditional generation, the samples generated by StackGAN-v2 are consistently better than those by StackGAN-v1 (last four columns in TABLE 3) from a human perspective. The end-to-end training scheme together with the color-consistency regularization enables StackGAN-v2 to produce more feedback and regularization for each branch so that consistency is better maintained during the multi-step generation process. This is especially useful for unconditional generation as no extra conditions (e.g., text) are applied. On the text-to-image datasets, the scores are mixed for StackGAN-v1 and StackGAN-v2. The reason is partially due to the fact that the text information, which is a strong constraint, is added in all the stages to keep coherence. The comparison results of FIDs are consistent with the comparison results of human ranks on all datasets. On the other hand, the inception score draws different conclusions on LSUN-bedroom, LSUN-church, and ImageNet-cat. We think that the reason is because the inception model is pre-trained on ImageNet with 1000 classes, which makes it less suitable for class-specific datasets. Compared with ImageNet-cat which has 17 classes, the inception score for ImageNet-dog correlates better with human ranks because ImageNet-dog covers more (i.e. 118) classes from ImageNet. Hence we believe that, using class-specific datasets, it is more reasonable to use FID to directly compare feature distances between generated samples with that of the real world samples .
For visual comparison of the results by the two models, we utilize the t-SNE  algorithm. For each model, a large number of images are generated and embedded into the 2D plane. We first extract a 2048d CNN feature from each generated image using a pre-trained Inception model. Then, t-SNE algorithm is applied to embed the CNN features into a 2D plane, resulting a location for each image in the 2D plane. Due to page limits, Fig. 5 only shows a 5050 grid with compressed images for each dataset, where each generated image is mapped to its nearest grid location. By visualizing a large number of images, the t-SNE is a good tool to examine the synthesized distribution and evaluate its diversity. We also follow  to use the multiscale structural similarity (MS-SSIM)  as a metric to measure the variability of samples. We observe that the MS-SSIM is useful to find large-scale mode collapses but often fails to detect small-scale mode collapses or fails to measure the loss of variation in the generated samples’ color or texture. This observation is consistent with the one found in . For example, in Fig 5, StackGAN-v1 has two small collapsed modes (nonsensical images) while StackGAN-v2 does not have any collapsed nonsensical mode. However, the MS-SSIM score of StackGAN-v1 (0.0945) is better than that of StackGAN-v2 (0.1311) and even better than that of the real data (0.1007). Thus, we argue that the MS-SSIM is not a good metric to capture small-scale mode collapses. On the contrary, the t-SNE visualization of the generated samples can easily help us identify any collapsed modes in the samples as well as evaluate sample variability in texture, color and viewpoint.
More visual comparison of StackGAN-v1 and StackGAN-v2 on different datasets can be found in Fig 3, Fig 4, Fig 6, Fig 8, Fig 8, and Fig. 9. Specially, Fig. 9 illustrates failure cases of StackGAN-v1 and StackGAN-v2. We categorize the failures in these cases into three groups: mild, moderate, and severe. The “mild” group means that the generated images have smooth and coherent appearance but lack vivid objects. The “moderate” group means that the generated images have obvious artifacts, which usually are signs of mode collapse. The “severe” group indicates that the generated images fall into collapsed modes. Based on such criterion, on the simple dataset, Oxford-102, all failure cases of StackGAN-v1 belong to the “mild” group, while on other datasets all three groups of failure cases are observed. As comparison, we observe that all failure cases of StackGAN-v2 belong to the “mild” group, meaning StackGAN-v2-generated images have no collapsed nonsensical mode (see Fig. 5). By jointly optimizing multiple distributions (objectives), StackGAN-v2 shows more stable training behavior and results in better FID and inception scores on most datasets (see TABLE III). However, because of the same reason, compared with StackGAN-v1, it is harder for StackGAN-v2 to converge on more complex datasets, such as COCO. In contrast, StackGAN-v1 optimizes sub-tasks separately by training stage by stage. It produces slightly more appealing images on COCO than StackGAN-v2 based on human rank results, but also generates more images that are moderate or severe failure cases. Consequently, while StackGAN-v2 is more advanced than StackGAN-v1 in many aspects (such as end-to-end training and more stable training behavior), StackGAN-v1 has the advantage of stage-by-stage training, which converges faster and requires less GPU memory.
Unconditional image synthesis. We evaluate the effectiveness of StackGAN-v2 for the unconditional image generation task by comparing it with DCGAN , WGAN , EBGAN-PT , LSGAN , and WGAN-GP  on the LSUN bedroom dataset. As shown in Fig. 6, our StackGAN-v2 is able to generate 256256 images with more photo-realistic details. In Fig. 8, we also compare the 256256 samples generated by StackGAN-v2 and EBGAN-PT. As shown in the figure, the samples generated by the two methods have the same resolution, but StackGAN-v2 generates more realistic ones (e.g., more recognizable dog faces with eyes and noses). While on LSUN bedroom dataset, only qualitative results are reported in [32, 3, 56, 26, 13], a DCGAN model  is trained for quantitative comparison using the public available source code 666https://github.com/carpedm20/DCGAN-tensorflow on the ImageNet Dog dataset. The inception score of DCGAN is 8.19 0.11 which is much lower than the inception achieved by our StackGAN-v2 (9.55 0.11). These experiments demonstrate that our StackGAN-v2 outperforms the state-of-the-art methods for unconditional image generation. Example images generated by StackGAN on LSUN church and ImageNet cat datasets are presented in Fig. 8.
|Method||CA||Text twice||Inception score|
|6464 Stage-i@ GAN||no||/||2.66 .03|
|256256 Stage-i@ GAN||no||/||2.48 .00|
|128128 StackGAN-v1||yes||no||3.13 .03|
|256256 StackGAN-v1||yes||no||3.45 .02|
In this section, we analyze different components of StackGAN-v1 on CUB dataset with baseline models.
The design of StackGAN-v1. As shown in the first four rows of TABLE IV, if Stage-I GAN is directly used to generate images, the inception scores decrease significantly. Such performance drop can be well illustrated by results in Fig. 11. As shown in the first row of Fig. 11, Stage-i@ GAN fails to generate any plausible 256256 samples without using Conditioning Augmentation (CA). Although Stage-i@ GAN with CA is able to generate more diverse 256256 samples, those samples are not as realistic as samples generated by StackGAN-v1. It demonstrates the necessity of the proposed stacked structure. In addition, by decreasing the output resolution from 256256 to 128128, the inception score decreases from 3.70 to 3.35. Note that all images are scaled to 299 299 before calculating the inception score. Thus, if our StackGAN-v1 just increases the image size without adding more information, the inception score would remain the same for samples of different resolutions. Therefore, the decrease in inception score by 128128 StackGAN-v1 demonstrates that our 256256 StackGAN-v1 does add more details into the larger images. For the 256256 StackGAN-v1, if the text is only input to Stage-I (denoted as “no Text twice”), the inception score decreases from 3.70 to 3.45. It indicates that processing text descriptions again at Stage-II helps refine Stage-I results. The same conclusion can be drawn from the results of 128128 StackGAN-v1 models.
Fig. 10 illustrates some examples of the Stage-I and Stage-II images generated by our StackGAN-v1. As shown in the first row of Fig. 10, in most cases, Stage-i@ GAN is able to draw rough shapes and colors of objects given text descriptions. However, Stage-i@ images are usually blurry with various defects and missing details, especially for foreground objects. As shown in the second row, Stage-ii@ GAN generates 4 higher resolution images with more convincing details to better reflect corresponding text descriptions. For cases where Stage-i@ GAN has generated plausible shapes and colors, Stage-ii@ GAN completes the details. For instance, in the st column of Fig. 10, with a satisfactory Stage-i@ result, Stage-ii@ GAN focuses on drawing the short beak and white color described in the text as well as details for the tail and legs. In all other examples, different degrees of details are added to Stage-ii@ images. In many other cases, Stage-ii@ GAN is able to correct the defects of Stage-i@ results by processing the text description again. For example, while the Stage-i@ image in the th column has a blue crown rather than the reddish brown crown described in the text, the defect is corrected by Stage-ii@ GAN. In some extreme cases (e.g., the th column of Fig. 10), even when Stage-i@ GAN fails to draw a plausible shape, Stage-ii@ GAN is able to generate reasonable objects. We also observe that StackGAN-v1 has the ability to transfer background from Stage-i@ images and fine-tune them to be more realistic with higher resolution at Stage-ii@.
Importantly, the StackGAN-v1 does not achieve good results by simply memorizing training samples but by capturing the complex underlying language-image relations. By feeding our generated images and all training images to the Stage-II discriminator of our StackGAN-v1, their visual features are extracted from the last Conv. layer of . And then, we can compute the similarity between two images, based on their visual features. Finally, for each generated image, its nearest neighbors from the training set can be retrieved. By visually inspecting the retrieved images (see Fig. 12), we conclude that the generated images have some similar characteristics with the training samples but are essentially different.
Conditioning Augmentation. We also investigate the efficacy of the proposed Conditioning Augmentation (CA). By removing it from StackGAN-v1 256256 (denoted as “no CA” in TABLE IV), the inception score decreases from 3.70 to 3.31. Fig. 11 also shows that 256256 Stage-i@ GAN (and StackGAN-v1) with CA can generate birds with different poses and viewpoints from the same text embedding. In contrast, without using CA, samples generated by 256256 Stage-i@ GAN collapse to nonsensical images due to the unstable training dynamics of GANs. Consequently, the proposed Conditioning Augmentation helps stabilize the conditional GAN training and improves the diversity of the generated samples because of its ability to encourage robustness to small perturbations along the latent manifold.
Sentence embedding interpolation. To further demonstrate that our StackGAN-v1 learns a smooth latent data manifold, we use it to generate images from linearly interpolated sentence embeddings, as shown in Fig. 13. We fix the noise vector , so the generated image is inferred from the given text description only. Images in the first row are generated by simple sentences made up by us. Those sentences contain only simple color descriptions. The results show that the generated images from interpolated embeddings can accurately reflect color changes and generate plausible bird shapes. The second row illustrates samples generated from more complex sentences, which contain more details on bird appearances. The generated images change their primary color from red to blue, and change the wing color from black to brown.
|StackGAN-v2-3||removed||removed||three 256256||yes||3.22 .02|
|[5pt] (a) StackGAN-v2-all256||[5pt] (b) StackGAN-v2-||[5pt] (c) StackGAN-v2-3||[5pt] (d) StackGAN-v2|
|This black and white and grey bird has a black bandit marking around it’s eyes|
|[5pt] (e) StackGAN-v2-all256||[5pt] (f) StackGAN-v2-||[5pt] (g) StackGAN-v2-no-JCU||[5pt] (h) StackGAN-v2|
|[3pt] ImageNet dog ||[3pt] ImageNet cat ||[3pt] LSUN church |
In this section, we analyze important components of the proposed StackGAN-v2. TABLE V lists models with different settings and their inception scores on the CUB test set. Fig. 14 shows example images generated by different baseline models.
Our baseline models are built by removing or changing a certain component of the StackGAN-v2 model. By approximating the image distribution directly at the 256256 scale without intermediate branches, the inception scores on CUB dramatically decrease from 4.04 to 3.49 for “StackGAN-v2-” and to 2.89 for “StackGAN-v2-all256” (See TABLE V and Figures 14 (e-f)). This demonstrates the importance of the multi-scale, multi-stage architecture in StackGAN-v2. Inspired by , we also build a baseline model with multiple discriminators at the 256256 scale, namely “StackGAN-v2-3”. Those discriminators have the same structure but different initializations. However, the results do not show improvement over “StackGAN-v2-”. Similar comparisons have also been done for the unconditional task on the LSUN bedroom dataset. As shown in Figures 14(a-c), those baseline models fail to generate realistic images because they suffer from severe mode collapses.
To further demonstrate the effectiveness of jointly approximating conditional and unconditional distributions, “StackGAN-v2-no-JCU” replaces the jointly conditional and unconditional discriminators with the conventional ones, resulting in much lower inception score than that of “StackGAN-v2”. Another baseline model does not use the color-consistency regularization term. Results on various datasets (see Fig. 15) show that the color-consistency regularization has significant positive effects for the unconditional image synthesis task. Quantitatively, removing the color-consistency regularization decreases the inception score from 9.55 0.11 to 9.02 0.14 on the ImageNet dog dataset. It demonstrates that the additional constraint provided by the color-consistency regularization is able to facilitate multi-distribution approximation and help generators at different branches produce more coherent samples. It is worth mentioning that there is no need to utilize the color-consistency regularization for the text-to-image synthesis task because the text conditioning appears to provide sufficient constraints. Experimentally, adding the color-consistency regularization did not improve the inception score on CUB dataset.
In this paper, Stacked Generative Adversarial Networks, StackGAN-v1 and StackGAN-v2, are proposed to decompose the difficult problem of generating realistic high-resolution images into more manageable sub-problems. The StackGAN-v1 with Conditioning Augmentation is first proposed for text-to-image synthesis through a novel sketch-refinement process. It succeeds in generating images of 256256 resolution with photo-realistic details from text descriptions. To further improve the quality of generated samples and stabilize GANs’ training, the StackGAN-v2 jointly approximates multiple related distributions, including (1) multi-scale image distributions and (2) jointly conditional and unconditional image distributions. In addition, a color-consistency regularization is proposed to facilitate multi-distribution approximation. Extensive quantitative and qualitative results demonstrate that our proposed methods significantly improve the state of the art in both conditional and unconditional image generation tasks.
Stochastic backpropagation and approximate inference in deep generative models.In ICML, 2014.
Pixel recurrent neural networks.In ICML, 2016.
Journal of Machine Learning Research, 9: 2579–2605, Nov 2008.