detection.py
Go to the documentation of this file.
1 # vim: expandtab:ts=4:sw=4
2 import numpy as np
3 
4 
6  """
7  This class represents a bounding box detection in a single image.
8 
9  Parameters
10  ----------
11  tlwh : array_like
12  Bounding box in format `(x, y, w, h)`.
13  confidence : float
14  Detector confidence score.
15  feature : array_like
16  A feature vector that describes the object contained in this image.
17 
18  Attributes
19  ----------
20  tlwh : ndarray
21  Bounding box in format `(top left x, top left y, width, height)`.
22  confidence : ndarray
23  Detector confidence score.
24  feature : ndarray | NoneType
25  A feature vector that describes the object contained in this image.
26 
27  """
28 
29  def __init__(self, tlwh, confidence, feature):
30  self.tlwh = np.asarray(tlwh, dtype=np.float)
31  self.confidence = float(confidence)
32  self.feature = np.asarray(feature, dtype=np.float32)
33 
34  def to_tlbr(self):
35  """Convert bounding box to format `(min x, min y, max x, max y)`, i.e.,
36  `(top left, bottom right)`.
37  """
38  ret = self.tlwh.copy()
39  ret[2:] += ret[:2]
40  return ret
41 
42  def to_xyah(self):
43  """Convert bounding box to format `(center x, center y, aspect ratio,
44  height)`, where the aspect ratio is `width / height`.
45  """
46  ret = self.tlwh.copy()
47  ret[:2] += ret[2:] / 2
48  ret[2] /= ret[3]
49  return ret
object
ssd_train_dataset.float
float
Definition: ssd_train_dataset.py:180
deep_sort.detection.Detection.to_xyah
def to_xyah(self)
Definition: detection.py:42
deep_sort.detection.Detection.feature
feature
Definition: detection.py:32
deep_sort.detection.Detection
Definition: detection.py:5
deep_sort.detection.Detection.tlwh
tlwh
Definition: detection.py:30
deep_sort.detection.Detection.to_tlbr
def to_tlbr(self)
Definition: detection.py:34
deep_sort.detection.Detection.confidence
confidence
Definition: detection.py:31
deep_sort.detection.Detection.__init__
def __init__(self, tlwh, confidence, feature)
Definition: detection.py:29


jsk_perception
Author(s): Manabu Saito, Ryohei Ueda
autogenerated on Fri May 16 2025 03:11:16