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/
1条答案
按热度按时间krcsximq1#
它现在已移至
tf.keras.utils.img_to_array
。请参阅docs