From 955a6d67fbc4ab2aac9d900698bbb636250e5afe Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Wed, 24 Jan 2024 13:13:56 +0300 Subject: [PATCH] =?UTF-8?q?docs:=20=F0=9F=93=9D=20supervision/tracker/byte?= =?UTF-8?q?=5Ftracker/core.py=20>>>/...=20removed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Onuralp SEZER --- supervision/tracker/byte_tracker/core.py | 41 ++++++++++++------------ 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/supervision/tracker/byte_tracker/core.py b/supervision/tracker/byte_tracker/core.py index 34a90138..bf831daa 100644 --- a/supervision/tracker/byte_tracker/core.py +++ b/supervision/tracker/byte_tracker/core.py @@ -205,30 +205,29 @@ class ByteTrack: Detection: The updated detection results that now include tracking IDs. Example: ```python - >>> import supervision as sv - >>> from ultralytics import YOLO + import supervision as sv + from ultralytics import YOLO - >>> model = YOLO(...) - >>> byte_tracker = sv.ByteTrack() - >>> annotator = sv.BoxAnnotator() + model = YOLO(...) + byte_tracker = sv.ByteTrack() + annotator = sv.BoxAnnotator() - >>> def callback(frame: np.ndarray, index: int) -> np.ndarray: - ... results = model(frame)[0] - ... detections = sv.Detections.from_ultralytics(results) - ... detections = byte_tracker.update_with_detections(detections) - ... labels = [ - ... f"#{tracker_id} {model.model.names[class_id]} {confidence:0.2f}" - ... for _, _, confidence, class_id, tracker_id - ... in detections - ... ] - ... return annotator.annotate(scene=frame.copy(), - ... detections=detections, labels=labels) + def callback(frame: np.ndarray, index: int) -> np.ndarray: + results = model(frame)[0] + detections = sv.Detections.from_ultralytics(results) + detections = byte_tracker.update_with_detections(detections) + labels = [ + f"#{tracker_id} {model.model.names[class_id]} {confidence:0.2f}" + for _, _, confidence, class_id, tracker_id in detections + ] + return annotator.annotate(scene=frame.copy(), + detections=detections, labels=labels) - >>> sv.process_video( - ... source_path='...', - ... target_path='...', - ... callback=callback - ... ) + sv.process_video( + source_path='...', + target_path='...', + callback=callback + ) ``` """