ValueError:layer sequential的输入0与layer::expected min\u ndim=4不兼容,found ndim=3。收到完整形状:(无、1024、3)

2024-06-25 23:43:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我在图像处理机器学习中的预测代码有一个错误,这是我的代码

# load the trained model
model = load_model('./model/modelLeNet5.h5')
x=(img1/255)

# predict the input image using the loaded model
pred1 = model.predict_classes(x)

错误显示:

ValueError: Input 0 of layer sequential is incompatible with the layer: : expected min_ndim=4, found ndim=3. Full shape received: (None, 1024, 3)


Tags: the代码机器layerinputmodel错误load