[英]How do I save a Tensorflow LinearClassifier model and convert it to Tensorflow.js compatible
[英]How can I convert Tensorflow model to tensorflow.js model?
我使用本教程訓練了一個自定義 model: https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10
作為 output,我得到檢查點文件,例如 model.ckpt-41288.data-00000-of-00001 或.data 或.meta。
我可以將其導出為凍結圖,但 Tensorflow.js 不再支持凍結圖的轉換。 我嘗試使用舊版本,但無法轉換。
我查看了 Tensorflow 的文檔,發現它令人困惑。
有人可以給我一個簡單的解決方案,說明如何將訓練有素的 Tensorflow model 轉換為 tensorflow.js?
在運行export_inference_graph.py
之后,您是否獲得了一個名為saved_model
的目錄(如此處所述)? 在目錄中,它是 SavedModel 格式的 model。
使用最新的 tensorflowjs 版本(v2.0 及更高版本),您應該能夠將 model 從 SavedModel 格式轉換為 tfjs 格式。 output 文件應該是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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.