1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| import numpy as np
|
|
| class Detection(object):
| def __init__(self, tlwh, confidence, feature):
| self.tlwh = np.asarray(tlwh, dtype=np.float)
| self.confidence = float(confidence)
| self.feature = np.asarray(feature, dtype=np.float32)
|
| def to_tlbr(self):
| ret = self.tlwh.copy()
| ret[2:] += ret[:2]
| return ret
|
| def to_xyah(self):
| ret = self.tlwh.copy()
| ret[:2] += ret[2:] / 2
| ret[2] /= ret[3]
| return ret
|
|