Fix not count
This commit is contained in:
1 parent
d03dfce564
commit
f5e4b2a170
1 file changed
+10
-5
@@ -354,11 +354,13 @@ class ByteTracker:
|
||||
# --- separate detections by score ---
|
||||
if len(boxes_xyxy) > 0:
|
||||
remain = scores > self.low_thresh
|
||||
remain_orig_idx = np.where(remain)[0]
|
||||
dets = boxes_xyxy[remain]
|
||||
det_scores = scores[remain]
|
||||
is_high = det_scores > self.high_thresh
|
||||
is_low = ~is_high
|
||||
else:
|
||||
remain_orig_idx = np.zeros(0, dtype=np.int64)
|
||||
dets = np.zeros((0, 4), dtype=np.float32)
|
||||
det_scores = np.zeros(0, dtype=np.float32)
|
||||
is_high = np.zeros(0, dtype=bool)
|
||||
@@ -398,10 +400,11 @@ class ByteTracker:
|
||||
|
||||
for di, ti in matches:
|
||||
det_global = int(high_idx[di])
|
||||
orig_idx = int(remain_orig_idx[det_global])
|
||||
track_pool[ti].update(dets[det_global])
|
||||
track_pool[ti].hit_streak = max(1, track_pool[ti].hit_streak)
|
||||
matched_track_idx.add(ti)
|
||||
det_to_track[det_global] = track_pool[ti].track_id
|
||||
det_to_track[orig_idx] = track_pool[ti].track_id
|
||||
tracked_map[track_pool[ti].track_id] = track_pool[ti].get_cx()
|
||||
match_pairs_high.append((det_global, ti))
|
||||
|
||||
@@ -422,12 +425,13 @@ class ByteTracker:
|
||||
for di, uti in matches2:
|
||||
det_global = int(low_idx[di])
|
||||
pool_idx = unmatched_tracks[uti]
|
||||
orig_idx = int(remain_orig_idx[det_global])
|
||||
track_pool[pool_idx].update(dets[det_global])
|
||||
track_pool[pool_idx].hit_streak = max(
|
||||
1, track_pool[pool_idx].hit_streak
|
||||
)
|
||||
matched_track_idx.add(pool_idx)
|
||||
det_to_track[det_global] = track_pool[pool_idx].track_id
|
||||
det_to_track[orig_idx] = track_pool[pool_idx].track_id
|
||||
tracked_map[track_pool[pool_idx].track_id] = track_pool[
|
||||
pool_idx
|
||||
].get_cx()
|
||||
@@ -463,10 +467,11 @@ class ByteTracker:
|
||||
high_all = np.where(is_high)[0]
|
||||
matched_det_ids = set(det_to_track.keys())
|
||||
for dg in high_all:
|
||||
if int(dg) not in matched_det_ids:
|
||||
trk = KalmanBoxTracker(dets[dg])
|
||||
orig_idx = int(remain_orig_idx[int(dg)])
|
||||
if orig_idx not in matched_det_ids:
|
||||
trk = KalmanBoxTracker(dets[int(dg)])
|
||||
self.tracked_tracks.append(trk)
|
||||
det_to_track[int(dg)] = trk.track_id
|
||||
det_to_track[orig_idx] = trk.track_id
|
||||
tracked_map[trk.track_id] = trk.get_cx()
|
||||
|
||||
return tracked_map, det_to_track, lost_map
|
||||
|
||||
Reference in new issue
Block a user