Load keras model in Java

What are the requirements to load the trained model by Keras in Java?

I checked that DeepLearning4J supports Keras models, network architecture and weights can be easily loaded. The only cons are probably that we need to use ND4J backend or it does not matter?

If there is a created model using keras and tensorflow, what is the best way to load it in Java ecosystem?

I tried to use frozen graph script to save tensorflow model, but it cannot be loaded with SavedModel.load. Loading model as a Tensor Graph object seems to be common way, but available examples in Java are chaos especially when input is an image.

Topic keras java

Category Data Science


Giving you some links which have worked:

deploying-keras-deep-learning-models-with-java : this uses DeepLearning4J, ND4J which supposedly you have tried already.

tensorflow-keras-java

And same question is asked here - converting-keras-in-python-to-java . It uses KerasModelImport.importKerasSequentialModelAndWeight

You should give HDF5 file operation java examples: hdf-java . It would be helpful if you want to change the weights yourself

Please comment if you have already tried all these already.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.