Giter VIP home page Giter VIP logo

gan-int-cls's Introduction

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.

Datasets

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

Hd5 file taxonomy `

  • split (train | valid | test )
    • example_name
      • 'name'
      • 'img'
      • 'embeddings'
      • 'class'
      • 'txt'

Usage

Prerequisites

Python 3.10

pip install -r requirements.txt

Datasets

  1. Download and extract the birds and flowers and COCO caption data in Torch format.
  2. Download and extract the birds and flowers and COCO Text encoding.
  3. Download and extract the birds and flowers and COCO image data.
  4. Use convert_cub_to_hd5_script or convert_flowers_to_hd5_script script to convert the dataset.

Training

`python runtime.py --ds

Arguments:

  • type : GAN archiecture to use (gan | wgan | vanilla_gan | vanilla_wgan). default = gan. Vanilla mean not conditional
  • dataset: Dataset to use (birds | flowers). default = flowers
  • split : An integer indicating which split to use (0 : train | 1: valid | 2: test). default = 0
  • lr : The learning rate. default = 0.0002
  • diter : Only for WGAN, number of iteration for discriminator for each iteration of the generator. default = 5
  • save_path : Path for saving the models.
  • l1_coef : L1 loss coefficient in the generator loss fucntion for gan and vanilla_gan. default=50
  • l2_coef : Feature matching coefficient in the generator loss fucntion for gan and vanilla_gan. default=100
  • pre_trained_disc : Discriminator pre-tranined model path used for intializing training.
  • pre_trained_gen Generator pre-tranined model path used for intializing training.
  • batch_size: Batch size. default = 64
  • num_workers: Number of dataloader workers used for fetching data. default = 8
  • epochs : Number of training epochs. default=200
  • eval_batch_size : Evaluation batch size. default = 512
  • eval_interval : Interval for evaluating GAN. default = 10
  • ds : Enable efficient data selection. default False

gan-int-cls's People

Contributors

aelnouby avatar snow-mn avatar karthick47v2 avatar inmoh7 avatar

Forkers

karthick47v2

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.