1313def track_iou (detections , sigma_l , sigma_h , sigma_iou , t_min ):
1414 """
1515 Simple IOU based tracker.
16- See "High-Speed Tracking-by-Detection Without Using Image Information by E. Bochinski, V. Eiselein, T. Sikora" for
16+ See "High-Speed Tracking-by-Detection Without Using Image Information
17+ by E. Bochinski, V. Eiselein, T. Sikora" for
1718 more information.
1819
1920 Args:
20- detections (list): list of detections per frame, usually generated by util.load_mot
21+ detections (list): list of detections per frame, usually generated by
22+ util.load_mot
2123 sigma_l (float): low detection threshold.
2224 sigma_h (float): high detection threshold.
2325 sigma_iou (float): IOU threshold.
@@ -38,10 +40,12 @@ def track_iou(detections, sigma_l, sigma_h, sigma_iou, t_min):
3840 for track in tracks_active :
3941 if len (dets ) > 0 :
4042 # get det with highest iou
41- best_match = max (dets , key = lambda x : iou (track ['bboxes' ][- 1 ], x ['bbox' ]))
43+ best_match = max (dets , key = lambda x : iou (track ['bboxes' ][- 1 ],
44+ x ['bbox' ]))
4245 if iou (track ['bboxes' ][- 1 ], best_match ['bbox' ]) >= sigma_iou :
4346 track ['bboxes' ].append (best_match ['bbox' ])
44- track ['max_score' ] = max (track ['max_score' ], best_match ['score' ])
47+ track ['max_score' ] = max (track ['max_score' ],
48+ best_match ['score' ])
4549
4650 updated_tracks .append (track )
4751
@@ -51,16 +55,19 @@ def track_iou(detections, sigma_l, sigma_h, sigma_iou, t_min):
5155 # if track was not updated
5256 if len (updated_tracks ) == 0 or track is not updated_tracks [- 1 ]:
5357 # finish track when the conditions are met
54- if track ['max_score' ] >= sigma_h and len (track ['bboxes' ]) >= t_min :
58+ if track ['max_score' ] >= sigma_h and len (
59+ track ['bboxes' ]) >= t_min :
5560 tracks_finished .append (track )
5661
5762 # create new tracks
58- new_tracks = [{'bboxes' : [det ['bbox' ]], 'max_score' : det ['score' ], 'start_frame' : frame_num } for det in dets ]
63+ new_tracks = [{'bboxes' : [det ['bbox' ]], 'max_score' : det ['score' ],
64+ 'start_frame' : frame_num } for det in dets ]
5965 tracks_active = updated_tracks + new_tracks
6066
6167 # finish all remaining active tracks
6268 tracks_finished += [track for track in tracks_active
63- if track ['max_score' ] >= sigma_h and len (track ['bboxes' ]) >= t_min ]
69+ if track ['max_score' ] >= sigma_h and len (
70+ track ['bboxes' ]) >= t_min ]
6471
6572 return tracks_finished
6673
@@ -91,7 +98,8 @@ def track_iou_matlab_wrapper(detections, sigma_l, sigma_h, sigma_iou, t_min):
9198 out = []
9299 for track in tracks :
93100 for i , bbox in enumerate (track ['bboxes' ]):
94- out += [float (bbox [0 ]), float (bbox [1 ]), float (bbox [2 ] - bbox [0 ]), float (bbox [3 ] - bbox [1 ]),
101+ out += [float (bbox [0 ]), float (bbox [1 ]), float (bbox [2 ] - bbox [0 ]),
102+ float (bbox [3 ] - bbox [1 ]),
95103 float (track ['start_frame' ] + i ), float (id_ )]
96104 id_ += 1
97105
0 commit comments