Redesign update with detections to match detections with tracker
Description
This change addresses this issue: (https://github.com/roboflow/supervision/issues/754)
update_with_detections now returns the original detections that were tracked by ByteTrack with their original bboxes, masks, class_ids, data fields and with updated track_ids. Detections that were not tracked this frame are not included in the returned detections.
Type of change
- [x] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality) - Segmentation tracking
How has this change been tested, please provide a testcase or example of how you tested the change?
I have tested this change by running object tracking for both object detection and segmentation in this colab notebook
Any specific deployment considerations
Tracking docs should be updated to reflect that ByteTrack can now do segmentation tracking.
Docs
- [ ] Docs updated? What were the changes:
Sorry about the number of commits. I tried to squash some together but messed up a bit. I can delete and resubmit if you need me to.
Hi, @rolson24 👋🏻 ! Thanks a lot for this PR. I left a few comments (nothing serious). I would also like you to open a new PR with just one commit (if possible). I can use Squash and merge option but I'm not sure if GitHub will assign this commit to you :/ And I would want to give you credit for this work.
Great! I made those changes and can submit a new PR. Before I do though, I am wondering if we should add a method to the STrack class to get the actual bounding box from the detection that was used to update the track. Right now STrack.tlbr returns the predicted value of the bounding box. This means that when we do the matching in the update_with_detections from the original detections to the tracks, the wrong track might be matched to the original bounding box when there are two detections that are really close together. This won't matter for tracking performance, but it technically might return the wrong original detection in that frame. This also will allow us to not use the linear assignment function (in-efficient) and instead just search for the ious that are 1.0 because the original detections will match perfectly with the detections we get from the tracks.
Hi @rolson24 👋🏻 ! Awesome! In this case, I'll close this PR, and we will focus on https://github.com/roboflow/supervision/pull/1035. Thanks for being so cooperative 🙏🏻