From c82103181aaeed938bd2658f267188f89134ee48 Mon Sep 17 00:00:00 2001 From: YyuK-Liao Date: Mon, 4 Jul 2022 18:32:44 +0800 Subject: [PATCH 1/3] Change import name under tracker --- yolox/tracker/byte_tracker.py | 2 +- yolox/tracker/matching.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/yolox/tracker/byte_tracker.py b/yolox/tracker/byte_tracker.py index 2d004599..58bd836c 100644 --- a/yolox/tracker/byte_tracker.py +++ b/yolox/tracker/byte_tracker.py @@ -7,7 +7,7 @@ import torch.nn.functional as F from .kalman_filter import KalmanFilter -from yolox.tracker import matching +from . import matching from .basetrack import BaseTrack, TrackState class STrack(BaseTrack): diff --git a/yolox/tracker/matching.py b/yolox/tracker/matching.py index d36a6cf5..3fce605a 100644 --- a/yolox/tracker/matching.py +++ b/yolox/tracker/matching.py @@ -5,7 +5,7 @@ from scipy.spatial.distance import cdist from cython_bbox import bbox_overlaps as bbox_ious -from yolox.tracker import kalman_filter +from . import kalman_filter import time def merge_matches(m1, m2, shape): From 2d10f24697461d55fc9fd76bfe1544adf9de50a6 Mon Sep 17 00:00:00 2001 From: YyuK-Liao Date: Mon, 4 Jul 2022 19:03:08 +0800 Subject: [PATCH 2/3] Fix the inheritance problem of STrack --- yolox/tracker/byte_tracker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yolox/tracker/byte_tracker.py b/yolox/tracker/byte_tracker.py index 58bd836c..a0ee3cf8 100644 --- a/yolox/tracker/byte_tracker.py +++ b/yolox/tracker/byte_tracker.py @@ -13,7 +13,7 @@ class STrack(BaseTrack): shared_kalman = KalmanFilter() def __init__(self, tlwh, score): - + super().__init__() # wait activate self._tlwh = np.asarray(tlwh, dtype=np.float) self.kalman_filter = None From 24c48bc7281f6a2a9acfbf616bfc98c6ed12b421 Mon Sep 17 00:00:00 2001 From: YyuK-Liao Date: Tue, 5 Jul 2022 20:47:38 +0800 Subject: [PATCH 3/3] Fix trackID allocate problem --- yolox/tracker/basetrack.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/yolox/tracker/basetrack.py b/yolox/tracker/basetrack.py index d5837b05..8b53fb97 100644 --- a/yolox/tracker/basetrack.py +++ b/yolox/tracker/basetrack.py @@ -10,9 +10,9 @@ class TrackState(object): class BaseTrack(object): - def __init__(self): - self._count = 0 + _count = 0 + def __init__(self): self.track_id = 0 self.is_activated = False self.state = TrackState.New @@ -32,9 +32,10 @@ def __init__(self): def end_frame(self): return self.frame_id - def next_id(self): - self._count += 1 - return self._count + @staticmethod + def next_id(): + BaseTrack._count += 1 + return BaseTrack._count def activate(self, *args): raise NotImplementedError