[PYTHON] I tried to visualize Google's general object recognition NN, Inception-v3 with Tensorboard

How to view the graph of Google's general object recognition network Inception on Tensorboard

[Learning library has been released] of Google's general object recognition NN, Inception-v3 released in 2015 (http://googleresearch.blogspot.jp/2016/03/train-your-own-image-classifier- with.html), so I tried to visualize the network with Tensorboard to deepen my understanding.

Prerequisites

procedure

  1. Preparation (creation of working directory)
$ mkdir /tmp/imagenet
$ cd /tmp/imagenet
  1. Download the trained Inception network
$ wget http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz
$ tar xzvf inception-2015-12-05.tgz
  1. Dump graph structure from trained Inception network
$ 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. Check the graph on Tensorboard
$ tensorboard --logdir /tmp/inception_v3_log/

Reference material

Display example

inception表示例.png

Recommended Posts

I tried to visualize Google's general object recognition NN, Inception-v3 with Tensorboard
I tried to detect an object with M2Det!
[Python] I tried to visualize tweets about Corona with WordCloud
[TF] I tried to visualize the learning result using Tensorboard
I tried face recognition with OpenCV
I tried to visualize bookmarks flying to Slack with Doc2Vec and PCA
I tried to implement Autoencoder with TensorFlow
I tried to get started with Hy
I tried to implement CVAE with PyTorch
I tried to solve TSP with QAOA
I tried simple image recognition with Jupyter
[Python] I tried to visualize the night on the Galactic Railroad with WordCloud!
I tried to visualize the text of the novel "Weathering with You" with WordCloud
I tried to visualize the model with the low-code machine learning library "PyCaret"
I tried to visualize all decision trees of random forest with SVG
I tried to predict next year with AI
I tried to detect Mario with pytorch + yolov3
I tried to implement reading Dataset with PyTorch
I tried to use lightGBM, xgboost with Boruta
I tried image recognition of CIFAR-10 with Keras-Learning-
I tried to learn logical operations with TF Learn
I tried to move GAN (mnist) with keras
I tried image recognition of CIFAR-10 with Keras-Image recognition-
I tried to save the data with discord
I tried to detect motion quickly with OpenCV
I tried to integrate with Keras in TFv1.1
I tried to get CloudWatch data with Python
I tried to output LLVM IR with Python
I tried to easily visualize the tweets of JAWS DAYS 2017 with Python + ELK
I tried to automate sushi making with python
I tried to predict Titanic survival with PyCaret
I tried to operate Linux with Discord Bot
I tried to study DP with Fibonacci sequence
I tried to start Jupyter with Amazon lightsail
I tried to make Kana's handwriting recognition Part 3/3 Cooperation with GUI using Tkinter
I tried to judge Tsundere with Naive Bayes
I tried to make a simple image recognition API with Fast API and Tensorflow
I tried to visualize the characteristics of new coronavirus infected person information with wordcloud
I tried to visualize the running data of the racing game (Assetto Corsa) with Plotly
I tried to learn the sin function with chainer
I tried to move machine learning (ObjectDetection) with TouchDesigner
I tried to create a table only with Django
I tried to extract features with SIFT of OpenCV
I tried to move Faster R-CNN quickly with pytorch
I tried to implement and learn DCGAN with PyTorch
I tried to implement Minesweeper on terminal with python
I tried to get started with blender python script_Part 01
I tried to touch the CSV file with Python
I tried to draw a route map with Python
I tried to solve the soma cube with python
I tried to automatically read and save with VOICEROID2
I tried to get started with blender python script_Part 02
I tried to generate ObjectId (primary key) with pymongo
I tried to implement an artificial perceptron with python
I tried to build ML Pipeline with Cloud Composer
I tried to implement time series prediction with GBDT
I tried to uncover our darkness with Chatwork API
I tried to automatically generate a password with Python3
I tried to visualize the spacha information of VTuber
[Introduction to Pytorch] I tried categorizing Cifar10 with VGG16 ♬
I tried to solve the problem with Python Vol.1