marcogdepinto / PanoramaModelServing

Using Java and deeplearning4j to serve a Keras model.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keras model deploying with Java

Starting from another project I made to classify images using Keras (https://github.com/marcogdepinto/ScenarioClassifier), I had the idea to work on a Deploy class in Java.

Deploy means placing the model in production: this class can be, for example, included in a Spring Boot Application and consumed via API calls.

The library used is DeepLearning4j.

Model

Please download the model from this link (it exceeds 100 megabytes so it can't stay on Github) and place it in the resource folder.

Output

city

Passing the above picture as input, the class will return the following information

[city, desert, mountain, nature, sea, universe]
[[    1.0000,         0,         0,         0,         0,         0]]
[1.0, 0.0, 0.0, 0.0, 0.0, 0.0]
city

Output explanation

  • The first line is an array with the labels.
  • The second line includes an array with the predicted percentage per class.
  • The third line is given as output to match the labels and the array of predictions.
  • The forth line is the prediction in human-readable language.

About

Using Java and deeplearning4j to serve a Keras model.


Languages

Language:Java 100.0%