-
Notifications
You must be signed in to change notification settings - Fork 17
/
main.py
executable file
·52 lines (41 loc) · 1.11 KB
/
main.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import tensorflow as tf
from utils import *
from config import FLAGS
from utils.utils import *
import utils
import nnet
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
def main(_):
"""Begins the execution of the program
Args:
_ : Tensorflow flags app instance
"""
if FLAGS.create != "":
dataset = utils.Dataset(FLAGS)
dataset.create_records(FLAGS.create)
exit()
if not FLAGS.test:
priliminary_checks(FLAGS)
idx = get_runid(FLAGS)
create_rundirs(FLAGS, idx)
dump_model_params(FLAGS)
log_config(idx, FLAGS.__flags)
if FLAGS.archi:
net = nnet.Model(FLAGS, is_training=False)
net.test_graph()
exit()
FLAGS.h = 600 if FLAGS.dataset == 'maps' else 256
FLAGS.w = FLAGS.h
if FLAGS.train or FLAGS.resume:
net = nnet.Model(FLAGS, is_training=True)
net.train()
print ' - Done training the network...'
else:
print ' - Testing the model...'
net = nnet.Model(FLAGS, is_training=False)
net.test(FLAGS.test_source)
if __name__ == '__main__':
try:
tf.app.run()
except Exception as E:
print E