使用真实世界模型
好的,Ivy 的照片已经可以用于 ResNet50 了。它存放在 img_ready 中,现在看起来如下:
ResNet50 是在 Imagenet 数据集上训练的模型,能够区分 1000 种不同的已标注对象。ResNet50 是一个具有 50 层的深度模型,您可以在这里查看它的 3D 结构:here。
ResNet50 和 decode_predictions 已为您从 tensorflow.keras.applications.resnet50 导入。
现在就用这个训练好的模型来找出 Ivy 的犬种吧!
本练习是课程的一部分
Keras 深度学习入门
练习说明
- 实例化一个
ResNet50模型,将 weights 参数设为'imagenet'。 - 使用该
model对已处理的图像进行预测。 - 使用
decode_predictions()解码前 3 个预测结果。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Instantiate a ResNet50 model with 'imagenet' weights
model = ____(weights=____)
# Predict with ResNet50 on your already processed img
preds = ____.____(____)
# Decode the first 3 predictions
print('Predicted:', ____(____, top=____)[0])