A stubbornly faithful TensorFlow port of pix2pix
This is a line-by-line TensorFlow translation of the classic pix2pix GAN, built for fidelity rather than feature creep.

What it does This repo implements Isola et al.’s pix2pix in TensorFlow, learning to map input images to output images—think architectural labels to photos, or sketches to shoes. It consumes side-by-side image pairs to train a conditional GAN, then generates an HTML gallery comparing inputs, outputs, and targets. A dedicated colorization mode handles single images by splitting them into lightness and color channels.
The interesting bit Unlike later rewrites, this port was built directly from the original Torch code rather than from an existing TensorFlow version, aiming for near-photocopy fidelity. The author notes that GPU training speed with cuDNN matched the Torch implementation, which matters more than it sounds if you are trying to reproduce a 2016 paper beat-for-beat.
Key highlights
- Explicitly a faithful port: the author states it “does not add anything” to the original work.
- Targets TensorFlow 1.4.1 and includes a Docker image for environment isolation.
- Supports paired-image translation (
AtoBorBtoA) and a--lab_colorizationmode for grayscale-to-color work. - Test runs emit an
index.htmlfile that lines up inputs, outputs, and targets for easy visual inspection. - Pre-trained models and dataset download scripts are provided for facades, cityscapes, maps, edges2shoes, and edges2handbags.
Caveats
- Requires TensorFlow 1.4.1, so expect archaeology when integrating with modern stacks.
- Three original variants remain unimplemented:
defineG_encoder_decoder,defineG_unet_128, anddefineD_pixelGAN. - The codebase is strictly a reproduction, so do not expect modern conveniences or architectural tweaks.
Verdict Use this if you need a reference-quality TensorFlow reproduction of classic pix2pix for research or education. Skip it if you want a maintained modern implementation or need the missing generator and discriminator variants.
Frequently asked
- What is affinelayer/pix2pix-tensorflow?
- This is a line-by-line TensorFlow translation of the classic pix2pix GAN, built for fidelity rather than feature creep.
- Is pix2pix-tensorflow open source?
- Yes — affinelayer/pix2pix-tensorflow is open source, released under the MIT license.
- What language is pix2pix-tensorflow written in?
- affinelayer/pix2pix-tensorflow is primarily written in JavaScript.
- How popular is pix2pix-tensorflow?
- affinelayer/pix2pix-tensorflow has 5.1k stars on GitHub.
- Where can I find pix2pix-tensorflow?
- affinelayer/pix2pix-tensorflow is on GitHub at https://github.com/affinelayer/pix2pix-tensorflow.