-
Notifications
You must be signed in to change notification settings - Fork 6
/
myops_test.py
30 lines (27 loc) · 959 Bytes
/
myops_test.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
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import os
import sys
from pymic.util.parse_config import parse_config
from pymic.net_run.agent_seg import SegmentationAgent
from path_config import path_dict
def main():
if(len(sys.argv) < 3):
print('Number of arguments should be 3. e.g.')
print(' python myops_test.py test config.cfg')
exit()
stage = str(sys.argv[1])
cfg_file = str(sys.argv[2])
assert(stage == "test")
if(not os.path.isfile(cfg_file)):
print("configure file does not exist: {0:} ".format(cfg_file))
exit()
# reset data dir for configure
config = parse_config(cfg_file)
data_dir = config['dataset']['root_dir']
data_dir = data_dir.replace('MyoPS_data_dir', path_dict['MyoPS_data_dir'])
config['dataset']['root_dir'] = data_dir
agent = SegmentationAgent(config, stage)
agent.run()
if __name__ == "__main__":
main()