2017-06-23 15 views
0

TensorFlowを使用してMNISTにNNを実装しました。結果をTensorBoardに表示したい。流れているのは私が実装したTensorBoardのスクリーンショットです。しかし、IMAGESのページには、「画像データが見つかりませんでした。」と表示されています。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はこの中には何も表示されません、それらを無視タブ;集計操作を参照してください、あなたのコード内で

関連する問題