Skip to Content
Neural Network Projects with Python
book

Neural Network Projects with Python

by James Loy
February 2019
Beginner to intermediate
308 pages
7h 42m
English
Packt Publishing
Content preview from Neural Network Projects with Python

Analyzing the results

Let's apply our model on the withheld testing set to see how well it does. Remember, our model has never seen the images and subjects from the testing set, so this is a good measurement of its real-world performance.

First, we pick two images from the same subject, plot them out side by side, and apply the model to this pair of images:

idx1, idx2 = 21, 29img1 = np.expand_dims(X_test[idx1], axis=0)img2 = np.expand_dims(X_test[idx2], axis=0)fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10,7))ax1.imshow(np.squeeze(img1), cmap='gray')ax2.imshow(np.squeeze(img2), cmap='gray')for ax in [ax1, ax2]:    ax.grid(False)    ax.set_xticks([])    ax.set_yticks([])dissimilarity = model.predict([img1, img2])[0][0]fig.suptitle("Dissimilarity ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Machine Learning with Python Cookbook

Machine Learning with Python Cookbook

Chris Albon

Publisher Resources

ISBN: 9781789138900Supplemental Content