使用tensorflow顯示pb模型的所有網路結點方式
阿新 • • 發佈:2020-01-25
程式碼如下:
import tensorflow as tf from tensorflow.python.platform import gfile model = 'pb_path' graph = tf.get_default_graph() graph_def = graph.as_graph_def() graph_def.ParseFromString(gfile.FastGFile(model,'rb').read()) tf.import_graph_def(graph_def,name='graph') summaryWriter = tf.summary.FileWriter('log/',graph)
使用步驟:
1.修改display_model_nodes.py裡的model定義為自己的pb模型
2.python display_model_nodes.py會在log裡生成out日誌
3.tensorboard --logdir=log
且會在下方出現網頁地址 TensorBoard 1.10.0 at http://oeasy:6006 (Press CTRL+C to quit)
4.在瀏覽器中打輸入:http://oeasy:6006就能看到模型的各個節點了
結果如下:
以上這篇使用tensorflow顯示pb模型的所有網路結點方式就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支援我們。