Study Friendly Implementation of Pix2Pix in Tensorflow
[Paper | Post(in Korean) | Pytorch Version]
- GAN: [Pytorch][Tensorflow]
- DCGAN: [Pytorch][Tensorflow]
- InfoGAN: [Pytorch][Tensorflow]
- Pix2Pix: [Pytorch][Tensorflow]
- DiscoGAN: [Pytorch][Tensorflow]
- Windows 10
- Python 3.5.3 (Anaconda)
- Tensorflow 1.4.0
- Numpy 1.13.1
train.py
: Main Codetest.py
: Test Code after Trainingmodel.py
: Generator and Discriminatordbread.py
: My Own Code for Reading Database
- Image Size = 256x256 (Resized)
- Batch Size = 1 or 4
- Learning Rate = 0.0002
- Adam_beta1 = 0.5
- Lambda_A = 100 (Weight of L1-Loss)
Detail Recommandations for Each Dataset are on the Last Page of Original Paper
download-dataset.py
is from this github link
- 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
- You just have to get a text file that contains all directories of your image data(filelist.txt).
- You can make filelist with following command.
cd <database_dir>
dir /b /s > filelist.txt
- Then you must open 'filelist.txt' and delete line 'your_db_dir/filelist.txt'.
python train.py --train filelist.txt
--train
: Directory of the Text File of Train Filelist--out_dir
: Directory to Save your Train Result--epochs
: Num of Epochs You Want--batch_size
: Batch Size You Want--direction
: 'AtoB' or 'BtoA'
After finish training, saved models are in the ./output/checkpoint
directory and the Train Results are saved in ./output/result
.(default)
python test.py --train filelist.txt
--test
: Directory of the Text File of Test Filelist--out_dir
: Directory to Save your Train Result--ckpt_dir
: Directory of Trained Model--visnum
: Number of Visualization in an Image File--direction
: 'AtoB' or 'BtoA'
Test results will be saved in ./output_test
(default)
15 Epochs (which is in the Paper) will give better results