-
Notifications
You must be signed in to change notification settings - Fork 65
/
train.py
40 lines (25 loc) · 886 Bytes
/
train.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
from config import cfg
from modeling.afm import AFM
import argparse
import os
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='PyTorch Line Segment Detection Training')
parser.add_argument("--config-file",
metavar = "FILE",
help = "path to config file",
type=str,
required=True,
)
parser.add_argument("--gpu", type=int, default = 0)
parser.add_argument("--start_epoch", dest="epoch", default=-1, type=int)
parser.add_argument("opts",
help="Modify config options using the command-line",
default = None,
nargs = argparse.REMAINDER
)
args = parser.parse_args()
os.environ['CUDA_VISIBLE_DEVICES'] = str(args.gpu)
cfg.merge_from_file(args.config_file)
cfg.merge_from_list(args.opts)
system = AFM(cfg)
system.train(cfg, args.epoch)