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

Method update

tutorials/qdtrack/byte_tracker.py:165–301  ·  view source on GitHub ↗
(self, det_bboxes, det_labels, frame_id, track_feats=None)

Source from the content-addressed store, hash-verified

163
164# def update(self, output_results):
165 def update(self, det_bboxes, det_labels, frame_id, track_feats=None):
166
167# self.frame_id += 1
168 self.frame_id = frame_id + 1
169 activated_starcks = []
170 refind_stracks = []
171 lost_stracks = []
172 removed_stracks = []
173
174# scores = output_results[:, 4]
175# bboxes = output_results[:, :4] # x1y1x2y2
176 scores = det_bboxes[:, 4].cpu().numpy()
177 bboxes = det_bboxes[:, :4].cpu().numpy()
178
179 remain_inds = scores > self.track_thresh
180 dets = bboxes[remain_inds]
181 scores_keep = scores[remain_inds]
182
183
184 inds_low = scores > self.low_thresh
185 inds_high = scores < self.track_thresh
186 inds_second = np.logical_and(inds_low, inds_high)
187 dets_second = bboxes[inds_second]
188 scores_second = scores[inds_second]
189
190
191 if len(dets) > 0:
192 '''Detections'''
193 detections = [STrack(STrack.tlbr_to_tlwh(tlbr), s) for
194 (tlbr, s) in zip(dets, scores_keep)]
195 else:
196 detections = []
197
198 ''' Add newly detected tracklets to tracked_stracks'''
199 unconfirmed = []
200 tracked_stracks = [] # type: list[STrack]
201 for track in self.tracked_stracks:
202 if not track.is_activated:
203 unconfirmed.append(track)
204 else:
205 tracked_stracks.append(track)
206
207 ''' Step 2: First association, with Kalman and IOU'''
208 strack_pool = joint_stracks(tracked_stracks, self.lost_stracks)
209 # Predict the current location with KF
210 STrack.multi_predict(strack_pool)
211 dists = matching.iou_distance(strack_pool, detections)
212 matches, u_track, u_detection = matching.linear_assignment(dists, thresh=0.8)
213
214 for itracked, idet in matches:
215 track = strack_pool[itracked]
216 det = detections[idet]
217 if track.state == TrackState.Tracked:
218 track.update(detections[idet], self.frame_id)
219 activated_starcks.append(track)
220 else:
221 track.re_activate(det, self.frame_id, new_id=False)
222 refind_stracks.append(track)

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