@@ -244,17 +244,15 @@ def post_process_v7(out, img_size, ori_img_size):
244
244
return out
245
245
246
246
247
- def save_results (folder_name , seq_name , results , data_type = 'default ' ):
247
+ def save_results (folder_name , seq_name , results , data_type = 'mot17 ' ):
248
248
"""
249
249
write results to txt file
250
250
251
251
results: list row format: frame id, target id, box coordinate, class(optional)
252
252
to_file: file path(optional)
253
- data_type: write data format
253
+ data_type: write data format, default or mot17 format.
254
254
"""
255
255
assert len (results )
256
- if not data_type == 'default' :
257
- raise NotImplementedError # TODO
258
256
259
257
if not os .path .exists (f'./tracker/results/{ folder_name } ' ):
260
258
@@ -263,11 +261,13 @@ def save_results(folder_name, seq_name, results, data_type='default'):
263
261
with open (os .path .join ('./tracker/results' , folder_name , seq_name + '.txt' ), 'w' ) as f :
264
262
for frame_id , target_ids , tlwhs , clses in results :
265
263
if data_type == 'default' :
266
-
267
- # f.write(f'{frame_id},{target_id},{tlwh[0]},{tlwh[1]},\
268
- # {tlwh[2]},{tlwh[3]},{cls}\n')
264
+
269
265
for id , tlwh , cls in zip (target_ids , tlwhs , clses ):
270
266
f .write (f'{ frame_id } ,{ id } ,{ tlwh [0 ]:.2f} ,{ tlwh [1 ]:.2f} ,{ tlwh [2 ]:.2f} ,{ tlwh [3 ]:.2f} ,{ int (cls )} \n ' )
267
+
268
+ elif data_type == 'mot17' :
269
+ for id , tlwh , cls in zip (target_ids , tlwhs , clses ):
270
+ f .write (f'{ frame_id } ,{ id } ,{ tlwh [0 ]:.2f} ,{ tlwh [1 ]:.2f} ,{ tlwh [2 ]:.2f} ,{ tlwh [3 ]:.2f} ,1.0,-1,-1,-1\n ' )
271
271
f .close ()
272
272
273
273
return folder_name
@@ -359,7 +359,7 @@ def get_color(idx):
359
359
parser .add_argument ('--dhn_path' , type = str , default = './weights/DHN.pth' , help = 'path of DHN path for DeepMOT' )
360
360
361
361
# threshs
362
- parser .add_argument ('--conf_thresh' , type = float , default = 0.5 , help = 'filter tracks' )
362
+ parser .add_argument ('--conf_thresh' , type = float , default = 0.2 , help = 'filter tracks' )
363
363
parser .add_argument ('--nms_thresh' , type = float , default = 0.7 , help = 'thresh for NMS' )
364
364
parser .add_argument ('--iou_thresh' , type = float , default = 0.5 , help = 'IOU thresh to filter tracks' )
365
365
0 commit comments