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

Class BYTETracker

tutorials/qdtrack/byte_tracker.py:147–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145
146
147class BYTETracker(object):
148 def __init__(self, frame_rate=30):
149 self.tracked_stracks = [] # type: list[STrack]
150 self.lost_stracks = [] # type: list[STrack]
151 self.removed_stracks = [] # type: list[STrack]
152
153 self.frame_id = 0
154
155 self.low_thresh = 0.2
156 self.track_thresh = 0.8
157 self.det_thresh = self.track_thresh + 0.1
158
159
160 self.buffer_size = int(frame_rate / 30.0 * 30)
161 self.max_time_lost = self.buffer_size
162 self.kalman_filter = KalmanFilter()
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:

Callers 1

init_trackerMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected