explaingit

junyanz/cyclegan

12,852LuaAudience · researcherComplexity · 4/5Setup · hard

TLDR

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.

Mindmap

mindmap
  root((CycleGAN))
    What it does
      Image style transfer
      No paired examples
      Bidirectional mapping
    Examples
      Photo to painting
      Horse to zebra
      Maps to satellite
    Tech
      Lua and Torch
      NVIDIA GPU required
      Pre-trained models
    Limitations
      Research codebase
      Older Torch version
      PyTorch version exists
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Convert your landscape photos into the painting style of Monet or Van Gogh using a pre-trained model.

USE CASE 2

Transform horse photos into zebra photos (and back) to experiment with unpaired image translation.

USE CASE 3

Train your own CycleGAN model on two custom image collections to transfer visual styles between them.

USE CASE 4

Convert street map tiles into aerial satellite views using the included pre-trained model.

Tech stack

LuaTorchCUDAPython

Getting it running

Difficulty · hard Time to first run · 1h+

Requires an NVIDIA GPU and the Lua-based Torch framework, the authors recommend using the newer PyTorch version in a separate repository for new projects.

In plain English

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.

Copy-paste prompts

Prompt 1
Using the pre-trained CycleGAN model from junyanz/cyclegan, show me how to convert my own photos into Monet painting style, give me the exact test command.
Prompt 2
Walk me through training a new CycleGAN model on my own two image folders using the Torch framework, from dataset prep to running training.
Prompt 3
How do I download the horse-to-zebra pre-trained CycleGAN model and run batch inference on a folder of images from the command line?
Prompt 4
What are the differences between the original Lua/Torch CycleGAN repo and the newer PyTorch version, and which should I use for a new project?
Open on GitHub → Explain another repo

← junyanz on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.