Skip to content

Instantly share code, notes, and snippets.

@plankes-projects
Last active September 28, 2016 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plankes-projects/34fdcac26eee7a1a4ac4266504083724 to your computer and use it in GitHub Desktop.
Save plankes-projects/34fdcac26eee7a1a4ac4266504083724 to your computer and use it in GitHub Desktop.
How to predict one image with a model from DeepLearning4j
INDArray predict(MultiLayerNetwork model, File imageFile) throws Exception {
ImageLoader imageLoader = new ImageLoader(Config.IMAGE_WIDTH, Config.IMAGE_HEIGHT, Config.CHANNELS);
INDArray image = imageLoader.asRowVector(imageFile);
return model.output(image);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment