Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with minimum matching threshold parameter of ByteTracker #1670

Open
2 tasks done
rsnk96 opened this issue Nov 15, 2024 · 0 comments
Open
2 tasks done

Problem with minimum matching threshold parameter of ByteTracker #1670

rsnk96 opened this issue Nov 15, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@rsnk96
Copy link

rsnk96 commented Nov 15, 2024

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!
@rsnk96 rsnk96 added the bug Something isn't working label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant