Safemotion Lib
Loading...
Searching...
No Matches
main.py
Go to the documentation of this file.
1import sys
2sys_path = ['/workspace/smlab', '/workspace']
3for path in sys_path:
4 if path not in sys.path:
5 sys.path.append(path)
6
7import argparse
8
9from mmengine.config import Config
10
11from smrunner.train import train
12from smrunner.test import test
13
14
15parser = argparse.ArgumentParser()
16parser.add_argument('--mode', default='train', help='train or test')
17parser.add_argument('--cfg', default='', help='cfg file name')
18parser.add_argument('--device', type=int, default=None, nargs='+', help='select device')
19
20if __name__ == '__main__':
21
22 args = parser.parse_args()
23 mode = args.mode
24 cfg_path = args.cfg
25 cfg = Config.fromfile(cfg_path)
26 device_ids = args.device
27
28 if mode == 'train':
29 train(cfg, device_ids)
30 elif mode == 'test':
31 test(cfg, device_ids)
32 else:
33 pass
34
35