一、查看ckpt图结构
1、在ckpt文件所在文件夹中新建check_ckpt.py文件,代码如下:
import tensorflow as tf
from tensorflow.summary import FileWriter
sess = tf.Session()
tf.train.import_meta_graph("./model.ckpt.meta")
FileWriter("__tb", sess.graph)
2、运行check_ckpt.py,生成__tb文件夹
3、在__tb文件夹中,按住shitf键,右键打开powershell
4、在powershell中输入:tensorboard --logdir=./ --host=127.0.0.15
5、在浏览器中输入powershell输出的地址,比如http://127.0.0.15:6006
二、查看pb模型的图结构
1、在pb模型文件所在文件夹中新建check_pb.py文件,代码如下:
from tensorflow.python.platform import gfile
import tensorflow as tf
model = 'D:/test/model.pb'
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('D:/test/log/', graph)
2、运行check_pb.py,生成log文件夹
3、在log文件夹中,按住shitf键,右键打开powershell
4、在powershell中输入:tensorboard --logdir=./ --host=127.0.0.15
5、在浏览器中输入powershell输出的地址,比如http://127.0.0.15:6006
转载:https://blog.csdn.net/Mmagic1/article/details/106071818
三、查看已保存模型的输入和输出
在网页中点击图的输入和输入即可看到输入和输出的详细属性。注意:如果输出是矩形框,说明它是组合操作,要双击进入到它的内部,找到最后的椭圆形才是模型可识别的tensor
输入tensor名称为input
输出tensor名称为output/Softmax
转载:https://blog.csdn.net/chongtong/article/details/90693787