tensorflowjs兼容版本tf==1.15用于tf_saved_model到tfjs的转换

46scxncf  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(114)

我在tensorflow中训练了一个目标检测模型。
我的环境:
tf version == 1.15,network== ssd mobilnet v2
现在我想将我的saved_model(.pb)文件转换为tfjs(.json)格式。
我遵循以下步骤--

pip install tensorflowjs==0.8.6 # not sure if it's compatible with tf version 1.15

指挥官:

tensorflowjs_converter --input_format=tf_saved_model --output_format=tfjs_graph_model --signature_name=serving_default --saved_model_tags=serve exported_path/saved_model exported_path/web_model_path

错误代码:

AttributeError: module 'keras_applications' has no attribute 'set_keras_submodules'

然后我降低keras_application版本。
现在得到错误,

usage: TensorFlow.js model converters. [-h]
                                       [--input_format {keras,tf_session_bundle,keras_saved_model,tf_hub,tf_saved_model,tensorflowjs,tf_frozen_model}]
                                       [--output_format {keras,tensorflowjs}]
                                       [--output_node_names OUTPUT_NODE_NAMES]
                                       [--signature_name SIGNATURE_NAME]
                                       [--saved_model_tags SAVED_MODEL_TAGS]
                                       [--quantization_bytes {1,2}]
                                       [--split_weights_by_layer] [--version]
                                       [--skip_op_check SKIP_OP_CHECK]
                                       [--strip_debug_ops STRIP_DEBUG_OPS]
                                       [--output_json OUTPUT_JSON]
                                       [input_path] [output_path]
TensorFlow.js model converters.: error: argument --output_format: invalid choice: 'tfjs_graph_model' (choose from 'keras', 'tensorflowjs')

因此,在output_format中没有tf_graph_model选项。
现在,当我安装pip install tensorflowjs(不传递任何特定版本)时,它会安装tfjs==3.3.0,并卸载我当前的tf1.15并安装新的tf2.x版本。这是我必须不惜一切代价避免的。
如何在版本tensorflow==1.15中将saved_model转换为tf_js格式。

t0ybt7op

t0ybt7op1#

请将tensorflow升级到最新版本tf 2.x,稳定版本tf 2.6/2.7,并告诉我们是否存在此问题,因为tf 1.x不再支持,因此出现这些错误。

相关问题