Loading the model

Now, we will try to load the saved model and use it to create predictions. MXNet implements the mx.load_checkpoint function, which requires the following set of parameters:

  • prefix: This defines the prefix of the file names to save the model
  • epoch: Epoch number

Please ensure that you have run the code from the previous activity so that you have all of the required files in place. We will be loading the weights for the 10th epoch:

new_nnet = mx.load_checkpoint(cp_prefix, 10, mx.FeedForward);

Now, you are ready to create the predictions:

data_array = mx.zeros((size(test_x, 1, 2)..., 10));mx.copy!(data_array, test_x[:, :, 1:10]);data_provider = mx.ArrayDataProvider(:data => data_array);results = round.(mx.predict(new_nnet ...

Get Hands-On Computer Vision with Julia 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.