forked from zhangzjn/ADer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
executable file
·31 lines (27 loc) · 1.18 KB
/
run.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
import argparse
from configs import get_cfg
from util.net import init_training
from util.util import run_pre, init_checkpoint
from trainer import get_trainer
import warnings
warnings.filterwarnings("ignore")
def main():
parser = argparse.ArgumentParser()
# parser.add_argument('-c', '--cfg_path', default='configs/rd_mvtec_debug.py')
# parser.add_argument('-c', '--cfg_path', default='configs/invad_mvtec_debug.py')
parser.add_argument('-c', '--cfg_path', default='configs/vitad_mvtec_debug.py')
parser.add_argument('-m', '--mode', default='train', choices=['train', 'test'])
parser.add_argument('--sleep', type=int, default=-1)
parser.add_argument('--memory', type=int, default=-1)
parser.add_argument('--dist_url', default='env://', type=str, help='url used to set up distributed training')
parser.add_argument('--logger_rank', default=0, type=int, help='GPU id to use.')
parser.add_argument('opts', help='path.key=value', default=None, nargs=argparse.REMAINDER,)
cfg_terminal = parser.parse_args()
cfg = get_cfg(cfg_terminal)
run_pre(cfg)
init_training(cfg)
init_checkpoint(cfg)
trainer = get_trainer(cfg)
trainer.run()
if __name__ == '__main__':
main()