-
Notifications
You must be signed in to change notification settings - Fork 75
/
opts.py
153 lines (149 loc) · 4.27 KB
/
opts.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
"""
@Author: Du Yunhao
@Filename: opts.py
@Contact: dyh_bupt@163.com
@Time: 2022/2/28 19:41
@Discription: opts
"""
import json
import argparse
from os.path import join
data = {
'MOT17': {
'val':[
'MOT17-02-FRCNN',
'MOT17-04-FRCNN',
'MOT17-05-FRCNN',
'MOT17-09-FRCNN',
'MOT17-10-FRCNN',
'MOT17-11-FRCNN',
'MOT17-13-FRCNN'
],
'test':[
'MOT17-01-FRCNN',
'MOT17-03-FRCNN',
'MOT17-06-FRCNN',
'MOT17-07-FRCNN',
'MOT17-08-FRCNN',
'MOT17-12-FRCNN',
'MOT17-14-FRCNN'
]
},
'MOT20': {
'test':[
'MOT20-04',
'MOT20-06',
'MOT20-07',
'MOT20-08'
]
}
}
class opts:
def __init__(self):
self.parser = argparse.ArgumentParser()
self.parser.add_argument(
'dataset',
type=str,
help='MOT17 or MOT20',
)
self.parser.add_argument(
'mode',
type=str,
help='val or test',
)
self.parser.add_argument(
'--BoT',
action='store_true',
help='Replacing the original feature extractor with BoT'
)
self.parser.add_argument(
'--ECC',
action='store_true',
help='CMC model'
)
self.parser.add_argument(
'--NSA',
action='store_true',
help='NSA Kalman filter'
)
self.parser.add_argument(
'--EMA',
action='store_true',
help='EMA feature updating mechanism'
)
self.parser.add_argument(
'--MC',
action='store_true',
help='Matching with both appearance and motion cost'
)
self.parser.add_argument(
'--woC',
action='store_true',
help='Replace the matching cascade with vanilla matching'
)
self.parser.add_argument(
'--AFLink',
action='store_true',
help='Appearance-Free Link'
)
self.parser.add_argument(
'--GSI',
action='store_true',
help='Gaussian-smoothed Interpolation'
)
self.parser.add_argument(
'--root_dataset',
type=str,
default='/data/dyh/data/MOTChallenge'
)
self.parser.add_argument(
'--path_AFLink',
type=str,
default='/data/dyh/results/StrongSORT_Git/AFLink_epoch20.pth'
)
self.parser.add_argument(
'--dir_save',
type=str,
default='/data/dyh/results/StrongSORT_Git/tmp'
)
self.parser.add_argument(
'--EMA_alpha',
type=float,
default=0.9
)
self.parser.add_argument(
'--MC_lambda',
type=float,
default=0.98
)
def parse(self, args=''):
if args == '':
opt = self.parser.parse_args()
else:
opt = self.parser.parse_args(args)
opt.min_confidence = 0.6
opt.nms_max_overlap = 1.0
opt.min_detection_height = 0
if opt.BoT:
opt.max_cosine_distance = 0.4
opt.dir_dets = '/data/dyh/results/StrongSORT_Git/{}_{}_YOLOX+BoT'.format(opt.dataset, opt.mode)
else:
opt.max_cosine_distance = 0.3
opt.dir_dets = '/data/dyh/results/StrongSORT_Git/{}_{}_YOLOX+simpleCNN'.format(opt.dataset, opt.mode)
if opt.MC:
opt.max_cosine_distance += 0.05
if opt.EMA:
opt.nn_budget = 1
else:
opt.nn_budget = 100
if opt.ECC:
path_ECC = '/data/dyh/results/StrongSORT_Git/{}_ECC_{}.json'.format(opt.dataset, opt.mode)
opt.ecc = json.load(open(path_ECC))
opt.sequences = data[opt.dataset][opt.mode]
opt.dir_dataset = join(
opt.root_dataset,
opt.dataset,
'train' if opt.mode == 'val' else 'test'
)
return opt
opt = opts().parse()