(self, det_bboxes, det_labels, frame_id, track_feats)
| 181 | |
| 182 | # def update(self, output_results): |
| 183 | def update(self, det_bboxes, det_labels, frame_id, track_feats): |
| 184 | |
| 185 | # self.frame_id += 1 |
| 186 | self.frame_id = frame_id + 1 |
| 187 | activated_starcks = [] |
| 188 | refind_stracks = [] |
| 189 | lost_stracks = [] |
| 190 | removed_stracks = [] |
| 191 | |
| 192 | # scores = output_results[:, 4] |
| 193 | # bboxes = output_results[:, :4] # x1y1x2y2 |
| 194 | scores = det_bboxes[:, 4].cpu().numpy() |
| 195 | bboxes = det_bboxes[:, :4].cpu().numpy() |
| 196 | |
| 197 | track_feature = F.normalize(track_feats).cpu().numpy() |
| 198 | |
| 199 | remain_inds = scores > self.track_thresh |
| 200 | dets = bboxes[remain_inds] |
| 201 | scores_keep = scores[remain_inds] |
| 202 | id_feature = track_feature[remain_inds] |
| 203 | |
| 204 | |
| 205 | inds_low = scores > self.low_thresh |
| 206 | inds_high = scores < self.track_thresh |
| 207 | inds_second = np.logical_and(inds_low, inds_high) |
| 208 | dets_second = bboxes[inds_second] |
| 209 | scores_second = scores[inds_second] |
| 210 | id_feature_second = track_feature[inds_second] |
| 211 | |
| 212 | if len(dets) > 0: |
| 213 | '''Detections''' |
| 214 | detections = [STrack(STrack.tlbr_to_tlwh(tlbr), s, f) for |
| 215 | (tlbr, s, f) in zip(dets, scores_keep, id_feature)] |
| 216 | else: |
| 217 | detections = [] |
| 218 | |
| 219 | |
| 220 | ''' Add newly detected tracklets to tracked_stracks''' |
| 221 | unconfirmed = [] |
| 222 | tracked_stracks = [] # type: list[STrack] |
| 223 | for track in self.tracked_stracks: |
| 224 | if not track.is_activated: |
| 225 | unconfirmed.append(track) |
| 226 | else: |
| 227 | tracked_stracks.append(track) |
| 228 | |
| 229 | ''' Step 2: First association, with Kalman and IOU''' |
| 230 | strack_pool = joint_stracks(tracked_stracks, self.lost_stracks) |
| 231 | # Predict the current location with KF |
| 232 | STrack.multi_predict(strack_pool) |
| 233 | |
| 234 | dists = matching.embedding_distance(strack_pool, detections) |
| 235 | dists = matching.fuse_motion(self.kalman_filter, dists, strack_pool, detections) |
| 236 | matches, u_track, u_detection = matching.linear_assignment(dists, thresh=0.6) |
| 237 | # dists = matching.iou_distance(strack_pool, detections) |
| 238 | # matches, u_track, u_detection = matching.linear_assignment(dists, thresh=0.8) |
| 239 | |
| 240 | for itracked, idet in matches: |
nothing calls this directly
no test coverage detected