From 18fe2e99de1f1a3a406a95dd4ed26701e1b522e6 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Sun, 8 Oct 2023 19:52:23 +0300 Subject: [PATCH] chore!: :fire: removal from_yolov8 Signed-off-by: Onuralp SEZER --- supervision/detection/core.py | 41 ----------------------------------- 1 file changed, 41 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index f5498df4..470db52c 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -12,7 +12,6 @@ from supervision.detection.utils import ( xywh_to_xyxy, ) from supervision.geometry.core import Position -from supervision.utils.internal import deprecated def _validate_xyxy(xyxy: Any, n: int) -> None: @@ -185,46 +184,6 @@ class Detections: class_id=yolov5_detections_predictions[:, 5].astype(int), ) - @classmethod - @deprecated( - """ - This method is deprecated and removed in 0.15.0 release. - Use sv.Detections.from_ultralytics() instead as it is more generic and - can be used for detections from any ultralytics.engine.results.Results Object - """ - ) - def from_yolov8(cls, yolov8_results) -> Detections: - """ - Creates a Detections instance from a - [YOLOv8](https://github.com/ultralytics/ultralytics) inference result. - - Args: - yolov8_results (ultralytics.yolo.engine.results.Results): - The output Results instance from YOLOv8 - - Returns: - Detections: A new Detections object. - - Example: - ```python - >>> import cv2 - >>> from ultralytics import YOLO - >>> import supervision as sv - - >>> image = cv2.imread(SOURCE_IMAGE_PATH) - >>> model = YOLO('yolov8s.pt') - >>> result = model(image)[0] - >>> detections = sv.Detections.from_yolov8(result) - ``` - """ - - return cls( - xyxy=yolov8_results.boxes.xyxy.cpu().numpy(), - confidence=yolov8_results.boxes.conf.cpu().numpy(), - class_id=yolov8_results.boxes.cls.cpu().numpy().astype(int), - mask=extract_ultralytics_masks(yolov8_results), - ) - @classmethod def from_ultralytics(cls, ultralytics_results) -> Detections: """