我将tensorflow版本从最新版本更改为2.0.1,现在错误在上面:有人可以帮助我吗?
import cv2
import numpy as np
import tensorflow as tf
Categories = ["Badshahi Masjid", "Minare Pakistan", "ShahiQila(Lahore Fort)"]
sift = cv2.xfeatures2d.SIFT_create()
print(tf.__version__)
def prepare(filepath):
IMG_SIZE = (124, 124)
img_array = cv2.imread(filepath, cv2.IMREAD_GRAYSCALE)
new_array = cv2.resize(img_array, IMG_SIZE)
keyImage, desImage = sift.detectAndCompute(new_array, None)
feat = np.sum(desImage, axis=0)
return feat
model = tf.keras.models.load_model("SuperClassPredictions.h5")
prediction = model.predict([prepare('E:\Python Telusko\OpenCv\download.jpg')])
print(prediction)
print(Categories[int(prediction[0][0])])