tensorflow 属性错误:模块'keras.preprocessing.image'没有属性'img_to_array'

rxztt3cl  于 2022-12-13  发布在  其他
关注(0)|答案(1)|浏览(508)

I have added following libraries and half part of the code is executing. In second half I get this error.
Libraries added:

#importing libraries
import keras
import tensorflow as tf
from tensorflow.keras.applications.resnet50 import ResNet50, preprocess_input
from tensorflow.keras.utils import img_to_array

Error: AttributeError: module 'keras.preprocessing.image' has no attribute 'img_to_array'
I was following this code and changes the libraries too still can't resolve the issue. https://www.analyticsvidhya.com/blog/2021/06/k-means-clustering-and-transfer-learning-for-image-classification/

krcsximq

krcsximq1#

它现在已移至tf.keras.utils.img_to_array。请参阅docs

相关问题