tflite製作過程

bazel-bin/tensorflow/contrib/lite/toco/toco --input_file=$(pwd)/…/facenet/tmp/PONet/model.pb --input_format=TENSORFLOW_GRAPHDEF --output_format=TFLITE --output_file=/tmp/PONet.tflite --inference_type=FLOAT --input_type=FLOAT --input_arrays=input --output_arrays=conv4-2/BiasAdd,prob1 --input_shapes=1,None,None,3

模型轉換
在電腦上訓練的網絡模型,有些運算在TFM上可能不支持,需要做一些處理,處理步驟如下:
打開cmd,找到tensorflow項目中的strip_unused.py 腳本文件(…\ tensorflow\tensorflow\python\tools\strip_unused.py),複製該路徑到cmd中,該腳本需要幾個參數。
參數1:–input_graph=…\inception_model\retrain\myoutput_graph.pb (需要轉換的模型)
參數2:–output_graph= …\inception_model\retrain\ my_tfm_output_graph.pb (轉換後存放)
參數3:–input_node_names=”Mul” (輸入節點的名稱,固定)
參數4:–output_node_names=”final_result” (輸出節點名稱,固定)
參數5:–input_binary=true (輸入二進制數據)
執行完以上腳本語句即可進行轉換。

參考網站:
http://www.jishux.com/plus/view-730957-1.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章