Image-to-image translation using conditional generative adversarial networks (cGAN).
The objective was to reproduce the original research paper from Isola et al. to generate realistic building facades from sketches.
Generated image from the cGan model
A website is available to try the fitted model, by uploading sketches or draw ones yourself : yeswegan.herokuapp.com
The easiest way to use this library is through the Colab Notebook provided on top of this page. However, if you prefer to run this library outside a notebook, please follow the steps below.
Clone the project and install it:
git clone [email protected]:aduverger/pix2pix.git
cd pix2pix
pip install -r requirements.txt
make clean install test # install and test
You can download the facades dataset from Berkeley website:
cd datasets
curl -O http://efrosgans.eecs.berkeley.edu/pix2pix/datasets/facades.tar.gz
tar -xzf facades.tar.gz && rm facades.tar.gz
cd ..
pix2pix-train --model_name MY_MODEL
Alternatively, you have access to some hyperparameters to train a model. Please refer to the documentation of the .fit() method for details about these parameters.
pix2pix-train --model_name MY_MODEL --init 0 --epochs 200 --epochs_gen 5 --epochs_disc 0 --k 1 --l1_lambda 100
pix2pix-predict --model_name MY_MODEL
Alternatively, you can choose the sketch image you want your model to generate a facade from.
You can choose a sketch by specifying an index from the test sample:
pix2pix-predict --model_name MY_MODEL --test_index 89
Or you can use a sketch of your own by specifying its file path:
pix2pix-predict --model_name MY_MODEL --file_path /~/Downloads/some_sketch.jpg