tryolabs / norfair

Lightweight Python library for adding real-time multi-object tracking to any detector.
https://tryolabs.github.io/norfair/
BSD 3-Clause "New" or "Revised" License
2.41k stars 247 forks source link

The class of object being tracked changes over time #315

Closed armine105 closed 7 months ago

armine105 commented 7 months ago

Hello How are you? Thanks for contributing to this project. I am using norfair tracking library to do multiple pool-ball tracking. I am using yolo-nas as object detector. A problem is that the class of the object being tracked changes due to misdetection of object class by the object detector over time. How can I fix this issue?

facundo-lezama commented 7 months ago

Hi @armine105!

Can you send us some code where we can see how you are using Norfair? For example, how do you initialize the Tracker and the Object Detector?

Also, there's definitely something going on with the Object Detector that's predicting mixed classes, but maybe there's something you can do from the tracking perspective to mitigate this problem.

For instance, Norfair can be resilient to spurious changes in detection classes, but there's a limit to how far Norfair can go.

aguscas commented 7 months ago

On top of what @facundo-lezama said, I will add that if the class returned by the detector is wrong frequently, you might consider not providing the label argument to the Detection instances. That way norfair will not take the class of the detection into account when tracking.

If you do that but you still need to know the class of each of your TrackedObject instances, you can provide the class in the data attribute of the Detection instance, and consider the class of the TrackedObject as either the class of its last detection (you can find that inTrackedObject.last_detection.data) or implement some voting system which considers that last detection and other possible past detections (a list containing some past detections of a TrackedObject instance can be found in TrackedObject.past_detections).

armine105 commented 7 months ago

Thank you @facundo-lezama and @aguscas