@@ -28,8 +28,8 @@ def __init__(self, method='orb', downscale=2, verbose=None):
28
28
self .matcher = cv2 .BFMatcher (cv2 .NORM_L2 )
29
29
30
30
elif self .method == 'ecc' :
31
- number_of_iterations = 5000
32
- termination_eps = 1e-6
31
+ number_of_iterations = 100
32
+ termination_eps = 1e-5
33
33
self .warp_mode = cv2 .MOTION_EUCLIDEAN
34
34
self .criteria = (cv2 .TERM_CRITERIA_EPS | cv2 .TERM_CRITERIA_COUNT , number_of_iterations , termination_eps )
35
35
@@ -270,7 +270,7 @@ def multi_gmc(stracks, H=np.eye(2, 3)):
270
270
271
271
272
272
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 :
274
274
super ().__init__ (opts , frame_rate , * args , ** kwargs )
275
275
276
276
self .use_apperance_model = False
@@ -282,6 +282,7 @@ def __init__(self, opts, frame_rate=30, gamma=0.02, *args, **kwargs) -> None:
282
282
283
283
self .filter_small_area = False # filter area < 50 bboxs, TODO: why some bboxs has 0 area
284
284
285
+ self .use_GMC = use_GMC
285
286
self .gmc = GMC (method = 'orb' , downscale = 2 , verbose = None ) # GMC module to fix camera motion
286
287
287
288
# for BoT SORT association strategy equation(12) in paper
@@ -390,8 +391,10 @@ def update(self, det_results, ori_img):
390
391
STrack .multi_predict (stracks = strack_pool , kalman = self .kalman )
391
392
392
393
# 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 )
395
398
396
399
"""Step 2. first match, high conf detections"""
397
400
IoU_dist = matching .iou_distance (strack_pool , D_high ) # IoU dist
@@ -444,7 +447,7 @@ def update(self, det_results, ori_img):
444
447
""" Step 4. deal with rest tracks and dets"""
445
448
# deal with final unmatched tracks
446
449
for idx in u_tracks1_idx :
447
- track = strack_pool [idx ]
450
+ track = u_tracks0 [idx ]
448
451
track .mark_lost ()
449
452
lost_stracks .append (track )
450
453
0 commit comments