forked from xionghc/Facial-Expression-Recognition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
29 lines (25 loc) · 996 Bytes
/
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
from demo import demo
from model import train_model, valid_model
import tensorflow as tf
flags = tf.app.flags
flags.DEFINE_string('MODE', 'demo',
'Set program to run in different mode, include train, valid and demo.')
flags.DEFINE_string('checkpoint_dir', './ckpt',
'Path to model file.')
flags.DEFINE_string('train_data', './data/fer2013/fer2013.csv',
'Path to training data.')
flags.DEFINE_string('valid_data', './valid_sets/',
'Path to training data.')
flags.DEFINE_boolean('show_box', False,
'If true, the results will show detection box')
FLAGS = flags.FLAGS
def main():
assert FLAGS.MODE in ('train', 'valid', 'demo')
if FLAGS.MODE == 'demo':
demo(FLAGS.checkpoint_dir, FLAGS.show_box)
elif FLAGS.MODE == 'train':
train_model(FLAGS.train_data)
elif FLAGS.MODE == 'valid':
valid_model(FLAGS.checkpoint_dir, FLAGS.valid_data)
if __name__ == '__main__':
main()