tensorflow 實現(xiàn)打印pb模型的所有節(jié)點
更新時間:2020年01月23日 17:39:19 作者:coocoky
今天小編就為大家分享一篇tensorflow 實現(xiàn)打印pb模型的所有節(jié)點,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
只有pd模型文件, 打印所有節(jié)點
from tensorflow.python.framework import tensor_util
from google.protobuf import text_format
import tensorflow as tf
from tensorflow.python.platform import gfile
from tensorflow.python.framework import tensor_util
GRAPH_PB_PATH = 'models/frozen_person_graph.pb' #path to your .pb file
with tf.Session() as sess:
print("load graph")
with gfile.FastGFile(GRAPH_PB_PATH,'rb') as f:
graph_def = tf.GraphDef()
# Note: one of the following two lines work if required libraries are available
#text_format.Merge(f.read(), graph_def)
graph_def.ParseFromString(f.read())
tf.import_graph_def(graph_def, name='')
for i,n in enumerate(graph_def.node):
print("Name of the node - %s" % n.name)
以上這篇tensorflow 實現(xiàn)打印pb模型的所有節(jié)點就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
解決Pycharm中恢復被exclude的項目問題(pycharm source root)
今天小編就為大家分享一篇解決Pycharm中恢復被exclude的項目問題(pycharm source root),具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-02-02
Python cookbook(數據結構與算法)將序列分解為單獨變量的方法
這篇文章主要介紹了Python cookbook(數據結構與算法)將序列分解為單獨變量的方法,結合實例形式分析了Python序列賦值實現(xiàn)的分解成單獨變量功能相關操作技巧,需要的朋友可以參考下2018-02-02

