O'Reilly logo

Java Deep Learning Projects by Md. Rezaul Karim

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

Restoring the saved model for inferencing

Now that we have finished the training, and the trained model is at hand, we can either directly use that trained one on the fly as well as restore the saved model from disk, or start the inferencing. Take a look at this code:

System.out.println("Restoring model...");net = ModelSerializer.restoreMultiLayerNetwork(locationToSave);//print the score with every 1 iterationnet.setListeners(new ScoreIterationListener(1));//Print the number of parameters in the network (and for each layer)Layer[] layers = net.getLayers(); int totalNumParams = 0;for( int i=0; i<layers.length; i++ ){        int nParams = layers[i].numParams();        System.out.println("Number of parameters in layer " + i + ": " + nParams); totalNumParams ...

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