Making Predictions

Subscribe to Tech With Tim!

Using the Model

Now that we have trained the model it is time to actually use it! We will pick a few images from our testing data, show them on the screen and then use the model to predict what they are.

To make predictions we use our model name and .predict() passing it a list of data to predict. It is important that we understand it is used to make MULTIPLE predictions and that whatever data it is expecting mus be inside of a list. Since it is making multiple predictions it will also return to use a list of predicted values.

predictions = model.predict(test_images)

Now we will display the first 5 images and their predictions using matplotlib.

for i in range(5):