Home

Awesome

KD-GAN

Introduction

Title: "Knowledge-Driven Generative Adversarial Network for Text-to-Image Synthesis"

How to use

Python

Data

  1. Download metadata for birds coco and save them to data/

  2. Download the birds image data. Extract them to data/birds/

    • cd data/birds
    • wget http://www.vision.caltech.edu/visipedia-data/CUB-200-2011/CUB_200_2011.tgz
    • tar -xvzf CUB_200_2011.tgz
  3. Download coco dataset and extract the images to data/coco/

    • cd data/coco
    • wget http://images.cocodataset.org/zips/train2014.zip
    • wget http://images.cocodataset.org/zips/val2014.zip
    • unzip train2014.zip
    • unzip val2014.zip
    • mv train2014 images
    • cp val2014/* images

Pretrained Models

Training

Validation

  1. Images generation:
    • go into code/ folder
    • python main.py --cfg cfg/eval_bird.yml --gpu 0
    • python main.py --cfg cfg/eval_coco.yml --gpu 0
  2. Inception score:
    • go into eval/IS/bird folder
    • python inception_score_bird.py --image_folder ../../../models/bird_KDGAN_hard
    • or go into eval/IS/coco folder
    • python inception_score_coco.py ../../../models/coco_KDGAN_hard
  3. FID:
    • go into eval/FID/ folder
    • python fid_score.py --gpu 0 --batch-size 50 --path1 bird_val.npz --path2 ../../models/bird_KDGAN_hard
    • python fid_score.py --gpu 0 --batch-size 50 --path1 coco_val.npz --path2 ../../models/coco_KDGAN_hard

Reference

DM-GAN: Dynamic Memory Generative Adversarial Networks for Text-to-Image Synthesis [code]

License

This code is released under the MIT License (refer to the LICENSE file for details).