有人请详细说明此错误,并告诉我该如何解决,我正在提供128个预期输入,但仍然给我错误,这是什么?
import cv2
import numpy as np
import tensorflow as tf
Categories = ["SubCLassesOFShahiQila\Deewane aam", "SubCLassesOFShahiQila\Lahore Fort Museum",
"SubCLassesOFShahiQila\Moti masjid", "SubCLassesOFShahiQila\Sheesh Mahal"]
sift = cv2.xfeatures2d.SIFT_create()
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("mlp_model.h5")
prediction = model.predict([prepare('E:\Python Telusko\OpenCv\download.jpg')])
print(prediction)
print(Categories[int(prediction[0][0])])