This is a general purpose implementation of the pix2pix algorithm for image to image translation. This algorithm is based on pix2pix by Isola et al.
Code in this repo has been heavily borrowed from this implementation of the pix2pix tensorflow. But the linked code is not easy to use as I have experienced it first hand while working on a related project.
This repo is an attempt to make the pix2pix implementation easily approachable for training and testing.
A guide on how to use this code for image to image translation is provided.
You should have the following dependencies installed in your system to run this code.
python 3
tensorflow==1.10.0
The goal in image to image translation is to convert the input image A to target image B.
Example:
You can also specify the mapping AtoB
or BtoA
in config.py
.
For training, you should generate such images and put all the training images in the train_data
folder in the root directory.
Alternatively, you can also use --input-dir
flag to set your custom input directory.
e.g
python train.py --input_dir <training_images_folder>
For more control over the training, refer to config.py
which contains all the configurable settings to be used. You'll find comments there to help you out.
For generating output samples using your trained model, you should follow this pattern.
- Create folder
inputs
inside foldertest_data
inside the project root. (Note: You can change this in theconfig.py
file) - Put your input images inside the
inputs
folder and runtest.py
. - You can specify the
--checkpoint
flag to point to the folder where model checkpoints are saved.