Giter Site home page Giter Site logo

sketchgan's Introduction

sketchGAN

Using CycleGAN with building sketches + images

Creating a dataset

To train a CycleGAN model, you need two sets of images representing the two archetypes you want to translate between (in our case, images of buildings and sketches of buildings). For convenience, you can place them in the datasets folder under trainA and trainB.

For best results, the images should be the same size (we used 512x512px). You can use dataset-tools to quickly resize, crop, or stretch images to a common size and format.

Training a model

Using a NVIDIA GPU with CUDA Deep Neual Network (cuDNN) installed (we used a machine from Paperspace):

Clone the pyTorch implementation of CycleGAN:

git clone https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix
cd pytorch-CycleGAN-and-pix2px

Install depedencies:

pip install -r requirements.txt

Train the model:

python train.py --dataroot /path/to/datasets --name sketch2building --model cycle_gan

NOTE: This process can takes 24-48 hours, depending on the specs of the machine + GPU you are using to train it.

Using a model

TBD: Still figuring this one out ๐Ÿ˜…

Update: Used Pix2PixHD model (a much more advanced CoGAN than Pix2Pix which uses semantic segmentation in the input labels to drastically improve the results). It was not possible to do the same for our custom dataset, but there were dramatic improvements by increasing the size of training dataset and restricting the images to mostly one or two type of objects. Some of the test results:

Resources & Credits/Thanks

OpenCV for dataset processing from images

CycleGAN for training

dataset-tools by dvschultz

Thanks to Derrick Schultz for sharing his lectures on the CycleGAN process. Check out his work here.

sketchgan's People

Contributors

sounok1234 avatar djsiroky avatar albertotono avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.