From 2166bc23bcdeb7b974832ea09faf47aa7e19cf15 Mon Sep 17 00:00:00 2001 From: Hardik Dava Date: Mon, 7 Aug 2023 21:19:29 +0200 Subject: [PATCH 1/2] ultralytics tracker support added --- supervision/detection/core.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 825d00c7..392905cd 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -236,6 +236,9 @@ class Detections: confidence=ultralytics_results.boxes.conf.cpu().numpy(), class_id=ultralytics_results.boxes.cls.cpu().numpy().astype(int), mask=extract_ultralytics_masks(ultralytics_results), + tracker_id=ultralytics_results.boxes.id.int().cpu().numpy() + if ultralytics_results.boxes.id is not None + else None, ) @classmethod From 63669e587adcab4b82a414e65393fbbbe6f39695 Mon Sep 17 00:00:00 2001 From: Hardik Dava Date: Mon, 7 Aug 2023 21:23:28 +0200 Subject: [PATCH 2/2] docstrings updated --- supervision/detection/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 392905cd..ed42f987 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -226,8 +226,10 @@ class Detections: >>> model = SAM('mobile_sam.pt') >>> model = FastSAM('FastSAM-s.pt') >>> model = RTDETR('rtdetr-l.pt') - + >>> # model inferences >>> result = model(image)[0] + >>> # if tracker is enabled + >>> result = model.track(image)[0] >>> detections = sv.Detections.from_ultralytics(result) ``` """