Skip to content

Commit 333408d

Browse files
authored
Merge pull request roboflow#438 from roboflow/remove_old_yolov8
chore!: 🔥 removal from_yolov8 function from classification and detection
2 parents d30d807 + 41a19ac commit 333408d

File tree

2 files changed

+0
-78
lines changed

2 files changed

+0
-78
lines changed

supervision/classification/core.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
import numpy as np
77

8-
from supervision.utils.internal import deprecated
9-
108

119
def _validate_class_ids(class_id: Any, n: int) -> None:
1210
"""
@@ -41,41 +39,6 @@ def __post_init__(self) -> None:
4139
_validate_class_ids(self.class_id, n)
4240
_validate_confidence(self.confidence, n)
4341

44-
@classmethod
45-
@deprecated(
46-
"""
47-
This method is deprecated and removed in 0.16.0 release.
48-
Use sv.Classifications.from_ultralytics() instead as it is more generic and
49-
can be used for detections from any ultralytics.engine.results.Results Object
50-
"""
51-
)
52-
def from_yolov8(cls, yolov8_results) -> Classifications:
53-
"""
54-
Creates a Classifications instance from a
55-
[YOLOv8](https://github.com/ultralytics/ultralytics) inference result.
56-
57-
Args:
58-
yolov8_results (ultralytics.yolo.engine.results.Results):
59-
The output Results instance from YOLOv8
60-
61-
Returns:
62-
Classifications: A new Classifications object.
63-
64-
Example:
65-
```python
66-
>>> import cv2
67-
>>> from ultralytics import YOLO
68-
>>> import supervision as sv
69-
70-
>>> image = cv2.imread(SOURCE_IMAGE_PATH)
71-
>>> model = YOLO('yolov8s-cls.pt')
72-
>>> result = model(image)[0]
73-
>>> classifications = sv.Classifications.from_yolov8(result)
74-
```
75-
"""
76-
confidence = yolov8_results.probs.data.cpu().numpy()
77-
return cls(class_id=np.arange(confidence.shape[0]), confidence=confidence)
78-
7942
@classmethod
8043
def from_ultralytics(cls, ultralytics_results) -> Classifications:
8144
"""

supervision/detection/core.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
xywh_to_xyxy,
1313
)
1414
from supervision.geometry.core import Position
15-
from supervision.utils.internal import deprecated
1615

1716

1817
def _validate_xyxy(xyxy: Any, n: int) -> None:
@@ -185,46 +184,6 @@ def from_yolov5(cls, yolov5_results) -> Detections:
185184
class_id=yolov5_detections_predictions[:, 5].astype(int),
186185
)
187186

188-
@classmethod
189-
@deprecated(
190-
"""
191-
This method is deprecated and removed in 0.15.0 release.
192-
Use sv.Detections.from_ultralytics() instead as it is more generic and
193-
can be used for detections from any ultralytics.engine.results.Results Object
194-
"""
195-
)
196-
def from_yolov8(cls, yolov8_results) -> Detections:
197-
"""
198-
Creates a Detections instance from a
199-
[YOLOv8](https://github.com/ultralytics/ultralytics) inference result.
200-
201-
Args:
202-
yolov8_results (ultralytics.yolo.engine.results.Results):
203-
The output Results instance from YOLOv8
204-
205-
Returns:
206-
Detections: A new Detections object.
207-
208-
Example:
209-
```python
210-
>>> import cv2
211-
>>> from ultralytics import YOLO
212-
>>> import supervision as sv
213-
214-
>>> image = cv2.imread(SOURCE_IMAGE_PATH)
215-
>>> model = YOLO('yolov8s.pt')
216-
>>> result = model(image)[0]
217-
>>> detections = sv.Detections.from_yolov8(result)
218-
```
219-
"""
220-
221-
return cls(
222-
xyxy=yolov8_results.boxes.xyxy.cpu().numpy(),
223-
confidence=yolov8_results.boxes.conf.cpu().numpy(),
224-
class_id=yolov8_results.boxes.cls.cpu().numpy().astype(int),
225-
mask=extract_ultralytics_masks(yolov8_results),
226-
)
227-
228187
@classmethod
229188
def from_ultralytics(cls, ultralytics_results) -> Detections:
230189
"""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy