dragen1860 / TensorFlow-2.x-Tutorials

TensorFlow 2.x version's Tutorials and Examples, including CNN, RNN, GAN, Auto-Encoders, FasterRCNN, GPT, BERT examples, etc. TF 2.0版入门实例代码,实战教程。
6.38k stars 2.24k forks source link

13-DCGCN error #40

Open shersoni610 opened 4 years ago

shersoni610 commented 4 years ago

Hello,

I get the following error for 13-DCGAN program: (base)@blackhole:$ python main.py Traceback (most recent call last): File "main.py", line 5, in from scipy.misc import toimage ImportError: cannot import name 'toimage' from 'scipy.misc' (/home/csverma/Disk/Software/Anaconda3/lib/python3.7/site-packages/scipy/misc/init.py)

pc2005 commented 4 years ago

I ran into the same issue, and here is my solution.

toimage is deprecated in scipy since 1.0 and removed in 1.2. You have two options here:

  1. Rollback scipy to version <=1.1. Just need to tolerate some warning messages.
  2. Use PIL Image object instead: from PIL import Image ...

    replace toimage call

    im = Image.fromarray(final_image)
    im.save(image_path)

    ...