最近在看吴恩达的深度学习课程。
由于课程较早,当前Python中运用的很多模块都已经升级,导致相应的方法会出现报错。
今天在做Tensorflow+Tutorial作业的时候就出现了标题中的错误:
AttributeError: module ‘scipy.ndimage’ has no attribute ‘imread’
百度后发现是由于scipy版本升级所致,这样一来大部分文章的建议都是对scipy进行降级。
为了避免后续的使用(其实主要是懒),我还是找到了一种用matplotlib读取图片的方式替代scipy模块。
原链接:https://blog.csdn.net/weixin_47360674/article/details/107265396
import scipy
import matplotlib
from PIL import Image
from scipy import ndimage
## START CODE HERE ## (PUT YOUR IMAGE NAME)
my_image