Commiting with problems in tracking.
This commit is contained in:
1 parent
152b3b9da5
commit
2c798c8ca5
5 files changed
+105
-49
No files matched your search
@@ -1,7 +1,37 @@
|
||||
from typing import NewType
|
||||
from dataclasses import dataclass
|
||||
import numpy as np
|
||||
|
||||
type XCoord = float
|
||||
type YCoord = NewType('YCoord', float)
|
||||
type Point = tuple[XCoord, YCoord]
|
||||
type VideoFrame = NewType('Frame', float)
|
||||
type VideoTimestamp = float
|
||||
XCoord = NewType('XCoord', float)
|
||||
YCoord = NewType('YCoord', float)
|
||||
Confidence = NewType('Confidence', float)
|
||||
Category = NewType('Category', float)
|
||||
|
||||
|
||||
|
||||
@dataclass
|
||||
class Point:
|
||||
x: XCoord
|
||||
y: YCoord
|
||||
|
||||
VideoFrame = NewType('Frame', float)
|
||||
VideoTimestamp = float
|
||||
|
||||
@dataclass
|
||||
class DetectedObject:
|
||||
xmin: XCoord
|
||||
ymin: YCoord
|
||||
xmax: XCoord
|
||||
ymax: YCoord
|
||||
confidence: Confidence
|
||||
category: Category
|
||||
|
||||
def as_int_box(self) -> tuple[tuple[int, int], tuple[int, int]]:
|
||||
return (int(self.xmin), int(self.ymin)), (int(self.xmax), int(self.ymax))
|
||||
|
||||
def as_nparray(self):
|
||||
return np.array([self.xmin, self.ymax, self.xmax, self.ymax, self.confidence, self.category])
|
||||
|
||||
|
||||
|
||||
Color = tuple[int, int, int]
|
||||
Reference in new issue
Block a user