Skip to content

Commit

Permalink
Add scores attribute to TrackedObject class
Browse files Browse the repository at this point in the history
  • Loading branch information
aguscas committed Apr 4, 2024
1 parent 009a1b1 commit ff5b81f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions norfair/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit ff5b81f

Please sign in to comment.