GithubHelp home page GithubHelp logo

miguelramosfdz / cyclegan-tensorflow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from clvrai/cyclegan-tensorflow

0.0 2.0 0.0 3.6 MB

A Tensorflow implementation of Cycle-Consistent Adversarial Networks.

License: MIT License

Python 96.94% Shell 3.06%

cyclegan-tensorflow's Introduction

CycleGAN implementation in Tensorflow

As part of the implementation series of Joseph Lim's group at USC, our motivation is to accelerate (or sometimes delay) research in the AI community by promoting open-source projects. To this end, we implement state-of-the-art research papers, and publicly share them with concise reports. Please visit our group github site for other projects.

This project is implemented by Youngwoon Lee and the codes have been reviewed by Honghua Dong before being published.

Description

This repo is a Tensorflow implementation of CycleGAN on Pix2Pix datasets: Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks.

This paper presents a framework addressing the image-to-image translation task, where we are interested in converting an image from one domain (e.g., zebra) to another domain (e.g., horse). It transforms a given image by finding an one-to-one mapping between unpaired data from two domains.

The framework consists of two generators and two discriminators. Generator G_ab aims to translate an image in domain a (zebra) to its domain b version (horse); while generator G_ba aims to translate an image in domain b to its domain a version. On the other hand, discriminator D_a verifies whether given images are in domain a or not; so does discriminator D_b.

Therefore, the entire frameowrk consists of two loops of GANs which are trained to perform image-to-image translation a->b->a and b->a->b. When training these GANs, a cycle-consistent loss, which is a sum of reconstruction errors (a->b->a and b->a->b), is added to the adversarial loss. Without one-to-one mapping between two domains a and b, the framework cannot reconstruct original image and it leads to the large cycle-consistent loss. Therefore, the cycle-consistent loss alleviates the issue of mode collapse by imposing one-to-one mapping between two domains.

paper-figure

Dependencies

Usage

  • Execute the following command to download the specified dataset as well as train a model:
$ python cycle-gan.py --task apple2orange --image_size 256
  • To reconstruct 256x256 images, set --image_size to 256; otherwise it will resize to and generate images in 128x128. Once training is ended, testing images will be converted to the target domain and the results will be saved to ./results/apple2orange_2017-07-07_07-07-07/.

  • Available datasets: apple2orange, summer2winter_yosemite, horse2zebra, monet2photo, cezanne2photo, ukiyoe2photo, vangogh2photo, maps, cityscapes, facades, iphone2dslr_flower, ae_photos

  • Check the training status on Tensorboard:

$ tensorboard --logdir=./logs

Carefully check Tensorboard for the first 1000 iterations. You need to run the experiment again if dark and bright regions are reversed like the exmaple below. This GAN implementation is sensitive to the initialization.

wrong-example

Results

apple2orange

apple2orange

training-apple2orange.png

vangogh2photo

vangogh2photo

training-vangogh2photo

References

cyclegan-tensorflow's People

Contributors

shaohua0116 avatar youngwoon avatar

Watchers

 avatar  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.