-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
60 lines (49 loc) · 1.8 KB
/
main.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
"""
Hierarchical IoU Tracking based on tracklet interval
"""
from tqdm import tqdm
from os.path import join
from opts import opt
from tracker import Tracker
from detection import Detection
from evaluation import evaluation
def run(args):
for video in tqdm(args.videos):
if args.params['input_tracks']:
detections = join(args.input_dir, f'{video}.txt')
else:
detections = Detection(
input_path=join(args.input_dir, f'{video}.txt'),
conf_thr=args.params['conf_thr']['low'],
nms_thr=args.params['nms_thr'],
)
tracker = Tracker(
dataset=args.dataset,
video=video,
detections=detections,
high_conf_thr=args.params['conf_thr']['high'],
motion_param=args.params['motion_matching'],
iou_param=args.params['iou_matching'],
predictor=args.params['predictor'],
interpolation=args.params['interpolation'],
)
for i, delta_t in enumerate(args.params['delta_t'], start=1):
if 1 < i == len(args.params['delta_t']):
tracker.allow_overlapping = True
tracker.before_match(delta_t)
if delta_t == 1:
tracker.camera_motion_compensation(**args.params['ConsistentCamera'])
tracker.pre_match(args.params['ConsistentMotion'])
for frame in range(tracker.frames[0], tracker.frames[1]):
tracker.match(frame)
tracker.update()
tracker.postprocess(**args.params['post_trk'])
tracker.write(
output_dir=args.output_dir,
fmt=args.dataset,
**args.params['post_det'],
)
if args.split == 'val':
evaluation()
if __name__ == '__main__':
run(opt)