# Pix2Pix

**Pix2Pix**是一种用于成对图像到图像翻译的条件生成对抗网络（cGAN），由加州大学伯克利分校的Phillip Isola、Jun-Yan Zhu、Tinghui Zhou和[Alexei A. Efros](https://www.edgepedia.org/zh/alexei-a-efros)提出，相关arXiv论文于2016年11月21日提交，并以《Image-to-Image Translation with Conditional Adversarial Networks》为题发表于CVPR 2017<sup>[1](https://arxiv.org/abs/1611.07004)</sup><sup> • </sup><sup>[2](https://openaccess.thecvf.com/content_cvpr_2017/html/Isola_Image-To-Image_Translation_With_CVPR_2017_paper.html)</sup>。该系统学习从一个域中的输入图像到另一个域中的输出图像的映射，并且按照作者的表述，它同时学习用于训练该映射的损失函数，从而以一种通用方法覆盖传统上需要不同损失设计的任务<sup>[2](https://openaccess.thecvf.com/content_cvpr_2017/html/Isola_Image-To-Image_Translation_With_CVPR_2017_paper.html)</sup>。

| 关键事实 | 详情 |
|---|---|
| 原始论文 | 《Image-to-Image Translation with Conditional Adversarial Networks》，Isola、Zhu、Zhou、Efros；arXiv 2016年11月21日，CVPR 2017，第1125–1134页<sup>[1](https://arxiv.org/abs/1611.07004)</sup><sup> • </sup><sup>[2](https://openaccess.thecvf.com/content_cvpr_2017/html/Isola_Image-To-Image_Translation_With_CVPR_2017_paper.html)</sup> |
| 训练数据 | 来自两个域的成对、像素对齐图像（例如标签图与对应照片）<sup>[3](https://pmc.ncbi.nlm.nih.gov/articles/PMC9654990/)</sup> |
| 生成器 | 带跳跃连接的U-Net编码器–解码器，跳跃连接将编码器特征复制到解码器层<sup>[4](https://github.com/chefnoob123/pix2pix)</sup> |
| 判别器 | PatchGAN，一种70×70像素的图块分类器，对每张256×256图像输出30×30的真/假预测网格<sup>[4](https://github.com/chefnoob123/pix2pix)</sup> |
| 损失 | 条件GAN对抗损失加上以λ = 100加权的L1重建项<sup>[4](https://github.com/chefnoob123/pix2pix)</sup> |
| 展示任务 | 从标签图合成照片、从边缘图重建物体、图像着色等<sup>[2](https://openaccess.thecvf.com/content_cvpr_2017/html/Isola_Image-To-Image_Translation_With_CVPR_2017_paper.html)</sup> |
| 主要局限 | 需要成对且像素级对齐良好的图像，这在医学成像等场景中难以获取<sup>[5](https://papers.nips.cc/paper_files/paper/2021/hash/0f2818101a7ac4b96ceeba38de4b934c-Abstract.html)</sup> |

## 工作原理

Pix2Pix建立在条件GAN之上。在普通GAN中，生成器从随机噪声生成图像，判别器学习区分真实样本与生成样本。在pix2pix使用的条件设置中，生成器和判别器都额外接收输入图像，因此生成器学习以源图像为条件的映射，判别器则判断每个输出是否是该输入的一个合理翻译<sup>[6](https://pmc.ncbi.nlm.nih.gov/articles/PMC9704666/)</sup>。

**生成器。** 生成器采用U-Net编码器–解码器架构。由步长为2的卷积组成的编码器将输入压缩为瓶颈表示，由转置卷积组成的解码器重建输出；跳跃连接将特征图从编码器第i层复制到解码器第n−i层，使生成器能够复用边缘和颜色区域等低层空间信息，否则这些信息会被瓶颈压缩丢弃<sup>[4](https://github.com/chefnoob123/pix2pix)</sup>。这一设计保持了成对翻译所依赖的输入与输出之间的空间对齐<sup>[7](https://doi.org/10.1016/j.media.2022.102704)</sup>。

**判别器。** PatchGAN判别器不是将整张图像判为真或假，而是输出逐图块判断的网格；在常见配置中，它产生30×30网格，其中每个预测覆盖70×70像素的感受野。作者将这种图块级对抗项解释为一种纹理或风格损失，用以强化高频细节，并且它比整图判别器更具参数效率<sup>[4](https://github.com/chefnoob123/pix2pix)</sup><sup> • </sup><sup>[7](https://doi.org/10.1016/j.media.2022.102704)</sup>。

**损失。** 仅靠对抗项会使生成器可以自由产生看起来合理但与输入不匹配的输出，因此目标函数加入生成图像与真实目标之间的L1距离，以强化低频、像素级重建。组合损失将L1项权重设为λ = 100，该值是在论文中凭经验选择的<sup>[4](https://github.com/chefnoob123/pix2pix)</sup><sup> • </sup><sup>[7](https://doi.org/10.1016/j.media.2022.102704)</sup>。

参考训练配置使用[Adam优化器](https://www.edgepedia.org/zh/adam-optimizer)，β₁ = 0.5、β₂ = 0.999，学习率为2×10⁻⁴，在前100轮训练中保持不变，并在接下来的100轮训练中线性衰减至零，批大小为1，图像尺寸为256×256<sup>[4](https://github.com/chefnoob123/pix2pix)</sup>。

## 任务与数据集

论文展示了同一架构可跨损失需求差异很大的任务使用：从语义标签图合成照片、从边缘图重建物体以及图像着色<sup>[2](https://openaccess.thecvf.com/content_cvpr_2017/html/Isola_Image-To-Image_Translation_With_CVPR_2017_paper.html)</sup>。发布的软件附带若干此类任务的成对数据集和预训练模型，包括：

- CMP Facades，400张图像，标签到立面<sup>[8](https://deepwiki.com/phillipi/pix2pix/1.2-examples-and-use-cases)</sup>
- Cityscapes，2975张图像，语义标签到街景及反向<sup>[8](https://deepwiki.com/phillipi/pix2pix/1.2-examples-and-use-cases)</sup>
- [Google Maps](https://www.edgepedia.org/zh/google-maps)，1096张图像，航拍照片到地图视图及反向<sup>[8](https://deepwiki.com/phillipi/pix2pix/1.2-examples-and-use-cases)</sup>
- UT Zappos50K，50,000张图像，边缘图到鞋子照片<sup>[8](https://deepwiki.com/phillipi/pix2pix/1.2-examples-and-use-cases)</sup>
- Amazon Handbags，137,000张图像，边缘图到手袋照片<sup>[8](https://deepwiki.com/phillipi/pix2pix/1.2-examples-and-use-cases)</sup>
- Transient Attributes，约20,000张图像，白天到夜晚及夜晚到白天<sup>[8](https://deepwiki.com/phillipi/pix2pix/1.2-examples-and-use-cases)</sup>

软件发布后，包括艺术家在内的许多互联网用户发布了他们对该系统的实验，作者将其引用为该系统广泛适用且无需调参即可采用的证据<sup>[2](https://openaccess.thecvf.com/content_cvpr_2017/html/Isola_Image-To-Image_Translation_With_CVPR_2017_paper.html)</sup>。

## Pix2Pix与CycleGAN

Pix2Pix与CycleGAN（由Zhu、Park、Isola和Efros在ICCV 2017提出）是基于GAN的图像到图像翻译的两个参考框架，它们的主要区别在于训练数据要求<sup>[9](https://ieeexplore.ieee.org/document/10674804/)</sup>。Pix2Pix在成对数据上训练，即同一场景给出两次，例如灰度照片及其彩色版本；CycleGAN去掉了这一要求，从两个独立、未对齐的图像集合中训练，使用循环一致性损失，使翻译后的图像能够映射回原始域而不产生显著失真<sup>[10](https://bitsnotes.com/view/unsupervised-deep-learning/from-cyclegan-to-diffusion-models)</sup><sup> • </sup><sup>[11](https://shizuoka.repo.nii.ac.jp/record/2001650/files/250620001.pdf)</sup>。

成对要求具有限制性，因为必须有人构建对齐的图像对，这是昂贵的人工劳动；CycleGAN的非成对设置使任意两个图像集合都可作为训练材料<sup>[10](https://bitsnotes.com/view/unsupervised-deep-learning/from-cyclegan-to-diffusion-models)</sup>。在CycleGAN论文本身中，在成对数据上训练的pix2pix作为监督式“上界”，用来衡量非成对方法，而CycleGAN的翻译接近但未达到该上界<sup>[12](https://openaccess.thecvf.com/content_ICCV_2017/papers/Zhu_Unpaired_Image-To-Image_Translation_ICCV_2017_paper.pdf)</sup>。

直接对比结果取决于数据。在共配准的成对共聚焦与STED荧光显微图像数据集上，Pix2Pix略优于CycleGAN，相对于真实STED图像达到平均SSIM 0.93 ± 0.04和归一化PSNR 0.61 ± 0.18，而CycleGAN仍具竞争力<sup>[13](https://pmc.ncbi.nlm.nih.gov/articles/PMC13064623/)</sup>。在医学成像中，由于采集间呼吸运动或解剖变化，完美的像素级对齐图像对往往无法获得，情况可能反转：在NeurIPS 2021的RegGAN研究中，Pix2Pix在索引模式下得分为NMAE 0.180、PSNR 15.5、SSIM 0.71，落后于CycleGAN(C)的0.094、23.6、0.83以及RegGAN的0.086、24.0、0.83<sup>[5](https://papers.nips.cc/paper_files/paper/2021/hash/0f2818101a7ac4b96ceeba38de4b934c-Abstract.html)</sup><sup> • </sup><sup>[14](https://proceedings.neurips.cc/paper/2021/file/0f2818101a7ac4b96ceeba38de4b934c-Paper.pdf)</sup>。

## 扩展与后续工作

**Pix2PixHD**使用由粗到细的生成器、三个多尺度判别器的架构以及更稳健的对抗目标，将输出分辨率提高到2048×1024<sup>[15](https://www.mdpi.com/2073-8994/12/10/1705)</sup>。

**RegGAN**直接解决对齐问题：未对齐的目标图像被视为带噪声的标签，并额外训练一个配准网络与生成器一起拟合图像间的错位，联合优化翻译与配准。在作者实验中，RegGAN在对齐数据上优于Pix2Pix，在未对齐或非成对数据上优于循环一致性方法<sup>[5](https://papers.nips.cc/paper_files/paper/2021/hash/0f2818101a7ac4b96ceeba38de4b934c-Abstract.html)</sup>。

**pix2pix-Turbo**（2024）将成对翻译重新表述为基于预训练文本到图像模型的单步扩散过程；在Sketch2Photo和Edge2Image任务上，它以单步推理达到与ControlNet相当的性能，配套的CycleGAN-Turbo在非成对设置中也是如此<sup>[16](https://arxiv.org/abs/2403.12036)</sup>。

Pix2Pix仍被广泛用作监督式基线，尤其是在医学图像翻译中，综述将监督式Pix2Pix和非监督循环一致性描述为主导该领域的两种模式<sup>[5](https://papers.nips.cc/paper_files/paper/2021/hash/0f2818101a7ac4b96ceeba38de4b934c-Abstract.html)</sup>。其主要约束未变：它需要成对且像素级对齐良好的训练图像，当这些不可用时，CycleGAN等非成对方法是通常的替代方案<sup>[5](https://papers.nips.cc/paper_files/paper/2021/hash/0f2818101a7ac4b96ceeba38de4b934c-Abstract.html)</sup><sup> • </sup><sup>[10](https://bitsnotes.com/view/unsupervised-deep-learning/from-cyclegan-to-diffusion-models)</sup>。

## References

1. [Isola, P., Zhu, J.-Y., Zhou, T., Efros, A. A. Image-to-Image Translation with Conditional Adversarial Networks. arXiv:1611.07004](https://arxiv.org/abs/1611.07004)
2. [Isola et al., CVPR 2017 Open Access page](https://openaccess.thecvf.com/content_cvpr_2017/html/Isola_Image-To-Image_Translation_With_CVPR_2017_paper.html)
3. [Unsupervised Image-to-Image Translation: A Review, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC9654990/)
4. [pix2pix implementation notes (U-Net, PatchGAN, training hyperparameters), GitHub](https://github.com/chefnoob123/pix2pix)
5. [Kong, L. et al. Breaking the Dilemma of Medical Image-to-image Translation. NeurIPS 2021](https://papers.nips.cc/paper_files/paper/2021/hash/0f2818101a7ac4b96ceeba38de4b934c-Abstract.html)
6. [Is image-to-image translation the panacea for multimodal image registration? A comparative study, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC9704666/)
7. [Data synthesis and adversarial networks: A review and meta-analysis in cancer imaging, Medical Image Analysis](https://doi.org/10.1016/j.media.2022.102704)
8. [Examples and Use Cases, pix2pix documentation (DeepWiki)](https://deepwiki.com/phillipi/pix2pix/1.2-examples-and-use-cases)
9. [Analysis of Pix2Pix and CycleGAN for Image-to-Image Translation: A Comparative Study, IEEE ICSPCRE 2024](https://ieeexplore.ieee.org/document/10674804/)
10. [From CycleGAN to Diffusion Models, UDL Lecture 13 notes](https://bitsnotes.com/view/unsupervised-deep-learning/from-cyclegan-to-diffusion-models)
11. [Shizuoka University repository: SAR-to-optical translation review](https://shizuoka.repo.nii.ac.jp/record/2001650/files/250620001.pdf)
12. [Zhu, J.-Y. et al. Unpaired Image-to-Image Translation Using Cycle-Consistent Adversarial Networks, ICCV 2017](https://openaccess.thecvf.com/content_ICCV_2017/papers/Zhu_Unpaired_Image-To-Image_Translation_ICCV_2017_paper.pdf)
13. [Lightweight CycleGAN models for cross-modality image transformation in fluorescence microscopy, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC13064623/)
14. [Breaking the Dilemma of Medical Image-to-image Translation, NeurIPS 2021 proceedings PDF](https://proceedings.neurips.cc/paper/2021/file/0f2818101a7ac4b96ceeba38de4b934c-Paper.pdf)
15. [Deep Generative Adversarial Networks for Image-to-Image Translation: A Review, MDPI Symmetry](https://www.mdpi.com/2073-8994/12/10/1705)
16. [One-Step Image Translation with Text-to-Image Models, arXiv:2403.12036](https://arxiv.org/abs/2403.12036)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Neural networks and deep learning › Neural network architectures › Generative adversarial and variational architectures

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/pix2pix

English original: https://www.edgepedia.org/pix2pix
