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

Method update

tutorials/motr/byte_tracker.py:164–286  ·  view source on GitHub ↗
(self, output_results)

Source from the content-addressed store, hash-verified

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

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