-
Notifications
You must be signed in to change notification settings - Fork 297
Expand file tree
/
Copy pathbase.py
More file actions
40 lines (30 loc) · 860 Bytes
/
base.py
File metadata and controls
40 lines (30 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from abc import ABC, abstractmethod
from typing import Callable, List, Optional
import numpy as np
import supervision as sv
class BaseTracker(ABC):
@abstractmethod
def update(self, detections: sv.Detections) -> sv.Detections:
pass
@abstractmethod
def reset(self) -> None:
pass
class BaseTrackerWithFeatures(ABC):
@abstractmethod
def update(self, detections: sv.Detections, frame: np.ndarray) -> sv.Detections:
pass
@abstractmethod
def reset(self) -> None:
pass
class BaseOfflineTracker(ABC):
@abstractmethod
def reset(self) -> None:
pass
@abstractmethod
def track(
self,
source_path: str,
get_model_detections: Callable[[np.ndarray], sv.Detections],
num_of_tracks: Optional[int] = None,
) -> List[sv.Detections]:
pass