Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add confidence tracker
  • Loading branch information
rolson24 committed Mar 22, 2024
commit 5c52c7be56aaeb7d090c047bc6d58dfe8e263d7c
61 changes: 61 additions & 0 deletions supervision/tracker/confidence_tracker/basetrack.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from collections import OrderedDict

import numpy as np


class TrackState(object):
New = 0
Tracked = 1
Lost = 2
LongLost = 3
Removed = 4


class BaseTrack(object):
_count = 0

track_id = 0
is_activated = False
state = TrackState.New

history = OrderedDict()
features = []
curr_feature = None
score = 0
start_frame = 0
frame_id = 0
time_since_update = 0

# multi-camera
location = (np.inf, np.inf)

@property
def end_frame(self):
return self.frame_id

@staticmethod
def next_id():
BaseTrack._count += 1
return BaseTrack._count

def activate(self, *args):
raise NotImplementedError

def predict(self):
raise NotImplementedError

def update(self, *args, **kwargs):
raise NotImplementedError

def mark_lost(self):
self.state = TrackState.Lost

def mark_long_lost(self):
self.state = TrackState.LongLost

def mark_removed(self):
self.state = TrackState.Removed

@staticmethod
def clear_count():
BaseTrack._count = 0
Loading