From ff5b81f82d263cb4a8ee8d5fc210d8efd35c445a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Castro?= Date: Thu, 4 Apr 2024 15:10:43 -0300 Subject: [PATCH] Add scores attribute to TrackedObject class --- norfair/tracker.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/norfair/tracker.py b/norfair/tracker.py index 275eceee..1b6a44a7 100644 --- a/norfair/tracker.py +++ b/norfair/tracker.py @@ -503,6 +503,7 @@ def __init__( self.last_detection: "Detection" = initial_detection self.age: int = 0 self.is_initializing: bool = self.hit_counter <= self.initialization_delay + self.scores = initial_detection.scores self.initializing_id: Optional[int] = self._obj_factory.get_initializing_id() self.id: Optional[int] = None @@ -545,6 +546,7 @@ def tracker_step(self): self.age += 1 # Advances the tracker's state self.filter.predict() + self.scores = np.array([np.nan] * self.num_points) @property def hit_counter_is_positive(self): @@ -627,6 +629,8 @@ def hit(self, detection: "Detection", period: int = 1): self.last_detection = detection self.hit_counter = min(self.hit_counter + 2 * period, self.hit_counter_max) + self.scores = detection.scores + if self.is_initializing and self.hit_counter > self.initialization_delay: self.is_initializing = False self._acquire_ids()