How to convert tensorflow.js model and weights to standard tensorflow?

*爱你&永不变心* 提交于 2020-06-25 05:19:09

问题


I want to convert a model and its respective trained weights from tensorflow.js to standard tensorflow, but cant quite figure out how to do it, the documentation of tensorflow.js dont say anything about this

I have a manifest.json and a lot of other files corresponding to the weights and bias of every layer, I want to get a .bytes file, to be used in the standard version of tensorflow

I checked the answers to other question that might be mildly related How to download models and weights from tensorflow.js (I asked that question) which was only partially answered, answer that doesnt give any hints regarding this one


回答1:


Tensorflow.js converter can convert the tfjs model into Keras HDF5 format with following params:

tensorflowjs_converter --input_format=tfjs_layers_model --output_format=keras path/to/tfjs_files path/to/save_keras_hdf5

You can take a look here for installing the converting. Once the model is converted to Keras HDF5 you can convert it the TensorFlow SavedModel format. So, this thread might be helpful.



来源:https://stackoverflow.com/questions/54242701/how-to-convert-tensorflow-js-model-and-weights-to-standard-tensorflow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!