0

I am not sure what’s the common practice to load a pre-trained keras model into a Java code?

I saw deeplearning4j and Google's native Java support.

Surprisingly, google says:

Caution: The TensorFlow Java API is not covered by the TensorFlow API stability guarantees.

I am really confused, what's going on here and what are consideration I need to take before choosing a tensorflow Java engine. Obviously I would like to support the latest CUDA/ cuDNN. My application runs on PCs it's not a mobile application.

0x90
  • 39,472
  • 36
  • 165
  • 245

1 Answers1

1

You can follow these steps :

  1. You can use TensorFlow Lite or TensorFlow Mobile. TensorFlow Lite is recommended. Visit here.
  2. TensorFlow Lite has a gradle as well as maven dependency which is useful in Android and java.
  3. To convert your python model to TF Lite file use functions in this notebook
  4. It can run inferences on the model which you trained in python. But, TF Lite has issues with LSTM cells and BatchNormalization layers.
  • My application works on HPC. Can you add some note about that as well? – 0x90 Dec 18 '18 at 11:41
  • @0x90: please check this, as it talks about Tensorflow on HPC: http://randomlydistributed.blogspot.com/2016/05/tensorflow-on-hpc-blue-waters.html . maybe this would help? – a3.14_Infinity Dec 19 '18 at 05:11
  • @a3.14_Infinity, thanks. Is it still based practice? the post is from 2016. What if I want it to run also on a regular PC with strong GPU? – 0x90 Dec 19 '18 at 05:12