Open
Description
Search before asking
- I have searched the Supervision issues and found no similar bug report.
Bug
Hi folks. Amazing project, but I'm getting a peculiar behaviour in ByteTracker.
My assumption for the minimum_matching_threshold
parameter of ByteTracker is that it acts similar to an IoU threshold. A smaller threshold should make boxes match more easily, and a larger threshold should make boxes match only if they have a really good match score (ex: really high IoU). However, I observe the inverse behaviour. Not sure if this is expected, but thought I'll highlight it here
Environment
- Supervision: 0.25.0
- Ubuntu: 22.04
- Python: 3.10
Minimal Reproducible Example
Code block to reproduce:
import supervision as sv
import numpy as np
detections = [sv.Detections(xyxy=np.array([[10, 10, 20, 20]]),class_id=np.array([1]),confidence=np.array([1]))]*2
detections+= [sv.Detections(xyxy=np.array([[11, 11, 21, 21]]), class_id=np.array([1]), confidence=np.array([1]))]*2 # 90% overlap
byte_tracker_low_threshold = sv.ByteTrack(minimum_matching_threshold=0.1)
tracked_detections = [byte_tracker_low_threshold.update_with_detections(d) for d in detections]
print("Track IDs associated with detections in 10\% overlap: ", list(t_det.tracker_id for t_det in tracked_detections))
print("Internally tracked states in 10\% overlap: ", byte_tracker_low_threshold.tracked_tracks)
print()
print()
byte_tracker_high_threshold = sv.ByteTrack(minimum_matching_threshold=0.9)
tracked_detections = [byte_tracker_high_threshold.update_with_detections(d) for d in detections]
print("Track IDs associated with detections in 90\% overlap: ", list(t_det.tracker_id for t_det in tracked_detections))
print("Internally tracked states in 90\% overlap: ", byte_tracker_high_threshold.tracked_tracks)
Gives the output:
Track IDs associated with detections in 10\% overlap: [array([1]), array([1]), array([], dtype=int64), array([2])]
Internally tracked states in 10\% overlap: [OT_1_(3-4)]
Track IDs associated with detections in 90\% overlap: [array([1]), array([1]), array([1]), array([1])]
Internally tracked states in 90\% overlap: [OT_0_(1-4)]
I would expect the opposite to be true, i.e. when we set a low minimum_matching_threshold
, it should assign the same track ID to detections more easily (with less IoU overlap). However, that doesn't seem to be the case.
Additional
No response
Are you willing to submit a PR?
- Yes I'd like to help by submitting a PR!