Skip to content

Latest commit

 

History

History
145 lines (74 loc) · 3.7 KB

README.md

File metadata and controls

145 lines (74 loc) · 3.7 KB

DiscoGAN in Tensorflow

Study Friendly Implementation of DiscoGAN in Tensorflow

[Paper | Post(in Korean) | Pytorch Version]

1. Environments

  • Windows 10 / Linux Ubuntu 16.04.3 (both available)
  • Python 3.5.4 (Anaconda)
  • Tensorflow 1.4.1
  • Numpy 1.13.3

2. Code Description

  • train.py: Main Code
  • test.py: Test Code after Training
  • model.py: Generator and Discriminator
  • dbread.py: My Own Code for Reading Database

3. Networks and Parameters

3.1 Hyper-Parameters

  • Image Size = 64x64 (Resized)
  • Batch Size = 64
  • Learning Rate = 0.0002
  • Adam_beta1 = 0.5

3.2 Generator Networks (network.py)

Image ref: taeoh-kim's Github

3.3 Discriminator Networks (network.py)

Image ref: taeoh-kim's Github

4. Database

4.1 DB Download

We will split the Pix2Pix database and use them.

  • facades: python database/download-dataset.py facades
  • cityscapes: python database/download-dataset.py cityscapes
  • maps: python database/download-dataset.py maps
  • edges2shoes: python database/download-dataset.py edges2shoes
  • edges2handbags: python database/download-dataset.py edges2handbags

download-dataset.py is from this github link

Or, you can simply download all database from this link

4.2 DB Setting

You can cut each paired data into two unpaired data to run discogan with following command.

python database/split_db.py --input paired_database_dir --output output_dir

5. Train

python train.py
  • --train_A: Directory of the first train database (without last '/')
  • --train_B: Directory of the second train database (without last '/')
  • --out_dir: Directory to Save your Train Result
  • --epochs: Num of Epochs You Want
  • --batch_size: Batch Size You Want

After finish training, saved models are in the ./output_dir/checkpoint directory and the Train Results are saved in ./output_dir/result.

6. Test

python test.py
  • --test: Directory of the test database
  • --out_dir: Directory to save your test result
  • --ckpt_dir: Directory of Trained Model(ex: ./out_dir/checkpoint)
  • --visnum: Number of visualization per one image file
  • --direction: 'AtoB' or 'BtoA'
  • --img_num: The number of images you want to get in test phase.

Test results will be saved in ./out_dir.

7. Results

[Input A | Output B]

Edges & Shoes (25 Epochs)

Edge & Handbags (25 Epochs)

Shoes & Handbags (25 Epochs)