gpt4 book ai didi

python - 如何将 Tensorflow 模型转换为 tensorflow.js 模型?

转载 作者:行者123 更新时间:2023-12-04 09:36:39 24 4
gpt4 key购买 nike

我使用本教程训练了一个自定义模型:https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10

作为输出,我得到检查点文件,例如 model.ckpt-41288.data-00000-of-00001 或 .data 或 .meta。

我可以将其导出为卡住图,但 Tensorflow.js 不再支持卡住图的转换。我尝试使用旧版,但无法转换。

我看过 Tensorflow 的文档,发现它令人困惑。

谁能给我一个简单的解决方案,说明如何将经过训练的 Tensorflow 模型转换为 tensorflow.js?

最佳答案

在运行 export_inference_graph.py 后,您是否得到一个名为 saved_model 的目录(如前所述 here )?在目录中,它是 SavedModel 格式的模型。

使用最新的 tensorflowjs 版本(v2.0 及更高版本),您应该能够将模型从 SavedModel 格式转换为 tfjs 格式。输出文件应该是 group1-shardxofx.bin 文件和一个 model.json 文件。

tensorflowjs_converter --input_format=tf_saved_model --output_node_names='detection_boxes,detection_classes,detection_features,detection_multiclass_scores,detection_scores,num_detections,raw_detection_boxes,raw_detection_scores' --saved_model_tags=serve --output_format=tfjs_graph_model path_to_your_exported_inference_model_dir/saved_model path_to_save_your_tfjs_model

关于python - 如何将 Tensorflow 模型转换为 tensorflow.js 模型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62547466/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com