abewley / sort

Simple, online, and realtime tracking of multiple objects in a video sequence.
GNU General Public License v3.0
3.82k stars 1.07k forks source link

[INFO] LINK REQUEST TO RESPONSE #122

Closed Quentinmht closed 3 years ago

Quentinmht commented 3 years ago

Hello,

First of all, I would like to thank you for this project!

I have a problem with the result. I would like to be able to know to which box the result is linked. Is this possible?

Indeed, I have a list of masks linked to my boxes and I would like to be able to find the resulting box linked to my mask.

Thanks !

glenvorel commented 3 years ago

I had a similar requirement and also needed to assign SORT-generated tracking IDs to detections as they came from object detector. In my case, the detector was detecting multiple object classes. Passing all detections to a single SORT instance was not possible - SORT would merge all detections and I wouldn't be able to trace back some attributes like object class, confidence, etc.

That's why I forked this (really great) project and modified it to return the index of the passed detection as an additional, 6th value (first 5 values remaining unchanged).

https://github.com/glenvorel/sort

Given an array of detections:

dets = [
    [20, 10, 40, 30],
    [120, 110, 140, 130],
    [220, 210, 240, 230]
]

The output is (notice the last column which is the index of the matched detection):

 [[119.99935178 109.99945166 140.00144727 130.00154715   16.        1.        ]
  [219.9992519  209.99935178 240.00134739 230.00144727   13.        2.        ]
  [ 19.99915202   9.9992519   40.00124751  30.00134739   11.        0.        ]]

The fork is a few commits behind this repo but it could be brought up to date easily.

@abewley It seems that more users have this need. If I update my fork and make the index matching configurable by a flag (disabled by default), would you accept a pull request?

Quentinmht commented 3 years ago

Thanks a lot for your answer !

glenvorel commented 3 years ago

@Quentinmht I have updated my fork and changed the behavior of the index. You may be interested.

Previously, when a new detection appeared for the first time and was not yet matched with an existing tracker, its index value was -1. My business logic was set to simply ignore detections with a negative index.

Presently, the detection's index is returned always, even when it first appears and is not matched yet. The practical implication is that the business logic can start processing detections 1 frame earlier.

Also, I merged all commits from upstream - so no more numba dependency (and improved performance).

Quentinmht commented 3 years ago

Hello,

Wow, good job!

Yes, I'm very interested. Your idea sounds good, I think you've found the best solution.

I'm trying to imagine a solution that would not only take into account the boxes but also do tracking on the masks (which for me could improve the performance). I don't know if it exists.