Skip to content

Commit b918901

Browse files
committed
ByteTrack files added
1 parent bdb6b1f commit b918901

File tree

5 files changed

+1174
-0
lines changed

5 files changed

+1174
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import numpy as np
2+
from collections import OrderedDict
3+
4+
5+
class TrackState(object):
6+
New = 0
7+
Tracked = 1
8+
Lost = 2
9+
Removed = 3
10+
11+
12+
class BaseTrack(object):
13+
_count = 0
14+
_class_count = {}
15+
16+
track_id = 0
17+
is_activated = False
18+
state = TrackState.New
19+
20+
history = OrderedDict()
21+
features = []
22+
curr_feature = None
23+
score = 0
24+
start_frame = 0
25+
frame_id = 0
26+
time_since_update = 0
27+
28+
# multi-camera
29+
location = (np.inf, np.inf)
30+
31+
@property
32+
def end_frame(self):
33+
return self.frame_id
34+
35+
@staticmethod
36+
def next_id():
37+
BaseTrack._count += 1
38+
return BaseTrack._count
39+
40+
@staticmethod
41+
def next_class_id(clase):
42+
if clase in BaseTrack._class_count.keys():
43+
BaseTrack._class_count[clase] += 1
44+
else:
45+
BaseTrack._class_count[clase] = 1
46+
return BaseTrack._class_count[clase]
47+
48+
def activate(self, *args):
49+
raise NotImplementedError
50+
51+
def predict(self):
52+
raise NotImplementedError
53+
54+
def update(self, *args, **kwargs):
55+
raise NotImplementedError
56+
57+
def mark_lost(self):
58+
self.state = TrackState.Lost
59+
60+
def mark_removed(self):
61+
self.state = TrackState.Removed

0 commit comments

Comments
 (0)