一、关于tensorflow版本的问题
1.源代码中的tensorflow版本是1.x,然而我自己下载的是tensorflow2.x版本,因此导致许多问题。
解决方法1:在程序前加compat.v1.
例如 x = tf.placeholder()报错,则改成x = tf.compat.v1.placeholder()
2.AttributeError: module 'scipy.misc' has no attribute 'imread'
from scipy import misc
img = misc.imread(image_path)
解决方法:
import imageio
img = imageio.imread(image_path)
3.AttributeError: module 'scipy.misc' has no attribute 'imresize'
from scipy import misc
scaled_temp = misc.imresize(cropped_temp, (image_size, image_size), interp='bilinear')
解决方法:
from skimage.transform import resize
scaled_temp = resize(cropped_temp,output_shape=(image_size, image_size))
4.AttributeError: module 'scipy.misc' has no attribute 'imsave'
from scipy import misc
misc.imsave(output_filename, scaled_temp)
解决方法:
import imageio
imageio.imwrite(output_filename,scaled_temp)
参考:无需降级scipy,解决AttributeError: module ‘scipy.misc’ has no attribute ‘imread’,imresize,imsave问题_bug_Paul-Huang-华为云开发者联盟 (csdn.net)