LoginSignup
17
15

More than 5 years have passed since last update.

Googleの一般物体認識NN, Inception-v3 を Tensorboard で可視化してみた

Last updated at Posted at 2016-05-06

Tensorboard で Google の一般物体認識ネットワーク Inception のグラフを見る方法

2015年に公開されたGoogle の一般物体認識NN, Inception-v3 の学習ライブラリが公開された ようなので、理解を深めるために Tensorboard でネットワークを可視化してみた。

前提条件

  • Python (version 2.7.10)
  • Tensorflow (version 0.8.0)

手順

  1. 下準備(ワーキングディレクトリの作成)
$ mkdir /tmp/imagenet
$ cd /tmp/imagenet
  1. トレーニング済みの Inception ネットワークをダウンロード
$ wget http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz
$ tar xzvf inception-2015-12-05.tgz
  1. トレーニング済みのInceptionネットワークからグラフ構造をダンプ
  • ダンプスクリプトの設置
$ vi dump.py
import os
import os.path
import tensorflow as tf
from tensorflow.python.platform import gfile

INCEPTION_LOG_DIR = '/tmp/inception_v3_log'

if not os.path.exists(INCEPTION_LOG_DIR):
    os.makedirs(INCEPTION_LOG_DIR)

with tf.Session() as sess:
    model_filename = '/tmp/imagenet/classify_image_graph_def.pb'
    with gfile.FastGFile(model_filename, 'rb') as f:
        graph_def = tf.GraphDef()
        graph_def.ParseFromString(f.read())
        _ = tf.import_graph_def(graph_def, name='')
    writer = tf.train.SummaryWriter(INCEPTION_LOG_DIR, graph_def)
    writer.close()
  • グラフをダンプ
$ mkdir /tmp/inception_v3_log
$ python dump.py
  1. Tensorboard でグラフを確認
  • Tensorboard 起動
$ tensorboard --logdir /tmp/inception_v3_log/
  • http://localhost:6006/ にアクセス

参考資料

表示例

inception表示例.png

17
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
15