View a graphDef .pb file with TensorBoard

It can be really useful to be able to view a TensorFlow graphDef file in TensorBoard. The import_to_tensorboard function can be wrapped in a few lines of code to add arguments like this:



The above script can be run from the command prompt like this:

python import.pb.py --graph=./frozen_graph.pb --log_dir=./tb_logs


When the script has completed, it will prompt you with the URL that needs to be used to visualize the graph. Open a web browser and paste the URL into the search bar. TensorBoard will then open and display the graph:



Download

The python script and an example .pb file can be downloaded from GitHub.