update docs

This commit is contained in:
SkalskiP
2024-01-31 08:28:34 +01:00
parent 7f9153e826
commit c6718d374c
2 changed files with 30 additions and 3 deletions
+2 -2
View File
@@ -34,7 +34,7 @@ We write your reusable computer vision tools. Whether you need to load your data
Annotate predictions from a range of object detection and segmentation models
[:octicons-arrow-right-24: Tutorial](how_to/detect_and_annotate)
[:octicons-arrow-right-24: Tutorial](how_to/detect_and_annotate.md)
- __Track Objects__
@@ -42,7 +42,7 @@ We write your reusable computer vision tools. Whether you need to load your data
Discover how to enhance video analysis by implementing seamless object tracking
[:octicons-arrow-right-24: Tutorial](how_to/track_objects)
[:octicons-arrow-right-24: Tutorial](how_to/track_objects.md)
- > __Count Objects Crossing Line__
+28 -1
View File
@@ -25,7 +25,34 @@ from supervision.utils.internal import deprecated
@dataclass
class Detections:
"""
A dataclass representing detection results.
The `sv.Detections` allows you to convert results from a variety of object detection
and segmentation models into a single, unified format. The `sv.Detections` class
enables easy data manipulation and filtering, and provides a consistent API for
Supervision's tools like trackers, annotators, and zones.
```python
import cv2
import supervision as sv
from ultralytics import YOLO
image = cv2.imread(<SOURCE_IMAGE_PATH>)
model = YOLO('yolov8s.pt')
annotator = sv.BoundingBoxAnnotator()
result = model(image)[0]
detections = sv.Detections.from_ultralytics(result)
annotated_image = annotator.annotate(image, detections)
```
!!! tip
In `sv.Detections`, detection data is categorized into two main field types:
fixed and custom. The fixed fields include `xyxy`, `mask`, `confidence`,
`class_id`, and `tracker_id`. For any additional data requirements, custom
fields come into play, stored in the data field. These custom fields are easily
accessible using the `detections[<FIELD_NAME>]` syntax, providing flexibility
for diverse data handling needs.
Attributes:
xyxy (np.ndarray): An array of shape `(n, 4)` containing