Created
December 4, 2016 20:55
-
-
Save thomprycejones/3b08d9e60d00311670f964bc7456b336 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the model | |
DataInputStream dis = new DataInputStream(new FileInputStream(MODEL_path)); | |
INDArray newParams = Nd4j.read(dis); | |
dis.close(); | |
// Open the model | |
MultiLayerNetwork deserializedModel = ModelSerializer.restoreMultiLayerNetwork(dis); | |
// Get the imageFile (sized 28x28) and convert to INDArray | |
NativeImageLoader nativeImageLoader = new NativeImageLoader(); | |
INDArray indArray = nativeImageLoader.asMatrix(imageFile); | |
// Do the magic (we have to sort it!) | |
deserializedModel.output(indArray).data(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment