Machine learning TypeError:无法将符号Keras输入/输出转换为numpy数组

Machine learning TypeError:无法将符号Keras输入/输出转换为numpy数组,machine-learning,deep-learning,neural-network,conv-neural-network,mobilenet,Machine Learning,Deep Learning,Neural Network,Conv Neural Network,Mobilenet,我试图在我的预训练模型上做一个预测,我总共有40个类,它以ε数向我显示预测,我想从中选择最大值,通过使用if-else,我想对它进行分类。这是给我以上的错误 from keras.applications.inception_resnet_v2 import preprocess_input from tensorflow.keras.preprocessing import image from tensorflow.keras.applications import imagenet_uti

我试图在我的预训练模型上做一个预测,我总共有40个类,它以ε数向我显示预测,我想从中选择最大值,通过使用if-else,我想对它进行分类。这是给我以上的错误

from keras.applications.inception_resnet_v2 import preprocess_input
from tensorflow.keras.preprocessing import image
from tensorflow.keras.applications import imagenet_utils
import numpy as np


def prepare_image(file):
    img_path = '/content/drive/MyDrive/test imgs/'
    img = image.load_img(img_path + file, target_size=(224, 224))
    img_array = image.img_to_array(img)
    img_array_expanded_dims = np.expand_dims(img_array, axis=0)
    return tf.keras.applications.inception_resnet_v2.preprocess_input(img_array_expanded_dims)
    
model = tf.keras.models.load_model("CNN ResNet.h5")
preprocessed_image = prepare_image('mcd.jpg')
predictions = model.predict(preprocessed_image)
print(predictions)
highest=np.argmax(prediction,axis=1)
print("Highest position : ", highest)
if(highest==0):
    print("This class is Acer")

那么您想从softmax probabilities获取类名?还抛出了哪一行错误?