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

Method update

tutorials/qdtrack/tracker_reid_motion.py:183–345  ·  view source on GitHub ↗
(self, det_bboxes, det_labels, frame_id, track_feats)

Source from the content-addressed store, hash-verified

181
182# def update(self, output_results):
183 def update(self, det_bboxes, det_labels, frame_id, track_feats):
184
185# self.frame_id += 1
186 self.frame_id = frame_id + 1
187 activated_starcks = []
188 refind_stracks = []
189 lost_stracks = []
190 removed_stracks = []
191
192# scores = output_results[:, 4]
193# bboxes = output_results[:, :4] # x1y1x2y2
194 scores = det_bboxes[:, 4].cpu().numpy()
195 bboxes = det_bboxes[:, :4].cpu().numpy()
196
197 track_feature = F.normalize(track_feats).cpu().numpy()
198
199 remain_inds = scores > self.track_thresh
200 dets = bboxes[remain_inds]
201 scores_keep = scores[remain_inds]
202 id_feature = track_feature[remain_inds]
203
204
205 inds_low = scores > self.low_thresh
206 inds_high = scores < self.track_thresh
207 inds_second = np.logical_and(inds_low, inds_high)
208 dets_second = bboxes[inds_second]
209 scores_second = scores[inds_second]
210 id_feature_second = track_feature[inds_second]
211
212 if len(dets) > 0:
213 '''Detections'''
214 detections = [STrack(STrack.tlbr_to_tlwh(tlbr), s, f) for
215 (tlbr, s, f) in zip(dets, scores_keep, id_feature)]
216 else:
217 detections = []
218
219
220 ''' Add newly detected tracklets to tracked_stracks'''
221 unconfirmed = []
222 tracked_stracks = [] # type: list[STrack]
223 for track in self.tracked_stracks:
224 if not track.is_activated:
225 unconfirmed.append(track)
226 else:
227 tracked_stracks.append(track)
228
229 ''' Step 2: First association, with Kalman and IOU'''
230 strack_pool = joint_stracks(tracked_stracks, self.lost_stracks)
231 # Predict the current location with KF
232 STrack.multi_predict(strack_pool)
233
234 dists = matching.embedding_distance(strack_pool, detections)
235 dists = matching.fuse_motion(self.kalman_filter, dists, strack_pool, detections)
236 matches, u_track, u_detection = matching.linear_assignment(dists, thresh=0.6)
237# dists = matching.iou_distance(strack_pool, detections)
238# matches, u_track, u_detection = matching.linear_assignment(dists, thresh=0.8)
239
240 for itracked, idet in matches:

Callers

nothing calls this directly

Calls 11

STrackClass · 0.70
joint_stracksFunction · 0.70
sub_stracksFunction · 0.70
remove_duplicate_stracksFunction · 0.70
tlbr_to_tlwhMethod · 0.45
multi_predictMethod · 0.45
updateMethod · 0.45
re_activateMethod · 0.45
mark_lostMethod · 0.45
mark_removedMethod · 0.45
activateMethod · 0.45

Tested by

no test coverage detected