[英]Export tensorflow weights to hdf5 file and model to keras model.json
如果您使用Keras,則可以執行以下操作。
model.save_weights('my_model.hdf5')
我看到此工作的唯一方法是,如果您使用Keras
模型作為TensorFlow
工作流程的接口。 如果這樣做,則可以執行以下操作以保存模型及其權重:
# 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)
使用更多的信息Keras
作為一個接口Tensorflow
工作流程在這里: https://blog.keras.io/keras-as-a-simplified-interface-to-tensorflow-tutorial.html#using-keras-models-with-tensorflow
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.