MCPcopy Index your code
hub / github.com/FoundationVision/ByteTrack / update

Method update

tutorials/motr/eval.py:171–190  ·  view source on GitHub ↗
(self, dt_instances: Instances)

Source from the content-addressed store, hash-verified

169 self.tracker = BYTETracker()
170
171 def update(self, dt_instances: Instances):
172 ret = []
173 for i in range(len(dt_instances)):
174 label = dt_instances.labels[i]
175 if label == 0:
176 id = dt_instances.obj_idxes[i]
177 box_with_score = np.concatenate([dt_instances.boxes[i], dt_instances.scores[i:i+1]], axis=-1)
178 ret.append(np.concatenate((box_with_score, [id + 1])).reshape(1, -1)) # +1 as MOT benchmark requires positive
179
180 if len(ret) > 0:
181 online_targets = self.tracker.update(np.concatenate(ret))
182
183 online_ret = []
184 for t in online_targets:
185 online_ret.append(np.array([t.tlbr[0], t.tlbr[1], t.tlbr[2], t.tlbr[3], t.score, t.track_id]).reshape(1, -1))
186
187 if len(online_ret) > 0:
188 return np.concatenate(online_ret)
189
190 return np.empty((0, 6))
191
192
193

Callers 3

detectMethod · 0.45
eval_frameMethod · 0.45
__getitem__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected