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

Method update

tutorials/ctracker/byte_tracker.py:165–289  ·  view source on GitHub ↗
(self, det_bboxes, scores)

Source from the content-addressed store, hash-verified

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

Callers 1

run_each_datasetFunction · 0.95

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 1

run_each_datasetFunction · 0.76