Skip to content

veegee82/CycleGAN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CycleGAN

"Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks"

Paper: https://arxiv.org/pdf/1703.10593.pdf

Abstract

Image-to-image translation is a class of vision and graphics problems where the goal is to learn the mapping between an input image and an output image using a training set of aligned image pairs. However, for many tasks, paired training data will not be available. We present an approach for learning to translate an image from a source domain X to a target domain Y in the absence of paired examples. Our goal is to learn a mapping G:X→Y such that the distribution of images from G(X) is indistinguishable from the distribution Y using an adversarial loss. Because this mapping is highly under-constrained, we couple it with an inverse mapping F:Y→X and introduce a cycle consistency loss to push F(G(X))≈X (and vice versa). Qualitative results are presented on several tasks where paired training data does not exist, including collection style transfer, object transfiguration, season transfer, photo enhancement, etc. Quantitative comparisons against several prior methods demonstrate the superiority of our approach.

Workflow

Convert Domain A to B (Horse to Zebra)

Domain A to B

Convert Domain B to A (Zebra to Horse)

Domain B to A

Modifications

  • Modify the ResNet-Generator with recursive residual blocks like in the DRRN. http://cvlab.cse.msu.edu/pdfs/Tai_Yang_Liu_CVPR2017.pdf
  • Option to use an U-Net with skip connections.
  • An an perceptual loss witch is extracted and calculated from the discriminator network of the corresponding domain A or B.

Results

  • Coming soon

Pre-requiremtents

  • tensorflow >= 1.8
  • pil
  • numpy

Installation tf_base package

  1. Clone the repository
$ git clone https://github.com/Shumway82/tf_base.git
  1. Go to folder
$ cd tf_base
  1. Install with pip3
$ pip3 install -e .

Install CycleGAN package

  1. Clone the repository
$ git clone https://github.com/Shumway82/CycleGAN.git
  1. Go to folder
$ cd CycleGAN
  1. Install with pip3
$ pip3 install -e .

Usage-Example

  1. Training
$ python pipeline_trainer.py --dataset "../horse2zebra/" --config_path "../config/" 
  1. Inferencing
$ python pipeline_inferencer.py --dataset "../horse2zebra/testA" --outdir ../Results/Horse2Zebra_AtoB" --model_dir ../pretrained_models/generator/Horse2Zebra/"

About

CycleGAN using perceptual loss

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages