解决AttributeError: module ‘scipy.ndimage‘ has no attribute ‘imread‘
在吴恩达的deeplearning的01-Week4 的作业中,最后的:
7) Test with your own image (optional/ungraded exercise)
出现:AttributeError: module ‘scipy.ndimage‘ has no attribute ‘imread‘
电脑中无法修改scipy的版本时,采用了以下的方法。
改成
my_image = "thumbs_up.jpg"
## END CODE HERE ##
# We preprocess your image to fit your algorithm.
fname = my_image
image = np.array(plt.imread(fname))
my_image = np.array(Image.fromarray(image).resize(size=(64,64))).reshape((64*64*3,1))
my_image_prediction = predict(my_image, parameters)
plt.imshow(image)
print("Your algorithm predicts: y = " + str(np.squeeze(my_image_prediction)))