tryolabs / norfair

Lightweight Python library for adding real-time multi-object tracking to any detector.

Home Page:https://tryolabs.github.io/norfair/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Re-id based on custom zones possible ?

TomDarmon opened this issue · comments

Describe the situation you are working on
I have a use case where I want to track objects with YOLO and a tracker, the use case have a lot of occlusions. I need to add a re-identification module, a delay to not count too much items, etc...

I am currently looking at the advanced features of norfair for my usecase.
I think most of the arguments of the Tracker objects cover my need, but I have one blind spot that I don't see how to do.

I want to add some custom rules to re-id / not re-id based on the zones of the image.

Describe what is it that you need help with

My images are static, the camera is not moving.
I have 2 zones in my images, let's call them zone A and zone B.

  • I want objects that disappear in zone A to be able to match in zone B
  • I want objects that disappear in zone B and appear in zone B to never gets matched

I am unsure if this is achievable in norfair, do you have any idea how to do it easily ?

Hello @TomDarmon,

When you're setting up the Tracker, it's necessary to provide your ReID distance function. This function will receive two TrackedObjects: the object you're aiming to match and a potential candidate.

This is the place where you can implement your specific logic. Each TrackedObject contains the attribute last_detection, which holds the most recent detection instance (Detection). If you're using a past_detections_length greater than zero, you'll also have access to past_detections with past_detections_length instances of Detections.

Within these instances, there's an attribute called 'points' that contains the coordinates of each object. Leveraging this data, you can design your function to return 0 if the objects do not meet the criteria defined by your zones.

Ok ok I see thank you !