This repository is a Tensorflow implementation of the Isola's Image-to-Image Tranaslation with Conditional Adversarial Networks, CVPR2017.
- tensorflow 1.8.0
- python 3.5.3
- numpy 1.14.2
- matplotlib 2.0.2
- scipy 0.19.0
- facades dataset
A to B: from RGB image to generate label image
B to A: from label image to generate RGB image
- maps dataset A to B: from statellite image to generate map image B to A: from map image to generate statellite image
- Generator structure
- Discriminator structure
Download datasets (script borrowed from torch code)
bash ./src/download_dataset.sh [dataset_name]
dataset_namesupportscityscapes,edges2handbags,edges2shoes,facades, andmaps.
Note: our implementation has tested onfacadesandmapsdataset only. But you can easily revise the code to run on other datasets.
├── pix2pix
│ ├── src
│ │ ├── dataset.py
│ │ ├── download_dataset.sh
│ │ ├── main.py
│ │ ├── pix2pix.py
│ │ ├── solver.py
│ │ ├── tensorflow_utils.py
│ │ └── utils.py
├── Data
│ ├── facades
│ └── maps
Note: please put datasets on the correct position based on the Directory Hierarchy.
Use main.py to train a pix2pix model. Example usage:
python main.py --dataset=facades --which_direction=0 --is_train=true
gpu_index: gpu index, default:0dataset: dataset name for choice [facades|maps], default:facadeswhich_direction: AtoB (0) or BtoA (1), default: AtoB0batch_size: batch size for one feed forward, default:1is_train: 'training or inference mode, default:Falselearning_rate: initial learning rate, default:0.0002beta1: momentum term of Adam, default:0.5iters: number of interations, default:200000print_freq: print frequency for loss, default:100save_freq: save frequency for model, default:20000sample_freq: sample frequency for saving image, default:500sample_batch: sample size for check generated image quality, default:4load_model: folder of save model that you wish to test, (e.g. 20180704-1736). default:None
Use main.py to evaluate a pix2pix model. Example usage:
python main.py --is_train=false --load_model=folder/you/wish/to/test/e.g./20180704-1746
Please refer to the above arguments.
@misc{chengbinjin2018pix2pix,
author = {Cheng-Bin Jin},
title = {pix2pix tensorflow},
year = {2018},
howpublished = {\url{https://github.com/ChengBinJin/pix2pix-tensorflow}},
note = {commit xxxxxxx}
}
- This project borrowed some code from yenchenlin and pix2pix official websit
- Some readme formatting was borrowed from Logan Engstrom
Copyright (c) 2018 Cheng-Bin Jin. Contact me for commercial use (or rather any use that is not academic research) (email: sbkim0407@gmail.com). Free for research use, as long as proper attribution is given and this copyright notice is retained.






