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

Is there a link between detections and tracked_objects. (maintain order) #254

Closed
Edohvin opened this issue Feb 20, 2023 · 2 comments
Closed
Labels
help wanted Extra attention is needed

Comments

@Edohvin
Copy link

Edohvin commented Feb 20, 2023

Imagine there are 3 bounding boxes in 'detections' and 2 items in 'tracked_objects' (because one object is still uninitialized).

tracked_objects = tracker.update(detections=detections)

Is there any way to know which item in detections is uninitialized (not yet alive)?

Extra info: I am basically looking for a link between the input and the output. I want to achieve the output (tracked_objects) to be also of length 3, and just have None in there. So for example [obj1(...), none, obj2(...)]. This makes it clear that the second bounding box from the detections variable is the item that is still initializing. I also don't want object_ids for objects that have just left the frame (I guess sometimes tracked_objects can be larger than detections because of objects that just left the frame but still have a hit counter).

@Edohvin Edohvin added the help wanted Extra attention is needed label Feb 20, 2023
@facundo-lezama
Copy link
Collaborator

Hi @Edohvin,

norfair.update() returns only the live objects, but if you need to debug the uninitialized objects, you can access the complete list of objects on tracker.tracked_objects. Please consider that this list does not follow the detections list order but instead is ordered by ID. If you need to check which detection matched each tracked object, you may use tracked_object.last_detection.

Regarding your last comment on the length of the lists, please note that objects don't disappear instantly; instead, their life is controlled by the hit_counter_max, so you may still see some objects for a while that have left the frame.

@Edohvin
Copy link
Author

Edohvin commented Feb 28, 2023

@facundo-lezama

I used tracked_object.last_detection.points to get the xy coordinates of each tracked object. Then I compared these xy coordinates to the xy coordinates of all the bounding boxes. This allowed me to link what bounding boxes corresponded to which trackids. Not sure if this is the most calculation efficient, but it got the job done! Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants