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 diff --git a/yolox/tracker/byte_tracker.py b/yolox/tracker/byte_tracker.py index 2d004599..a0ee3cf8 100644 --- a/yolox/tracker/byte_tracker.py +++ b/yolox/tracker/byte_tracker.py @@ -7,13 +7,13 @@ 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): shared_kalman = KalmanFilter() def __init__(self, tlwh, score): - + super().__init__() # wait activate self._tlwh = np.asarray(tlwh, dtype=np.float) self.kalman_filter = None 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):