张力板连接问题

2024-06-28 20:40:42 发布

您现在位置:Python中文网/ 问答频道 /正文

my_model_folder内有文件:

model.ckpt-16320.data-00000-of-00001 
model.ckpt-16320.meta 
model.ckpt-16320.index

我想用TensorBoard将我的训练形象化。在bash中,我在bash中启动了python并运行以下代码:

import tensorflow as tf

g = tf.Graph()

with g.as_default() as g:
    tf.train.import_meta_graph('./checkpoint/model.ckpt-16320.meta')

with tf.Session(graph=g) as sess:
    file_writer = tf.summary.FileWriter(logdir='checkpoint_log_dir/faceboxes', graph=g)

然后我在bash中关闭python并运行

tensorboard --logdir checkpoint_log_dir/faceboxes/

我连接到了Tensorboard(我在bash中打印了一个链接),但该链接上的消息是:对于当前数据集,没有任何仪表板处于活动状态

enter image description here

可能是什么问题


Tags: importbashlogmodel链接tfasdir
2条回答

最后解决这个问题的方法是从我的本地机器创建一个tunned。我在本地计算机上的新bash窗口中运行了以下代码:

ssh -L 16006:127.0.0.1:6006 name_of_my_server

然后,我设置了我的conda环境和特定于我的项目的其他环境,并将目录更改为这些文件所在的my_model_folder

model.ckpt-16320.data-00000-of-00001 
model.ckpt-16320.meta 
model.ckpt-16320.index

然后,我在bash中通过运行

python

然后使用下面逐行输入的代码,我创建了一个graphs文件夹

import tensorflow as tf

g = tf.Graph()

with g.as_default() as g:
    tf.train.import_meta_graph('/gfs/project/read/dhSeg/dhSegment/demo/my_model_folder/model.ckpt-16320.meta')

with tf.Session() as sess: 
    file_writer = tf.summary.FileWriter(logdir='./graphs', graph=sess.graph)

那我已经跑了

tensorboard logdir="./graphs"

最后,我在浏览器中输入了这个地址,瞧,我的张力板正在工作:

http://127.0.0.1:16006

你能试试吗

如果这也不起作用,那么将最后一行替换为 tf.summary.FileWriter(logdir='./graphs', graph=g)并调用tensorboard logdir="./graphs"

相关问题 更多 >