CycleGAN
Software that can generate photos from paintings, turn horses into zebras, perform style transfer, and more.
A research implementation of CycleGAN, an AI technique that converts images from one visual style to another, like photos to Monet paintings or horses to zebras, without needing matched image pairs.
CycleGAN is a research implementation of an image transformation technique that can convert photos from one visual style to another without needing matched before-and-after examples. Rather than requiring pairs of images (for instance, the same horse photographed and then re-drawn as a zebra), the method learns from two separate collections of images and figures out the mapping between them on its own.
The examples in the README show what this can do in practice: converting landscape photos into the painting style of Monet, Van Gogh, or Cezanne; turning photos of horses into photos that look like zebras and back again; converting street map tiles into aerial satellite photos; translating iPhone flower photos into photos that look like they were taken with a professional DSLR camera; and transferring the appearance of summer scenes into winter ones.
This particular repository contains the original implementation written in Lua using the Torch framework, published alongside a research paper from the Berkeley AI Research Lab in 2017. The authors note that a newer PyTorch version of the code also exists in a separate repository and is more actively maintained.
To use the pre-trained models, you download the model weights and point the test script at your images. Training your own model requires an NVIDIA GPU. The repository provides pre-trained models for the transformation pairs listed above, so you can start running experiments without training from scratch.
This is a research codebase rather than a production application. It requires familiarity with machine learning tooling and command-line usage. The README covers installation, dataset downloads, training commands, and testing.
Where it fits
- Convert your landscape photos into the painting style of Monet or Van Gogh using a pre-trained model.
- Transform horse photos into zebra photos (and back) to experiment with unpaired image translation.
- Train your own CycleGAN model on two custom image collections to transfer visual styles between them.
- Convert street map tiles into aerial satellite views using the included pre-trained model.