How to inspect a pre-trained TensorFlow model

Installing TensorBoard

Standalone

pip install tensorboard

In a container

docker run -p 6006:6006 -it gcr.io/tensorflow/tensorflow:1.3.0 bash

Importing an existing model

tensorboard --logdir=/tmp/tensorflow_logdir
  1. Get import_pb_to_tensorboard.py. I have the TensorFlow repository cloned onto my machine (the tools are in tensorflow/python/tools).
  2. Get a model file. I’m using the 12.5MB mnist_model_graph.pb from this article, and I saved it to /tmp.
  3. Pass the model file to import_pb_to_tensorboard.py. It doesn’t matter what location you use for log_dir.
$ python import_pb_to_tensorboard.py --model_dir /tmp/mnist_model_graph.pb --log_dir /tmp/tensorflow_logdir

<snip>

Model Imported. Visualize by running: tensorboard --logdir=/tmp/tensorflow_logdir
2017–08–27 18:11:31.334823: 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.

Viewing the model in TensorBoard

--

--

--

Machine Learning & Android — https://stackoverflow.com/cv/dj

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Tensor with PyTorch🔥

Getting started with Machine learning/AI

Cosine Learning rate decay

Fake News Detection using Deep Learning

Machine learning using Google Colab vs. GCP virtual machine vs. Vast.ai vs. your own hardware

Transposed Convolutions explained with… MS Excel!

Text Classification using LDA

A set of folders, labelled with “Art”, “Fiction”, “Science” and “Medicine” each.

Technical Introduction and Process of Machine Learning

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dan Jarvis

Dan Jarvis

Machine Learning & Android — https://stackoverflow.com/cv/dj

More from Medium

Nvidia DeepStream-6.0 : Jetson Setup

Neural Style Transfer in 3 Simple Steps

Neural Networks: the best open-source library for object detection & classification

Vanishing Point Detection