gocha124の日記

ごちゃごちゃ書きます

TensorBoard

TensorBoardを起動してみた。

 

(tensorflow) gocha124noMacBook-Air:~ cha124$ tensorboard -logdir=/Users/cha124/log/tensorboard

Traceback (most recent call last):

  File "/Users/cha124/anaconda/bin/tensorboard", line 11, in <module>

    sys.exit(main())

  File "/Users/cha124/anaconda/lib/python3.6/site-packages/tensorflow/tensorboard/tensorboard.py", line 203, in main

    tb = create_tb_app(plugins)

  File "/Users/cha124/anaconda/lib/python3.6/site-packages/tensorflow/tensorboard/tensorboard.py", line 105, in create_tb_app

    raise ValueError('A logdir must be specified. Run `tensorboard --help` for '

ValueError: A logdir must be specified. Run `tensorboard --help` for details and examples.

(tensorflow) gocha124noMacBook-Air:~ cha124$ tensorboard --logdir=./log/tensorboard

Starting TensorBoard b'54' at http://gocha124noMacBook-Air.local:6006

(Press CTRL+C to quit)

 

f:id:gocha124:20170626142316p:plain

できた。でも起動しただけで「No scalar data was found.」が表示される。

 

続けてMNISTの分類の結果サマリ表示をやってみる。

tensorflow/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py

 

サマリ付きのMNISTを実行する。

gocha124noMacBook-Air:mnist cha124$ pwd

/Users/cha124/Downloads/tensorflow-1.2.0/tensorflow/examples/tutorials/mnist

gocha124noMacBook-Air:mnist cha124$ python mnist_with_summaries.py

 

Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.

Extracting /tmp/tensorflow/mnist/input_data/train-images-idx3-ubyte.gz

Successfully downloaded train-labels-idx1-ubyte.gz 28881 bytes.

Extracting /tmp/tensorflow/mnist/input_data/train-labels-idx1-ubyte.gz

Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.

Extracting /tmp/tensorflow/mnist/input_data/t10k-images-idx3-ubyte.gz

Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.

Extracting /tmp/tensorflow/mnist/input_data/t10k-labels-idx1-ubyte.gz

2017-06-27 21:37:00.740000: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.

2017-06-27 21:37:00.740032: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.

2017-06-27 21:37:00.740040: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.

2017-06-27 21:37:00.740046: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.

Accuracy at step 0: 0.1334

Accuracy at step 10: 0.7607

Accuracy at step 20: 0.8301

Accuracy at step 30: 0.8548

Accuracy at step 40: 0.8846

Accuracy at step 50: 0.894

Accuracy at step 60: 0.9004

Accuracy at step 70: 0.9016

Accuracy at step 80: 0.9077

Accuracy at step 90: 0.9089

Adding run metadata for 99

Accuracy at step 100: 0.9187

Accuracy at step 110: 0.9186

Accuracy at step 120: 0.9216

Accuracy at step 130: 0.9244

Accuracy at step 140: 0.9269

Accuracy at step 150: 0.928

Accuracy at step 160: 0.931

Accuracy at step 170: 0.9303

Accuracy at step 180: 0.9301

Accuracy at step 190: 0.9304

Adding run metadata for 199

Accuracy at step 200: 0.9321

Accuracy at step 210: 0.9335

Accuracy at step 220: 0.9351

Accuracy at step 230: 0.9356

Accuracy at step 240: 0.9398

Accuracy at step 250: 0.9378

Accuracy at step 260: 0.941

Accuracy at step 270: 0.9437

Accuracy at step 280: 0.9411

Accuracy at step 290: 0.9412

Adding run metadata for 299

Accuracy at step 300: 0.9438

Accuracy at step 310: 0.9461

Accuracy at step 320: 0.9453

Accuracy at step 330: 0.9466

Accuracy at step 340: 0.9443

Accuracy at step 350: 0.9452

Accuracy at step 360: 0.9459

Accuracy at step 370: 0.947

Accuracy at step 380: 0.95

Accuracy at step 390: 0.95

Adding run metadata for 399

Accuracy at step 400: 0.9474

Accuracy at step 410: 0.9483

Accuracy at step 420: 0.9494

Accuracy at step 430: 0.9536

Accuracy at step 440: 0.9522

Accuracy at step 450: 0.9531

Accuracy at step 460: 0.9531

Accuracy at step 470: 0.9552

Accuracy at step 480: 0.9536

Accuracy at step 490: 0.9544

Adding run metadata for 499

Accuracy at step 500: 0.9551

Accuracy at step 510: 0.9546

Accuracy at step 520: 0.9557

Accuracy at step 530: 0.9586

Accuracy at step 540: 0.9575

Accuracy at step 550: 0.9577

Accuracy at step 560: 0.9586

Accuracy at step 570: 0.9577

Accuracy at step 580: 0.957

Accuracy at step 590: 0.959

Adding run metadata for 599

Accuracy at step 600: 0.9576

Accuracy at step 610: 0.9593

Accuracy at step 620: 0.9596

Accuracy at step 630: 0.959

Accuracy at step 640: 0.96

Accuracy at step 650: 0.9599

Accuracy at step 660: 0.9611

Accuracy at step 670: 0.9604

Accuracy at step 680: 0.9626

Accuracy at step 690: 0.9624

Adding run metadata for 699

Accuracy at step 700: 0.9637

Accuracy at step 710: 0.9619

Accuracy at step 720: 0.9643

Accuracy at step 730: 0.9611

Accuracy at step 740: 0.9633

Accuracy at step 750: 0.9643

Accuracy at step 760: 0.9634

Accuracy at step 770: 0.9601

Accuracy at step 780: 0.9616

Accuracy at step 790: 0.9622

Adding run metadata for 799

Accuracy at step 800: 0.9647

Accuracy at step 810: 0.964

Accuracy at step 820: 0.9637

Accuracy at step 830: 0.9643

Accuracy at step 840: 0.964

Accuracy at step 850: 0.9659

Accuracy at step 860: 0.9669

Accuracy at step 870: 0.9663

Accuracy at step 880: 0.9657

Accuracy at step 890: 0.9644

Adding run metadata for 899

Accuracy at step 900: 0.9624

Accuracy at step 910: 0.965

Accuracy at step 920: 0.9664

Accuracy at step 930: 0.9674

Accuracy at step 940: 0.9654

Accuracy at step 950: 0.9671

Accuracy at step 960: 0.9666

Accuracy at step 970: 0.9683

Accuracy at step 980: 0.9659

Accuracy at step 990: 0.9669

Adding run metadata for 999

gocha124noMacBook-Air:mnist cha124$ 

 

引数なしで実行する。/tmp/tensorflow/mnistディレクトリに以下出力される。

f:id:gocha124:20170627214336p:plain

 

出力先ディレクトリを指定してTensorBoardを起動する。

tensorboard --logdir=/tmp/tensorflow/mnist

(tensorflow) gocha124noMacBook-Air:~ cha124$ tensorboard --logdir=/tmp/tensorflow/mnist

Starting TensorBoard b'54' at http://gocha124noMacBook-Air.local:6006

(Press CTRL+C to quit)

f:id:gocha124:20170627215721p:plain

サマリ表示ができた。何を意味しているのかを調べてみる。

 

単語 調べた意味
SCALARS  
GRAPHS  
accuracy 精度
cross entropy 交差エントロピー。よくわかんない
dropout 過学習を防ぐディープラーニングのテクニック。一定の確率でランダムにニューロンを無視して学習を進める正則化
biases 偏り。線形モデルを例にするとなんとなくわかる。「y = W * x + b」の表現の b に相当するのかな。
weights 重み。線形モデルを例にするとなんとなくわかる。「y = W * x + b」の表現の W に相当するのかな。

 

さらにGraphを表示してみる。TensorBoardの上部タブのGRAPHSをクリックする。

ニューラルネットの構成が図示される。

f:id:gocha124:20170627224256p:plain

できた。