forked from tatz1101/Edge-AI-Platform-Tutorials
-
Notifications
You must be signed in to change notification settings - Fork 1
/
import_pb.py
34 lines (24 loc) · 835 Bytes
/
import_pb.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'''
Helper script to import a protobuf graph into Tensorboard
Example usage:
python import_pb.py --graph=./freeze/frozen_graph.pb
'''
import argparse
import os
import shutil
from tensorflow.python.tools import import_pb_to_tensorboard
def run_main():
parser = argparse.ArgumentParser(description='Script to import frozen graph into TensorBoard')
parser.add_argument(
'-g', '--graph',
type=str,
default='',
help="Protobuf graph file (.pb) to import into TensorBoard.",
required='True')
flags = parser.parse_args()
if (os.path.exists('./dummy')):
shutil.rmtree('./dummy')
import_pb_to_tensorboard.import_to_tensorboard(model_dir=flags.graph, log_dir='./dummy')
print('..or try `tensorboard --logdir=./dummy --port 6006 --host localhost`')
if __name__ == '__main__':
run_main()