I have a fined-tuned vgg model and I created the model using tensorflow.keras functional API and saved the model using tf.contrib.saved_model.save_keras_model. So the model is saved with this structure: assets folder which contains saved_model.json file, saved_model.pb file, and the variables folder, which contain checkpoint, variables.data-00000-of-00001 and variables.index.
I can easily load my model in python and get predictions using tf.contrib.saved_model.load_keras_model(saved_model_path), but I have no idea how to load the model in JAVA. I googled a lot and found this How to export Keras .h5 to tensorflow .pb? to export as pb file and then load it up following this link Loading in Java. I was not able to freeze the graph and also I tried to use simple_save but the tensorflow.keras does not support simple_save (AttributeError: module 'tensorflow.contrib.saved_model' has no attribute 'simple_save'). So can someone help me to figure out what steps are needed to load my model (tensorflow.keras functional API model) in JAVA.
Is the saved_model.pb file that I have, good enough to be loaded on the JAVA side? Do I need to create my input/output place holders? Then how can I export it?
I appreciate your help.