CycleGAN: Unpaired Image-to-Image Translation
You'll learn: How CycleGAN translates images between domains (like photos to paintings) without needing paired training examples.
The Core Problem
Remember Pix2Pix? It required paired examples—exact correspondences like "this sketch" matches "this photo." But what if you want to turn horses into zebras, or summer photos into winter scenes? Finding paired examples is often impossible. CycleGAN solves this by learning from unpaired collections: a bunch of horse images and a separate bunch of zebra images, without any matched pairs.
How CycleGAN Works
CycleGAN uses two generators working in opposite directions:
- Generator G: translates domain A → domain B (e.g., horse → zebra)
- Generator F: translates domain B → domain A (e.g., zebra → horse)
Each has its own discriminator to judge realism.
The breakthrough is cycle consistency loss: if you translate a horse to zebra (G), then back to horse (F), you should get your original horse back. Mathematically: F(G(horse)) ≈ horse and G(F(zebra)) ≈ zebra.
The Analogy
Think of it like language translation without a dictionary. You learn French→English and English→French separately, but enforce that translating "cat" to "chat" and back gives you "cat" again. This circular constraint prevents the model from making random, meaningless transformations.
The Complete Loss
CycleGAN combines:
- Adversarial losses (two discriminators ensuring realism)
- Cycle consistency loss (forward-backward reconstruction)
- Optional identity loss (preserving images already in target domain)
Key Takeaway: CycleGAN enables image translation between unpaired domains using dual generators and cycle consistency loss, ensuring translations are reversible and meaningful without requiring matched training pairs.