Giter VIP home page Giter VIP logo

text-to-image-using-gan's Introduction

Text to Image Synthesis Synthesis using Generative Adversarial Networks

Intoduction

This project is mainly inspired from Generative Adversarial Text-to-Image Synthesis paper. We implemented this model using PyTorch. In this model we train a conditional generative adversarial network, conditioned on text captions, to generate images that correspond to the captions. The network architecture is shown below. This architecture is based on DCGAN.

Credits: [1]

Datasets

We used the hdf5 format of these datasets which can be found here for birds_hdf5 and here for flowers_hdf5. These hdf5 datasets were converted from Caltech-UCSD Birds 200 and Oxford Flowers datasets.

We used the text embeddings provided by the paper([1]) authors.

Requirements

  • PyTorch
  • h5py
  • EasyDict
  • PIL
  • Numpy

This implementation only supports running with GPUs.

To install all the dependencies please do:
$ pip install -r requirements.txt

Training

To use this code for training you can:
$ git clone https://github.com/Rakshith-Manandi/text-to-image-using-GAN.git
$ cd ./text-to-image-using-GAN
$ python -u runtime.py

Inputs to the model for training/prediction:

  • dataset: Dataset to use (birds | flowers)
  • split : An integer indicating which split to use (0 : train | 1: valid | 2: test).
  • save_path : Path for saving the models and results
  • pre_trained_disc : Discriminator pre-tranined model path used for intializing training or continuing from a checkpoint.
  • pre_trained_gen Generator pre-tranined model path used for intializing training or continuing from a checkpoint.
  • cls: Boolean flag to indicate whether to train with cls algorithms or not.

Demo

To get a glimpse of the results generated, you can:
First make sure you have installed all the dependencies, as mentioned in Requirements section. Also, make sure you have GPU access.
$ git clone https://github.com/Rakshith-Manandi/text-to-image-using-GAN.git
$ cd ./text-to-image-using-GAN
$ jupyter notebook GAN_demo.ipynb (i.e. open the 'GAN_demo.ipynb' file)

Results

Here are a few examples of the images generated by our model:



References

[1] Generative Adversarial Text-to-Image Synthesis https://arxiv.org/abs/1605.05396
[2] https://github.com/reedscot/icml2016 (the authors version)

text-to-image-using-gan's People

Contributors

deb1993 avatar radiance96 avatar rakshith-manandi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.