用tensorboard查看CKPT和PB图结构

一、查看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

  • 5
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值