Team 3 in the Deep Learning for Computer Vision Summer School 2017 at UPC TelecomBCN.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Task 1


Team 3 in the Deep Learning for Computer Vision Summer School 2017 at UPC TelecomBCN.


This model task is based on pix2pix architecture. You can find all the information in this repository. The aim of the project is to use this architecture in order to generate Faces from edges, similar to Edges2Cats or Edges2Shoes.


  • Tensorflow 1.0.0
  • OpenCV


  • Linux with Tensorflow GPU edition + cuDNN


The first thing shoul be to download the model from the pix2pix repository.

git clone

Also, we will need to download the database of faces in the wild. link


Now crop the images in order to have no more than the face in the image. This will generate a folder with all the images cropped (lfw-deepfunneled_croped)


Then, resize the images so they have the correct size for the model.

python pix2pix-tensorflow/tools/ \
  --input_dir lfw-deepfunneled_croped \
  --operation resize \
  --output_dir faces_resized

Now, the edges will be computed:


The dataset that will be fed to the model is generated from both the original (cropped and resized) photos and the edges of these photos (Check pix2pix repo for more detail). Also, generate train and validation partitions from the dataset.

python pix2pix-tensorflow/tools/ \
  --input_dir faces_resized \
  --b_dir faces_edges \
  --operation combine \
  --output_dir faces_combined

  python pix2pix-tensorflow/tools/ \
  --dir faces_combined


Finally, in order to train and test the model:

# train the model (this may take 1-8 hours depending on GPU, on CPU you will be waiting for a bit)
python pix2pix-tensorflow/ \
  --mode train \
  --output_dir faces_train \
  --max_epochs 200 \
  --input_dir faces_combined/train \
  --which_direction BtoA
# test the model
python pix2pix-tensorflow/ \
  --mode test \
  --output_dir faces_test \
  --input_dir faces_combined/val \
  --checkpoint faces_train