File Exchange

image thumbnail


version 1.0.0 (4.57 MB) by Justin Pinkney
Image to Image Translation Using Generative Adversarial Networks


Updated 12 May 2020

GitHub view license on GitHub

This repository contains MATLAB code to implement the pix2pix image to image translation method described in the paper by Isola et al. Image-to-Image Translation with Conditional Adversarial Nets.

For an example you can directly run in MATLAB see the Getting Started live script.

If you have any trouble using this code, report any bugs, or want to request a feature please use the GitHub issues:

Copyright 2020 The MathWorks, Inc.

Cite As

Justin Pinkney (2020). pix2pix (, GitHub. Retrieved .

Comments and Ratings (7)

If anyone else is running into the PrepForPlot issue please make sure you've got the latest code as it's now fixed (see this GitHub issue

Hi Gyuyoung Hwang - I'm hoping you see this comment if you're still searching for an answer. The error is the result of a mis-capitalization in the TrainingPlot class. Simply change the call to obj.PrepForPlot in the TrainingPlot.update function to obj.prepForPlot and that should fix your issue!

Unrecognized method, property or field 'PrepForPlot' for class 'p2p.vis.TrainingPlot'.

p2p.vis.TrainingPlot/updateImages (line 63)
displayIm = obj.PrepForPlot(output);
p2p.vis.TrainingPlot/update (line 47)

p2p.train (line 100)
trainingPlot.update(logArgs{:}, g);

오류 발생: Untitled (line 4)
p2pModel = p2p.train(labelFolder, targetFolder, options);

i got some sequential error.
how can I deal with this?

Reham Barah

Thanks for the comment Atallah, for those interested there is more discussion in the GitHub issue here:

I ended up by using a matRead file and it is working so far.

Hey Justin,

Thank you a lot for a clearly written code.

I have tried though on data with ".mat" (as input and output) and the code seems to crash.

I have tried many troubleshooting strategies but none worked.

Do you have an idea how to adjust it in order to include .mat files ?


MATLAB Release Compatibility
Created with R2019b
Compatible with R2019b to any release
Platform Compatibility
Windows macOS Linux