1

I am implementing GAN (generative adversarial network) in keras from here. In this code after every 20 epoch image is showed and saved. But i donot want to show image and just want to save. so i just commented line number 89 from code, which is following:

plt.imshow(generatedImages[i], interpolation='nearest', cmap='gray_r'). but after commenting this line blank images saved, and also blank images poped up. but when i remove comment and run full code, images saved properly. accoeding to me imshow is used to used images, it doesn't part in constructing images. why this happens.

Hitesh
  • 1,285
  • 6
  • 20
  • 36
  • 1
    `imshow()` is the command that plots the content of the array to the axes, so without it, no images are drawn. What you want is to turn off matplotlib's "interactive" mode – Diziet Asahi Oct 26 '18 at 11:22
  • thnx @DizietAsahi for reply, may you plz help , how to turn off iteractive mode – Hitesh Oct 26 '18 at 11:24
  • 1
    Similar question, and already has an accepted answer: https://stackoverflow.com/questions/15713279/calling-pylab-savefig-without-display-in-ipython – Melih Taşdizen Oct 26 '18 at 11:27
  • 1
    Possible duplicate of [Python Headless MatplotLib / Pyplot](https://stackoverflow.com/questions/5503601/python-headless-matplotlib-pyplot) – Diziet Asahi Oct 26 '18 at 11:28
  • plt.close() works for me, and it's better solution, because if off interactive mode then image will not display but in background it will open ( i am not sure). – Hitesh Oct 26 '18 at 12:05

0 Answers0