Loading and inference with a pre-trained model

The trained model, 'QDrawModel.h5', which has been run for 25 epochs and achieved a test accuracy of just over 90%, has been saved in the repository. You have already seen this code; it is reproduced here for your convenience.

So, to reiterate, you can load this trained model with the following code:

from keras.models import load_modelmodel = load_model('./QDrawModel.h5')model.summary()

Again, the training/test data can be loaded with the following code:

import h5pyimport numpy as nphf = h5py.File('x_train.h5', 'r')x_train = np.array(hf["QuickDraw"][:])hf = h5py.File('x_test.h5', 'r')x_test = np.array(hf["QuickDraw"][:])hf = h5py.File('y_train.h5', 'r')y_train = np.array(hf["QuickDraw"][:])

Get TensorFlow 2.0 Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.