Search before asking
Bug
If is_empty is called on a Detections object, False is returned if tracker_id is an empty array instead of None.
Environment
- Supervision: 0.27.0.post2
- Python: 3.10.20
- OS: Ubuntu 24.04
Minimal Reproducible Example
import supervision as sv
import numpy as np
detections_wo_tracker_id = sv.Detections(
xyxy=np.array([[0, 0, 10, 10], [0, 0, 20, 30]]),
class_id=np.array([1, 2]),
confidence=np.array([0.6, 0.7])
)
print(detections_wo_tracker_id[detections_wo_tracker_id.class_id == 0].is_empty())
# True
detections_w_tracker_id = sv.Detections(
xyxy=np.array([[0, 0, 10, 10], [0, 0, 20, 30]]),
class_id=np.array([1, 2]),
confidence=np.array([0.6, 0.7]),
tracker_id=np.array([1, 2])
)
print(detections_w_tracker_id[detections_w_tracker_id.class_id == 0].is_empty())
# False
Are you willing to submit a PR?
Search before asking
Bug
If
is_emptyis called on aDetectionsobject,Falseis returned iftracker_idis an empty array instead ofNone.Environment
Minimal Reproducible Example
Are you willing to submit a PR?