Skip to content
StackDecode
AI & ML Atlas
Deep LearningarchitectureAnimated walkthrough

CycleGAN

Translates images between two styles without paired examples.

The idea

Two generators (A→B and B→A) and two discriminators are trained together. A cycle-consistency loss requires that translating a horse to a zebra and back again returns the original horse, which stops the generators from producing arbitrary images and removes the need for paired data.

cycle loss = ‖F(G(x)) − x‖₁ + ‖G(F(y)) − y‖₁

Watch it run

The pipeline lights up one step at a time. Use the controls to pause or step through it.

  1. 1Translate an image from domain A to B with generator G.
  2. 2Translate it back to A with generator F.
  3. 3Penalise the difference between the original and the round trip.
  4. 4Add adversarial losses in both domains.

cycle loss = ‖F(G(x)) − x‖₁ + ‖G(F(y)) − y‖₁

1/4

Step by step

  1. 1Translate an image from domain A to B with generator G.
  2. 2Translate it back to A with generator F.
  3. 3Penalise the difference between the original and the round trip.
  4. 4Add adversarial losses in both domains.

Where it is used

Style transfer, season or weather change, medical image translation.

Watch out for

It can change content in unexpected ways, as only appearance is constrained.

Related