【问题标题】:Always says "No dashboards are active for the current data set" when activating Tensorboard激活 Tensorboard 时总是说“当前数据集没有激活的仪表板”
【发布时间】:2019-11-05 12:07:20
【问题描述】:

我在 Anaconda 环境中的 macOS 系统中使用 Python 3.7.3。 Tensorflow (1.14.0)、Matplotlib (3.1.0) 和其他模块都安装在那里,一切正常。我编写了以下代码并运行它。


import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
def add_layer(inputs, inputs_size, outputs_size,activation_function = None):
    with tf.name_scope('layer'):
        with tf.name_scope('weight'):
            Weights = tf.Variable(tf.random.normal([inputs_size, outputs_size]))        
        with tf.name_scope('biase'):
            biases = tf.Variable(tf.zeros([1,outputs_size])+0.1)
        with tf.name_scope('wx_plus_b'):
            Wx_plus_b = tf.matmul(inputs, Weights) + biases
        if activation_function == None:outputs = Wx_plus_b
        else: outputs = activation_function(Wx_plus_b)
        return outputs

'''
multiple lines omitted here
'''

writer = tf.compat.v1.summary.FileWriter("logs/",sess.graph)

我可以看到一个名为的本地文件

"events.out.tfevents.1561289962.Botaos-MacBook-Pro.local"

在“logs/”文件夹中生成。我在 Anaconda 环境激活的情况下打开了终端并 cd 到该文件夹​​。然后我输入了

"python -m tensorboard.main --logdir=‘logs/‘ --host localhost --port 6006" 

得到回应

TensorBoard 1.14.0 at http://localhost:6006/ (Press CTRL+C to quit)

然后无论我使用 safari 还是 chrome 打开“http://localhost:6006/”,除了“当前数据集没有处于活动状态的仪表板”之外,始终没有显示任何内容。 enter image description here 其实我也尝试过其他的表扬,比如

python -m tensorboard.main --logd logs --host localhost --port 6006

python -m tensorboard.main --logd logs --host localhost --port 6006

但是没有区别。

原代码如下:

import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
def add_layer(inputs, inputs_size, outputs_size,activation_function = None):
    with tf.name_scope('layer'):
        with tf.name_scope('weight'):
            Weights = tf.Variable(tf.random.normal([inputs_size, outputs_size]))        
        with tf.name_scope('biase'):
            biases = tf.Variable(tf.zeros([1,outputs_size])+0.1)
        with tf.name_scope('wx_plus_b'):
            Wx_plus_b = tf.matmul(inputs, Weights) + biases
        if activation_function == None:outputs = Wx_plus_b
        else: outputs = activation_function(Wx_plus_b)
        return outputs
x_data = np.linspace(-1,1,300,dtype = np.float32)[:,np.newaxis] 
noise = np.random.normal(0,0.05,x_data.shape).astype(np.float32)    
y_data = np.square(x_data) - 0.5 + noise

with tf.name_scope('inputs'):
    xs = tf.compat.v1.placeholder(tf.float32,[None,1],name='x_in')
    ys = tf.compat.v1.placeholder(tf.float32,[None,1],name='y_in')

l1 = add_layer(xs, 1, 10, tf.nn.relu) 

prediction = add_layer(l1, 10, 1, None)

with tf.name_scope('loss'):
    loss = tf.reduce_mean(tf.reduce_sum(tf.square(prediction - ys),reduction_indices=[1])) #no need to do tf.sum() as in link.                  #tf.reduce_mean()
with tf.name_scope('train'):
    train_step = tf.compat.v1.train.GradientDescentOptimizer(0.1).minimize(loss)


sess = tf.compat.v1.Session()

writer = tf.compat.v1.summary.FileWriter("logs/",sess.graph)
sess.run(tf.compat.v1.global_variables_initializer())

【问题讨论】:

    标签: macos tensorflow tensorboard


    【解决方案1】:

    我认为问题在于您试图找到日志目录,而您已经在日志目录中。

    尝试执行:tensorboard --logdir logs

    来自包含日志目录的目录。

    【讨论】:

      猜你喜欢
      • 2019-12-14
      • 2018-02-16
      • 2018-04-17
      • 2018-06-01
      • 2020-06-24
      • 2021-08-06
      • 2014-05-09
      • 1970-01-01
      • 2019-05-22
      相关资源
      最近更新 更多