Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detection age not always set #317

Open
nmichlo opened this issue May 1, 2024 · 0 comments
Open

Detection age not always set #317

nmichlo opened this issue May 1, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@nmichlo
Copy link

nmichlo commented May 1, 2024

Describe the bug

Age is not set on all newly added detections.

To Reproduce

Set past_detections_length to some low number, and add more detections than this. The detection age will not be set after being "added" when discarded.

Expected behavior

Even when discarded, the detection age should still be set after being added, because this affects the last_detection.

norfair/norfair/tracker.py

Lines 700 to 715 in 009a1b1

def _conditionally_add_to_past_detections(self, detection):
"""Adds detections into (and pops detections away) from `past_detections`
It does so by keeping a fixed amount of past detections saved into each
TrackedObject, while maintaining them distributed uniformly through the object's
lifetime.
"""
if self.past_detections_length == 0:
return
if len(self.past_detections) < self.past_detections_length:
detection.age = self.age
self.past_detections.append(detection)
elif self.age >= self.past_detections[0].age * self.past_detections_length:
self.past_detections.pop(0)
detection.age = self.age
self.past_detections.append(detection)

Seems like the above lines should always set the detection age. It should also probably assert that the age has not already been set / added to a tracker.

Screenshots or videos
N/A

Environment (please complete the following information):

  • OS: [e.g. Ubuntu 20.04]
  • Python version: [e.g. 3.9.10]
  • Norfair version: [e.g. 1.0.0]

Additional context
N/A

@nmichlo nmichlo added the bug Something isn't working label May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant