> ## Content Index
> Fetch the complete content index at: https://sudormrf.run/llms.txt
> Use this file to discover other available public pages before exploring further.

# pix2pix : Image Translation with GAN (2)
- URL: https://sudormrf.run/2018/04/02/image-translation-with-gan-2/
- Published: 2018-04-02T02:38:14.000Z
- Updated: 2018-04-04T14:25:30.000Z
- Author: Junho Cho
- Tags: Computer Vision, Deep Learning, #Import 2026-10-24 03:36

# Image-to-Image Translation with Conditional Adversarial Networks (pix2pix)

published to **CVPR2017** by Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, Alexei A. Efros

![fit](https://tmmsexy.s3.amazonaws.com/imgs/2017-05-10-120245.jpg)  
![inline](https://tmmsexy.s3.amazonaws.com/imgs/2017-05-10-120608.jpg)  
![inline](https://tmmsexy.s3.amazonaws.com/imgs/2017-05-10-120352.jpg)

## Learn pair-wise images of $S$ and $T$ like below

- BW & Color image
- Street Scene & Label
- Facade & Label
- Aerial & Map
- Day & Night
- Edges & Photo

source image $x \\in S$, target image (label) $y \\in T$ is pair-wise.

### thus it is Supervised Learning

## Generator of pix2pix

$G(x,z)$ where $x$: image and $z$: noise  
![left fit](https://tmmsexy.s3.amazonaws.com/imgs/2017-05-10-132923.jpg)  
Use U-Net shaped network

- known to be powerful at segmentation task
- use spatial information from features of bottom layer
- use dropout as noise in decoder part

## Discriminator of pix2pix

![inline](https://tmmsexy.s3.amazonaws.com/imgs/2017-05-10-132829.jpg)

## Loss function

![inline 40%](https://ws3.sinaimg.cn/large/006tNc79gy1fpbew5684gj30pi0ckdgk.jpg)  
$x$: source image, $y$: target image, $z$: noise

### Use Adversarial loss and L1 loss

\\begin{equation}  
\\mathcal{L}\_{cGAN}(G,D) = \\mathbb{E}\_{x,y \\sim p\_{data}(x,y)}\[\\log D(x,y)\] + \\mathbb{E}\_{x \\sim p\_{data}(x), z \\sim p\_z(z)}\[\\log (1-D(x,G(x,z)))\]  
\\end{equation}

\\begin{equation}  
\\mathcal{L}\_{L1}(G) = \\mathbb{E}\_{x,y \\sim p\_{data}(x,y),z \\sim p\_z(z)}\[||y-G(x,z)||\_1\]  
\\end{equation}

## Result

![inline](https://tmmsexy.s3.amazonaws.com/imgs/2017-05-10-143108.jpg)  
![fit](https://tmmsexy.s3.amazonaws.com/imgs/2017-05-10-143305.jpg)  
![fit](https://tmmsexy.s3.amazonaws.com/imgs/2017-05-10-143347.jpg)  
![fit](https://tmmsexy.s3.amazonaws.com/imgs/2017-05-10-143449.jpg)  
![fit](https://tmmsexy.s3.amazonaws.com/imgs/2017-05-10-143510.jpg)  
![fit](https://tmmsexy.s3.amazonaws.com/imgs/2017-05-10-143530.jpg)  
Do [demo](https://affinelayer.com/pixsrv/?ref=sudormrf.run)!  
`https://affinelayer.com/pixsrv/`