Using a real world model
Okay, so Ivy's picture is ready to be used by ResNet50. It is stored in img_ready and now looks like this:
ResNet50 is a model trained on the Imagenet dataset that is able to distinguish between 1000 different labeled objects. ResNet50 is a deep model with 50 layers, you can check it in 3D here.
ResNet50 and decode_predictions have both been imported from tensorflow.keras.applications.resnet50 for you.
It's time to use this trained model to find out Ivy's breed!
This exercise is part of the course
Introduction to Deep Learning with Keras
Exercise instructions
- Instantiate a
ResNet50model, setting the weights parameter to be'imagenet'. - Use the
modelto predict on your processed image. - Decode the first 3 predictions with
decode_predictions().
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# 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])