This is a pytorch implementation of Generative Adversarial Text-to-Image Synthesis paper, we train a conditional generative adversarial network, conditioned on text descriptions, to generate images that correspond to the description. The network architecture is shown below (Image from ). This architecture is based on DCGAN.
This implementation currently only support running with GPUs.
This implementation follows the Generative Adversarial Text-to-Image Synthesis paper , however it works more on training stablization and preventing mode collapses by implementing:
- Feature matching 
- One sided label smoothing 
- minibatch discrimination  (implemented but not used)
- WGAN 
- WGAN-GP  (implemented but not used)
We used the text embeddings provided by the paper authors
To use this code you can either:
- Use the converted hd5 datasets, birds, flowers
- Convert the data youself
Hd5 file taxonomy `
- split (train | valid | test )
type: GAN archiecture to use
(gan | wgan | vanilla_gan | vanilla_wgan). default =
gan. Vanilla mean not conditional
dataset: Dataset to use
(birds | flowers). default =
split: An integer indicating which split to use
(0 : train | 1: valid | 2: test). default =
lr: The learning rate. default =
diter: Only for WGAN, number of iteration for discriminator for each iteration of the generator. default =
vis_screen: The visdom env name for visualization. default =
save_path: Path for saving the models.
l1_coef: L1 loss coefficient in the generator loss fucntion for gan and vanilla_gan. default=
l2_coef: Feature matching coefficient in the generator loss fucntion for gan and vanilla_gan. default=
pre_trained_disc: Discriminator pre-tranined model path used for intializing training.
pre_trained_genGenerator pre-tranined model path used for intializing training.
batch_size: Batch size. default=
num_workers: Number of dataloader workers used for fetching data. default =
epochs: Number of training epochs. default=
cls: Boolean flag to whether train with cls algorithms or not. default=
Text to image synthesis
 Generative Adversarial Text-to-Image Synthesis https://arxiv.org/abs/1605.05396
 Improved Techniques for Training GANs https://arxiv.org/abs/1606.03498
 Wasserstein GAN https://arxiv.org/abs/1701.07875
 Improved Training of Wasserstein GANs https://arxiv.org/pdf/1704.00028.pdf