scipy库的替代方法

scipy库的版本不一致报错

1、imread

AttributeError: module ‘scipy.misc‘ has no attribute ‘imread‘

before:img = scipy.misc.imread(myImage)

after:

import imageio

img = imageio.imread(myImage)

2、imresize()

AttributeError: module ‘scipy.misc‘ has no attribute ‘imresize‘

before:img = scipy.misc.imresize(myImage, size=(num_px,num_px))

after:

from PIL import Image

img = np.array(Image.fromarray(myImage).resize((num_px,num_px)))

 

 

 

posted @ 2021-03-24 14:18  临近边缘  阅读(280)  评论(0)    收藏  举报