-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslim_infer.py
27 lines (20 loc) · 882 Bytes
/
slim_infer.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
import tensorflow as tf
from model_infer import ENet_model
def main():
graph = tf.Graph()
with graph.as_default():
model = ENet_model(img_height=512,
img_width=1024,
batch_size=1)
saver = tf.train.Saver(tf.global_variables())
sess = tf.Session()
sess.run(tf.global_variables_initializer())
sess.run(tf.local_variables_initializer())
saver.restore(sess, './training_logs/best_model/model_1_epoch_25.ckpt')
saver.save(sess, './training_logs/best_model/model_1_epoch_25_final.ckpt')
print("in=", model.imgs_ph.name)
print("on=", model.logits.name)
graphdef = graph.as_graph_def()
tf.train.write_graph(graphdef, './training_logs/best_model', 'semanticsegmentation_enet.pbtxt', as_text=True)
if __name__ == '__main__':
main()