Skip to content

Commit fed6278

Browse files
authored
fix a wrong code in BoTSORT
1 parent 421229c commit fed6278

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tracker/botsort.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def __init__(self, method='orb', downscale=2, verbose=None):
2828
self.matcher = cv2.BFMatcher(cv2.NORM_L2)
2929

3030
elif self.method == 'ecc':
31-
number_of_iterations = 5000
32-
termination_eps = 1e-6
31+
number_of_iterations = 100
32+
termination_eps = 1e-5
3333
self.warp_mode = cv2.MOTION_EUCLIDEAN
3434
self.criteria = (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, number_of_iterations, termination_eps)
3535

@@ -270,7 +270,7 @@ def multi_gmc(stracks, H=np.eye(2, 3)):
270270

271271

272272
class BoTSORT(BaseTracker):
273-
def __init__(self, opts, frame_rate=30, gamma=0.02, *args, **kwargs) -> None:
273+
def __init__(self, opts, frame_rate=30, gamma=0.02, use_GMC=False, *args, **kwargs) -> None:
274274
super().__init__(opts, frame_rate, *args, **kwargs)
275275

276276
self.use_apperance_model = False
@@ -282,6 +282,7 @@ def __init__(self, opts, frame_rate=30, gamma=0.02, *args, **kwargs) -> None:
282282

283283
self.filter_small_area = False # filter area < 50 bboxs, TODO: why some bboxs has 0 area
284284

285+
self.use_GMC = use_GMC
285286
self.gmc = GMC(method='orb', downscale=2, verbose=None) # GMC module to fix camera motion
286287

287288
# for BoT SORT association strategy equation(12) in paper
@@ -390,8 +391,10 @@ def update(self, det_results, ori_img):
390391
STrack.multi_predict(stracks=strack_pool, kalman=self.kalman)
391392

392393
# Fix camera motion
393-
wrap = self.gmc.apply(raw_frame=ori_img, detections=det_high)
394-
multi_gmc(strack_pool, wrap) # update kalman mean and cov
394+
if self.use_GMC:
395+
wrap = self.gmc.apply(raw_frame=ori_img, detections=det_high)
396+
multi_gmc(strack_pool, wrap) # update kalman mean and cov
397+
multi_gmc(unconfirmed, wrap)
395398

396399
"""Step 2. first match, high conf detections"""
397400
IoU_dist = matching.iou_distance(strack_pool, D_high) # IoU dist
@@ -444,7 +447,7 @@ def update(self, det_results, ori_img):
444447
""" Step 4. deal with rest tracks and dets"""
445448
# deal with final unmatched tracks
446449
for idx in u_tracks1_idx:
447-
track = strack_pool[idx]
450+
track = u_tracks0[idx]
448451
track.mark_lost()
449452
lost_stracks.append(track)
450453

0 commit comments

Comments
 (0)