Skip to content
StackDecode
AI & ML Atlas
Deep LearningarchitectureAnimated walkthrough

Pix2Pix

A conditional GAN that turns one kind of image into another using paired examples.

The idea

Given pairs such as sketch→photo or map→satellite, the generator (a U-Net) predicts the target image and a patch-based discriminator judges whether local patches look real given the input. An L1 loss keeps the output close to the ground truth.

Watch it run

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

  1. 1Feed the input image to a U-Net generator.
  2. 2Pass the (input, output) pair to a PatchGAN discriminator.
  3. 3Train the generator with adversarial loss plus L1 loss to the target.
  4. 4Train the discriminator to separate real pairs from generated ones.
1/4

Step by step

  1. 1Feed the input image to a U-Net generator.
  2. 2Pass the (input, output) pair to a PatchGAN discriminator.
  3. 3Train the generator with adversarial loss plus L1 loss to the target.
  4. 4Train the discriminator to separate real pairs from generated ones.

Where it is used

Sketch to image, colourisation, segmentation maps to photos.

Watch out for

Needs paired training data.

Related