Skip to content Skip to sidebar Skip to footer

Export Tensorflow Weights To Hdf5 File And Model To Keras Model.json

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

Solution 1:

If you are using Keras, you can do something like this.

model.save_weights('my_model.hdf5')

Solution 2:

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 modelwithopen(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

Post a Comment for "Export Tensorflow Weights To Hdf5 File And Model To Keras Model.json"