2017-06-23 71 views
0

我已经使用TensorFlow实现了MNIST的NN。我想在TensorBoard上显示结果。 Flowing是我已经实现的TensorBoard的屏幕截图。但图片页面显示“没有图像数据被发现”。TensorBoard shows没有找到图片数据

这里应该显示什么信息?我应该忽略它?

enter image description here

enter image description here

enter image description here CODE

import tensorflow as tf 
from tensorflow.examples.tutorials.mnist import input_data 

tf.reset_default_graph() 
mnist = input_data.read_data_sets('data', one_hot=True) 

batch_size = 100 
learning_rate = 0.5 
training_epochs = 5 
logs_path = "C:/tmp/mlp" 

with tf.name_scope('input'): 
    x = tf.placeholder(tf.float32, shape=[None, 784], name="x-input") 
    y_ = tf.placeholder(tf.float32, shape=[None, 10], name="y-input") 
with tf.name_scope("weights"): 
    W = tf.Variable(tf.zeros([784, 10])) 
with tf.name_scope("biases"): 
    b = tf.Variable(tf.zeros([10])) 
with tf.name_scope("softmax"): 
    y = tf.nn.softmax(tf.matmul(x, W) + b) 
with tf.name_scope('cross_entropy'): 
    cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1])) 
with tf.name_scope('train'): 
    train_op = tf.train.GradientDescentOptimizer(learning_rate).minimize(cross_entropy) 
with tf.name_scope('Accuracy'): 
    correct_prediction = tf.equal(tf.argmax(y, 1), tf.argmax(y_, 1)) 
    accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32)) 
tf.summary.scalar("cost", cross_entropy) 
tf.summary.scalar("accuracy", accuracy) 
summary_op = tf.summary.merge_all() 
with tf.Session() as sess: 
    sess.run(tf.global_variables_initializer()) 
    summary_writer = tf.summary.FileWriter("C:/tmp/mlp", sess.graph) 
    for epoch in range(training_epochs): 
     batch_count = int(mnist.train.num_examples/batch_size) 
     for i in range(batch_count): 
      batch_x, batch_y = mnist.train.next_batch(batch_size) 
      _, summary = sess.run([train_op, summary_op], feed_dict={x: batch_x, y_: batch_y}) 
      summary_writer.add_summary(summary, epoch * batch_count + i) 
     if epoch % 5 == 0: 
      print("Epoch: ", epoch) 
    print("Accuracy: ", accuracy.eval(feed_dict={x: mnist.test.images, y_: mnist.test.labels})) 
    print("done") 

回答

2

在你的代码的唯一的线是指汇总操作是:

tf.summary.scalar("cost", cross_entropy) 
tf.summary.scalar("accuracy", accuracy) 

这些行创建2个标量汇总(和创建的概要添加到包含每个定义的概要默认集合)。

您未定义任何图像摘要(使用tf.summmary.image),因此张量板中的该选项卡将为空。

0

不理会他们,因为你没有保存任何tf.summary.image总结,Tensorboard不会出现在这样的东西标签;