explaingit

junyanz/pytorch-cyclegan-and-pix2pix

Analysis updated 2026-06-21

25,105PythonAudience · researcherComplexity · 4/5Setup · hard

TLDR

This repo provides PyTorch implementations of CycleGAN and pix2pix, two AI models that transform images from one visual style to another, like turning horses into zebras or rough sketches into realistic photos.

Mindmap

mindmap
  root((CycleGAN and pix2pix))
    What it does
      Image style transfer
      Paired translation
      Unpaired translation
    Models
      CycleGAN
      pix2pix
    Key concepts
      GANs
      Cycle consistency
      Multi-GPU training
    Use cases
      Creative style transfer
      Domain adaptation
      Research baselines
    Tech stack
      Python
      PyTorch
    Audience
      AI researchers
      ML engineers
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

What do people build with it?

USE CASE 1

Train a CycleGAN on your own dataset to convert summer landscape photos to winter scenes without paired training data.

USE CASE 2

Use pix2pix to build a model that turns rough architectural sketches into photorealistic building renders.

USE CASE 3

Run a pre-trained CycleGAN checkpoint to convert a folder of horse images into zebra-style images.

USE CASE 4

Use this codebase as a research baseline for image-to-image translation with a modified loss function or architecture.

What is it built with?

PythonPyTorch

How does it compare?

junyanz/pytorch-cyclegan-and-pix2pixpypa/pipenvlucidrains/vit-pytorch
Stars25,10525,07825,147
LanguagePythonPythonPython
Setup difficultyhardeasymoderate
Complexity4/52/53/5
Audienceresearcherdeveloperresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires PyTorch with GPU support and a prepared dataset in the expected folder structure, multi-GPU training needs CUDA.

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
Show me how to train a CycleGAN model on my own unpaired dataset of two image categories using this repo, including the folder structure needed.
Prompt 2
Give me the exact command to train a pix2pix model on a paired sketch-to-photo dataset using this repo.
Prompt 3
How do I run inference with a saved CycleGAN checkpoint in this repo to convert a folder of horse images to zebra style?
Prompt 4
Walk me through adding a new generator architecture class to this repo to experiment with a different network structure.
Prompt 5
How do I enable multi-GPU training in this PyTorch CycleGAN repo to speed up training on a server with 4 GPUs?

Frequently asked questions

What is pytorch-cyclegan-and-pix2pix?

This repo provides PyTorch implementations of CycleGAN and pix2pix, two AI models that transform images from one visual style to another, like turning horses into zebras or rough sketches into realistic photos.

What language is pytorch-cyclegan-and-pix2pix written in?

Mainly Python. The stack also includes Python, PyTorch.

How hard is pytorch-cyclegan-and-pix2pix to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is pytorch-cyclegan-and-pix2pix for?

Mainly researcher.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub junyanz on gitmyhub

Verify against the repo before relying on details.