Skip to content

rwang97/skyline-image-generation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Skyline Image Generation

This project is a PyTorch implementation of Image-to-Image Translation with Conditional Adversarial Networks by Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A. Efros.

Model Architecture

Generator

Alt text

Discriminator

Alt text

Goal & Motivation

This is a course project (APS360) from University of Toronto. Our main purpose is to generate city skyline images from input sketch. If interested, you can take a look at our project report for more details.

Sample Result

Alt text

Data

Source

We collected images from Flickr, an image hosting service. In case you want to view our dataset, the download link is Google Drive. This 'data_uncleaned.zip' should contain our uncleaed images downloaded directly from Flickr. We also provide our cleaned dataset here Google Drive. 'input_edges' contains input sketches generated from gPb and 'real' has the corresponding real skyline images.

Usage

Train on your own

You can collect your own skyline images and obtain building boundaries by using gPb. Then you are able to train your own model with train.py. Feel free to change the model architecture in model.py, and change any hyperparameters we set in train.py.

Use Pre-trained Model

Our team also provides our pre-trained model so that people can generate images directly without training. Our model isn't the best, but it should give you some fine results.

Demo

The following is the instruction on how to generate a skyline image from a sample test.jpg.

Setting Up Environment

We use Anaconda with python version 3.6.7. Pytorch is the main framework we are using. Please install pytorch before running the demo code

Step-By-Step instructions

  1. Download our pre-trained model from Google Drive, and put this model file under the "demo" directory.
  2. Go to the "demo" directory and run demo.py.
cd demo
python demo.py
  1. The output message should be
Done generating images, please check 'output' and 'comparison' directory.
  1. All Done! A generated image is stored under the 'output' directory. This is the output from the previous test.jpg.

Acknowledgments

Our model is inspired by pix2pix. The pytorch version of the code is pytorch-CycleGAN-and-pix2pix. Also I need to say thanks to my teammates, Tom and Jeremy. It has been a great pleasure working with you!