-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.py
executable file
·41 lines (33 loc) · 848 Bytes
/
start.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
#!/usr/bin/env python
# coding=utf-8
import sys
import conf
from src.predict import CNNPredictor
from src.prepare import Prepare
from src.train import CNNTrainer
def print_usage():
print("""
need args:
<module_name> [module_argv]
where
module_name is <prepare|train|predict>
module_argv depends on concrete module
""")
if __name__ == '__main__':
if len(sys.argv) <= 1:
print_usage()
sys.exit(1)
conf.init()
module_name = sys.argv[1]
module_argv = sys.argv[2:]
exit_code = 0
if module_name == 'prepare':
Prepare.prepare(module_argv)
elif module_name == 'train':
exit_code = CNNTrainer.fit(module_argv)
elif module_name == 'predict':
exit_code = CNNPredictor.fit(module_argv)
else:
print_usage()
exit_code = 1
sys.exit(exit_code)