This is a keras implementation of paper Image-to-Image Translation with Conditional Adversarial Networks (pix2pix). I learned a lot from tdeboissiere's code.
- python 3.6
- keras 2.1.5
- tensorFlow 1.4
- opencv 3.4.1
All your training data and validation data should be processed into A2B form as shown in figure. Then moving the training images (3 channels) into folder ./data/train
, and validation images into folder ./data/val
.
python train.py
-
Model pictures and generated validation pictures will be saved in folder
./figures
, and weights will be saved in folder./weights/pix2pix
. -
If you want to use perceptual loss, please replace
loss = [l1_loss, 'binary_crossentropy']
(line44) byloss = [perceptual_loss, 'binary_crossentropy']
(line45) intrain.py
.
You need to change the path of folder testset_dir
and save_dir
, and run
python test.py