Q&A
前提・実現したいこと
TensorBoardのグラフをブラウザで確認したい。
発生している問題・エラーメッセージ
FireFox,GoogleChromにて localhost:6006 127.0.0.1:6006等でアクセスしたがアクセスが拒否された。接続ができなかった。
該当のソースコード
python
1import tensorflow as tf 2from tensorflow.examples.tutorials.mnist import input_data 3 4mnist = input_data.read_data_sets("data/",one_hot=True) 5 6#訓練用の入力データと正解データを身にバッチ数を指定して取得 7#train_images,train_labels = mnist.train.next_batch(50) 8 9#test_images = mnist.test.images 10#tes_labels = mnist.test.labels 11 12#入力層 13x = tf.placeholder(tf.float32,shape=[None,784]) 14 15#入力画像をログに出力 16img = tf.reshape(x,[-1,28,28,1]) 17tf.summary.image('input_data',img,10) 18 19#入力層から中間層 20with tf.name_scope('hidden'): 21 w_1 = tf.Variable(tf.truncated_normal([784,64],stddev=0.1),name='w1')#重みw 784 to 64? 784x64の行列 22 b_1=tf.Variable(tf.zeros([64]),name='b1')#バイアスb 23 h_1=tf.nn.relu(tf.matmul(x,w_1)+b_1)#階層の合わない計算も自動で多い階層の方に合わせてくれる 24 tf.summary.histogram('w_1',w_1)#1階層以上のデータを可視化するにはhistogramを使いましょう 25 26#中間層から出力層 27with tf.name_scope('output'): 28 w_2 = tf.Variable(tf.truncated_normal([64,10],stddev=0.1),name='w2') 29 b_2=tf.Variable(tf.zeros([10]),name='b2') 30 out=tf.nn.softmax(tf.matmul(h_1,w_2)+b_2) 31 tf.summary.histogram('w_2',w_2) 32 33#誤差関数 34with tf.name_scope('loss'): 35 y=tf.placeholder(tf.float32,shape=[None,10]) 36 loss = tf.reduce_mean(tf.square(y-out)) 37 tf.summary.scalar('loss',loss)#0階テンソルのみ使用可能 38 39#訓練 40with tf.name_scope('train'): 41 train_step=tf.train.GradientDescentOptimizer(0.5).minimize(loss) 42 43#評価 44with tf.name_scope('accuracy'): 45 correct = tf.equal(tf.argmax(out,1),tf.argmax(y,1)) 46 accuracy = tf.reduce_mean(tf.cast(correct,tf.float32)) 47 tf.summary.scalar('accuracy',accuracy) 48 49init = tf.global_variables_initializer() 50#全てのログをマージする 51summary_op = tf.summary.merge_all() 52 53with tf.Session() as sess: 54 sess.run(init) 55 summary_writer = tf.summary.FileWriter('./logstest',graph=sess.graph) 56 57 test_images = mnist.test.images 58 test_labels = mnist.test.labels 59 60 for i in range(3000): 61 step = i+1 62 train_images,train_labels = mnist.train.next_batch(50) 63 sess.run(train_step,feed_dict={x:train_images,y:train_labels}) 64 65 if step % 10==0: 66 #ログを取る処理の実行 67 summry_str = sess.run(summary_op,feed_dict={x:test_images,y:test_labels}) 68 #ログ情報んpプロトコルバッファに書き込む 69 summary_writer.add_summary(summry_str,step) 70 acc_val = sess.run(accuracy,feed_dict={x:test_images,y:test_labels}) 71 print('Step %d accuracy = %.2f' % (step,acc_val))
試したこと
ping telnetでの接続確認をした。
pingでは通ったが、telnetでは通らなかった。
TensorBoradを起動したときに特にエラーは出なかった。
FireWallの設定やプロキシの設定などを見直したが、上手くいかなかった。
(tensorflow-gpu) ~\tf-openpose\Sample>tensorboard --logdir=./logstest TensorBoard 1.10.0 at http://MyComputer:6006 (Press CTRL+C to quit)
補足情報(FW/ツールのバージョンなど)
環境はWindows10 anacondaの仮想環境python=3.5で行っている。
回答1件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
2018/10/01 17:08