-
Notifications
You must be signed in to change notification settings - Fork 30
/
freeze.py
31 lines (26 loc) · 1.01 KB
/
freeze.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
import os
import freeze_graph
import tensorflow as tf
checkpoint_state_name = "model.ckpt"
input_graph_name = "starnet.pb"
output_graph_name = "starne_weights.pb"
input_graph_path = os.path.join("./", input_graph_name)
input_saver_def_path = ""
input_binary = False
input_checkpoint_path = os.path.join("./", 'saved_checkpoint')
print(tf.version.VERSION)
output_node_names = "generator/g_deconv7/Sub"
restore_op_name = "save/restore_all" # not used
filename_tensor_name = "save/Const:0" # not used
output_graph_path = os.path.join("./", output_graph_name)
clear_devices = False
freeze_graph.freeze_graph("./starnet_generator.pb",
"",
True,
"./model.ckpt",
output_node_names,
restore_op_name,
filename_tensor_name,
"./starnet_generator_weights.pb",
clear_devices,
"")