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

Class BYTETracker

tutorials/ctracker/byte_tracker.py:147–289  ·  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.4
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, 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)

Callers 1

run_each_datasetFunction · 0.90

Calls

no outgoing calls

Tested by 1

run_each_datasetFunction · 0.72