【发布时间】:2019-08-17 03:23:34
【问题描述】:
每次使用 resnet50 深度学习模型在 decode_predictions 中引发错误消息时,我都会发现植物病害检测错误
错误
预期一批预测(即形状的二维数组(样本,1000))。找到形状为:(1, 38)"的数组
enter code here
model = ResNet50(weights='imagenet',include_top=False,classes=38)
try:
model = load_model('/content/drive/My
Drive/color/checkpoints/ResNet50_model_weights.h5')
print("model loaded")
except:
print("model not loaded")
img_path = '/content/drive/My Drive/color/test/0/appleblackrot188.jpg'
img = image.load_img(img_path, target_size=(300, 300))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)
preds = model.predict(x)
print('Predicted:', decode_predictions(preds,top=3)[0])
【问题讨论】:
-
您的帖子很难理解。请检查formatting help - 我认为第一段需要a little
bitformatting! -
先生,我想预测 38 个类别之间的植物图像,但它在代码中显示最后一行代码有错误,请检查代码
标签: tensorflow keras deep-learning transfer-learning