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

Class BYTETracker

tutorials/motr/byte_tracker.py:147–286  ·  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 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)

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected