I recently found this Project which runs inference of keras model in a browser with GPU support using webgl. I have a few tensorflow project that I would like to run inference on a browser, is there a way to export tensorflow models into hdf5 file so it can be run using keras-js
Asked
Active
Viewed 3,442 times
0
-
You can check my answer on this issue in another thread. https://stackoverflow.com/questions/44466066/how-can-i-convert-a-trained-tensorflow-model-to-keras/46210187#46210187 – Prasad Sep 14 '17 at 03:48
2 Answers
0
If you are using Keras, you can do something like this.
model.save_weights('my_model.hdf5')

Wasi Ahmad
- 35,739
- 32
- 114
- 161
0
The only way I can see this working is if you use a Keras
model as an interface to your TensorFlow
workflow. If you do that, you can do this to save the model and its weights:
# save model
with open(model_save_filename, "w") as model_save_file:
model_json = model.to_json()
model_save_file.write(model_json)
# save model weights
model.save_weights(model_weights_save_filename)
More information on using Keras
as an interface to Tensorflow
workflows here: https://blog.keras.io/keras-as-a-simplified-interface-to-tensorflow-tutorial.html#using-keras-models-with-tensorflow

Robert Valencia
- 1,752
- 4
- 20
- 36