explaingit

junyanz/pytorch-cyclegan-and-pix2pix

25,130PythonAudience · researcherComplexity · 3/5QuietLicenseSetup · moderate

TLDR

PyTorch implementations of CycleGAN and pix2pix for automatically transforming images from one visual style to another, with and without paired training data.

Mindmap

mindmap
  root((repo))
    What it does
      Image style transfer
      Paired translation pix2pix
      Unpaired translation CycleGAN
    How it works
      Generative adversarial networks
      Cycle consistency loss
      Multi-GPU training
    Use cases
      Photo to sketch conversion
      Domain adaptation
      Creative style transfer
      Research baseline
    Tech stack
      Python
      PyTorch
      CUDA GPU support
    Audience
      Researchers
      ML engineers
      Creative technologists

Things people build with this

USE CASE 1

Convert sketches into photorealistic images or transform photos into artistic styles without paired training examples.

USE CASE 2

Train domain adaptation models to translate images between different visual domains like day-to-night or horse-to-zebra.

USE CASE 3

Build a baseline for research into new image generation techniques or create custom style-transfer applications.

USE CASE 4

Perform creative visual effects like changing seasons, lighting conditions, or artistic rendering on image collections.

Tech stack

PythonPyTorchCUDA

Getting it running

Difficulty · moderate Time to first run · 30min

CUDA/GPU setup required for reasonable training speed; CPU-only will be very slow.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice and license text.

In plain English

This repository provides PyTorch implementations of two image-to-image translation models: CycleGAN and pix2pix. Image-to-image translation means automatically transforming an image from one visual style or domain into another, for example, turning a photograph of a horse into one that looks like a zebra, converting a sketch into a realistic photo, or changing a daytime scene into a nighttime one. Pix2pix is a paired method: it learns from a dataset of matching before-and-after image pairs, learning the transformation from one to the other. CycleGAN is an unpaired method: it can learn to translate between two categories of images without needing paired examples. It does this using a cycle-consistency idea, if you translate a horse photo to look like a zebra, then translate that back, you should get the original horse back. This constraint teaches the model the transformation without paired training data. Both models are built on GANs (Generative Adversarial Networks), an AI technique where two neural networks compete: one tries to generate realistic images, the other tries to detect fakes. The code runs in Python using PyTorch and supports multi-GPU training. You would use this repository for research into image generation, creative style transfer, domain adaptation experiments, or as a baseline for building new image translation methods.

Copy-paste prompts

Prompt 1
How do I train CycleGAN on my own unpaired image dataset to translate between two visual styles?
Prompt 2
What's the difference between using pix2pix versus CycleGAN for my image translation task, and which should I choose?
Prompt 3
Show me how to set up multi-GPU training for faster model training with this PyTorch implementation.
Prompt 4
How can I use a pretrained CycleGAN model to transform new images after training is complete?
Prompt 5
What loss functions and hyperparameters should I adjust to improve image quality for my specific domain adaptation problem?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.