- 原始代码:
from keras.preprocessing import image img = image.load_img(img_path,target_size=(224,224)) x = image.img_to_array(img)
- 报错:
AttributeError: module 'keras.preprocessing.image' has no attribute 'load_img'
- 原因:keras版本更新了
- 解决:
from keras.utils import image_utils img = image_utils.load_img(img_path,target_size=(224,224)) x = image_utils.img_to_array(img)
报错AttributeError: module ‘keras.preprocessing.image‘ has no attribute ‘load_img‘
于 2022-09-13 14:43:25 首次发布