MCPcopy Create free account
hub / github.com/FoundationVision/ByteTrack / read_mot_results

Function read_mot_results

tutorials/motr/evaluation.py:59–102  ·  view source on GitHub ↗
(filename, is_gt, is_ignore)

Source from the content-addressed store, hash-verified

57# return results_dict
58
59def read_mot_results(filename, is_gt, is_ignore):
60 valid_labels = {1}
61 ignore_labels = {0, 2, 7, 8, 12}
62 results_dict = dict()
63 if os.path.isfile(filename):
64 with open(filename, 'r') as f:
65 for line in f.readlines():
66 linelist = line.split(',')
67 if len(linelist) < 7:
68 continue
69 fid = int(linelist[0])
70 if fid < 1:
71 continue
72 results_dict.setdefault(fid, list())
73
74 if is_gt:
75 if 'MOT16-' in filename or 'MOT17-' in filename:
76 label = int(float(linelist[7]))
77 mark = int(float(linelist[6]))
78 if mark == 0 or label not in valid_labels:
79 continue
80 score = 1
81 elif is_ignore:
82 if 'MOT16-' in filename or 'MOT17-' in filename:
83 label = int(float(linelist[7]))
84 vis_ratio = float(linelist[8])
85 if label not in ignore_labels and vis_ratio >= 0:
86 continue
87 elif 'MOT15' in filename:
88 label = int(float(linelist[6]))
89 if label not in ignore_labels:
90 continue
91 else:
92 continue
93 score = 1
94 else:
95 score = float(linelist[6])
96
97 tlwh = tuple(map(float, linelist[2:6]))
98 target_id = int(linelist[1])
99
100 results_dict[fid].append((tlwh, target_id, score))
101
102 return results_dict
103
104def unzip_objs(objs):
105 if len(objs) > 0:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected