Frozen Model conversion issues
When converting Frozen Model, a pb file and a JSON file and a group1-shard1of1 file will be generated. Is this normal?
The format in the JSON file is like this
[
{
"path": [],
"weights": []
}
]
tensorflowjs 0.8.6
Yes that is expected given that version of TensorFlow.js you are using. Newer versions do not produce the pb file.
To converter a frozen model and be compatible with the latest tfjs version, use the following steps:
- I have a model formatted as a Session bundle or Frozen model. How do I convert it to TensorFlow.js?
You can install a previous version of TensorFlow.js in a virtual environment to convert the model to the JSON format. Here is how you can achieve this.
- Set up the virtual environment:
virtualenv --no-site-packages venv. venv/bin/activate pip install tensorflowjs==0.8.6
venv is the name of the virtual environment.
- Convert a session bundle model:
tensorflowjs_converter
--input_format=tf_session_bundle
--output_json=true
--output_node_names='MobilenetV1/Predictions/Reshape_1'
/mobilenet/session_bundle
/mobilenet/web_model
- Convert a frozen model:
tensorflowjs_converter
--input_format=tf_frozen_model
--output_json=true
--output_node_names='MobilenetV1/Predictions/Reshape_1'
--saved_model_tags=serve
/mobilenet/frozen_model.pb
/mobilenet/web_model
On Mon, Sep 2, 2019 at 11:23 AM 曲智超 [email protected] wrote:
@tafsiri https://github.com/tafsiri So how to use them?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tensorflow/tfjs/issues/1945?email_source=notifications&email_token=AAAA7MSNTDGYDHD7VR2IAS3QHSBJPA5CNFSM4ISI4CKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5UTFXQ#issuecomment-526987998, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAA7MV6YW4J44VOSSVKL3LQHSBJPANCNFSM4ISI4CKA .
For Converting Frozen_inference_model.pb to tensroflowjs(model.json) : Please Refer this Link : https://github.com/tensorflow/tfjs-models/blob/master/deeplab/scripts/convert_deeplab.sh
For Converting Frozen_inference_model.pb to tensroflowjs(model.json) : Please Refer this Link : https://github.com/tensorflow/tfjs-models/blob/master/deeplab/scripts/convert_deeplab.sh
tensorflowjs_converter
--input_format=tf_frozen_model
--output_json=true
--saved_model_tags=serve
--output_node_names='SemanticPredictions'
--quantization_bytes 2
frozen_inference_graph.pb
$OUTPUT_DIR