aelnouby / Text-to-Image-Synthesis

Pytorch implementation of Generative Adversarial Text-to-Image Synthesis paper
GNU General Public License v3.0
405 stars 89 forks source link
gans image-generation pytorch text-to-image zero-shot-learning

Text-to-Image-Synthesis

Intoduction

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 [1]). This architecture is based on DCGAN.

Image credits [1]

Requirements

This implementation currently only support running with GPUs.

Implementation details

This implementation follows the Generative Adversarial Text-to-Image Synthesis paper [1], however it works more on training stablization and preventing mode collapses by implementing:

Datasets

We used Caltech-UCSD Birds 200 and Flowers datasets, we converted each dataset (images, text embeddings) to hd5 format.

We used the text embeddings provided by the paper authors

To use this code you can either:

Hd5 file taxonomy `

Usage

Training

`python runtime.py

Arguments:

Results

Generated Images

Text to image synthesis

Text Generated Images
A blood colored pistil collects together with a group of long yellow stamens around the outside
The petals of the flower are narrow and extremely pointy, and consist of shades of yellow, blue
This pale peach flower has a double row of long thin petals with a large brown center and coarse loo
The flower is pink with petals that are soft, and separately arranged around the stamens that has pi
A one petal flower that is white with a cluster of yellow anther filaments in the center

References

[1] Generative Adversarial Text-to-Image Synthesis https://arxiv.org/abs/1605.05396

[2] Improved Techniques for Training GANs https://arxiv.org/abs/1606.03498

[3] Wasserstein GAN https://arxiv.org/abs/1701.07875

[4] Improved Training of Wasserstein GANs https://arxiv.org/pdf/1704.00028.pdf

Other Implementations

  1. https://github.com/reedscot/icml2016 (the authors version)
  2. https://github.com/paarthneekhara/text-to-image (tensorflow)