@@ -244,17 +244,15 @@ def post_process_v7(out, img_size, ori_img_size):
244244 return out
245245
246246
247- def save_results (folder_name , seq_name , results , data_type = 'default ' ):
247+ def save_results (folder_name , seq_name , results , data_type = 'mot17 ' ):
248248 """
249249 write results to txt file
250250
251251 results: list row format: frame id, target id, box coordinate, class(optional)
252252 to_file: file path(optional)
253- data_type: write data format
253+ data_type: write data format, default or mot17 format.
254254 """
255255 assert len (results )
256- if not data_type == 'default' :
257- raise NotImplementedError # TODO
258256
259257 if not os .path .exists (f'./tracker/results/{ folder_name } ' ):
260258
@@ -263,11 +261,13 @@ def save_results(folder_name, seq_name, results, data_type='default'):
263261 with open (os .path .join ('./tracker/results' , folder_name , seq_name + '.txt' ), 'w' ) as f :
264262 for frame_id , target_ids , tlwhs , clses in results :
265263 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+
269265 for id , tlwh , cls in zip (target_ids , tlwhs , clses ):
270266 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 ' )
271271 f .close ()
272272
273273 return folder_name
@@ -359,7 +359,7 @@ def get_color(idx):
359359 parser .add_argument ('--dhn_path' , type = str , default = './weights/DHN.pth' , help = 'path of DHN path for DeepMOT' )
360360
361361 # 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' )
363363 parser .add_argument ('--nms_thresh' , type = float , default = 0.7 , help = 'thresh for NMS' )
364364 parser .add_argument ('--iou_thresh' , type = float , default = 0.5 , help = 'IOU thresh to filter tracks' )
365365
0 commit comments