O'Reilly logo

Deep Learning By Example by Ahmed Menshawy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing the model

Let's test the trained model against the test set part of the CIFAR-10 dataset. First, we are going to define a helper function that will help us to visualize the predictions of some sample images and their corresponding true labels:

#A helper function to visualize some samples and their corresponding predictionsdef display_samples_predictions(input_features, target_labels, samples_predictions):  num_classes = 10  cifar10_class_names = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck']label_binarizer = LabelBinarizer() label_binarizer.fit(range(num_classes)) label_inds = label_binarizer.inverse_transform(np.array(target_labels))fig, axies = plt.subplots(nrows=4, ncols=2) fig.tight_layout() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required