【问题标题】:Tensorboard: No graph definition files were found.Tensorboard:未找到图形定义文件。
【发布时间】:2017-04-01 06:11:41
【问题描述】:

在我的 Python 代码中,我执行 train_writer = tf.summary.FileWriter(TBOARD_LOGS_DIR) train_writer.add_graph(sess.graph)

我可以看到在 E:\progs\tensorboard_logs 中创建的 1.6MB 文件(没有其他文件) 但是当我执行 张量板 --logdir=E:\progs\tensorboard_logs 它加载,但说:“没有找到图形定义文件。”当我点击图表时。 此外,运行 tensorboard --inspect --logdir=E:\progs\tensorboard_logs 显示 在以下位置找到事件文件: E:\progs\tensorboard_logs

这些标签在 E:\progs\tensorboard_logs 中: 声音的 - 直方图 - 图片 -

标量 -

E:\progs\tensorboard_logs 的事件统计: 声音的 - 图形 第一步 0 最后一步 0 最大步长 0 min_step 0 num_steps 1 outoforder_steps [] 直方图 - 图片 - 标量 - 会话日志:检查点 - 会话日志:开始 -

会话日志:停止-

这是 TF 1.01 左右,在 Windows 10 上。

【问题讨论】:

    标签: tensorboard


    【解决方案1】:

    在处理图的 TensorFlow 中,分为三个部分: 1) 创建图表 2) 将图表写入事件文件 3)在tensorboard中可视化图表

    示例:在 tensorflow 中创建图形

    a = tf.constant(5, name="input_a")
    b = tf.constant(3, name="input_b")
    
    c = tf.multiply(a,b, name="mul_c")
    d = tf.add(a,b, name="add_d")
    
    e = tf.add(c,d, name="add_e")
    
    sess = tf.Session() 
    
    sess.run(c) <--check, value should be 15
    sess.run(d) <--check, value should be 8
    sess.run(e) <--check, value should be 23
    

    在事件文件中写入图表

     writer = tf.summary.FileWriter('./tensorflow_examples', sess.graph)
    

    指定一个目录非常重要(在这种情况下,目录是 tensorflow_examples),事件文件将被写入其中。 writer = tf.summary.FileWriter('./', sess.graph) 对我不起作用,因为 shell 命令 => tensorboard --logdir 需要一个目录名。

    执行此步骤后,验证是否在指定目录中创建了事件文件。

    在 Tensorboard 中可视化图表

    打开终端(bash),在工作目录类型下: 张量板 --logdir='tensorflow_examples' --host=127.0.0.1

    然后在http://127.0.0.1:6006/http://localhost/6006中打开一个新的浏览器,现在tensorboard可以成功显示图表了。

    【讨论】:

      【解决方案2】:

      我有类似的问题。当我在单引号而不是双引号中指定“logdir”文件夹时出现问题。希望这对您有所帮助。

      egs: tensorboard --logdir='my_graph' -> Tensorboard 没有检测到图表

       tensorboard --logdir="my_graph"  -> Tensorboard detected the graph
      

      【讨论】:

        【解决方案3】:

        问题可能出在参数 --logdir。确保输入正确

        示例:

        在代码中: writer = tf.summary.FileWriter('./log/', s.graph)

        打开powershell

        cd 到你的工作目录并输入 tensorboard --logdir=log

        您也可以使用--debug 来查看查找日志文件是否有问题。如果你看到: TensorBoard path_to_run 为:{'C:\\Users\\example\\log': None} 表示找不到文件。

        【讨论】:

        • --debug 标志在 0.4.0 中不再存在
        【解决方案4】:

        您可能需要将 powershell 目录更改为您的日志文件。并且logdir不需要单引号。(双引号或不带引号都可以)

        【讨论】:

          猜你喜欢
          • 2019-02-04
          • 2020-03-09
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2019-06-07
          • 1970-01-01
          • 2016-12-06
          • 1970-01-01
          相关资源
          最近更新 更多