- Improved integration with `YOLOv5` and `YOLOv8` models.
python
import torch
import supervision as sv
model = torch.hub.load('ultralytics/yolov5', 'yolov5x6')
results = model(frame, size=1280)
detections = sv.Detections.from_yolov5(results)
python
from ultralytics import YOLO
import supervision as sv
model = YOLO('yolov8s.pt')
results = model(frame, imgsz=1280)[0]
detections = sv.Detections.from_yolov8(results)
🚀 Added
- `supervision.get_polygon_center` function - takes in a polygon as a 2-dimensional `numpy.ndarray` and returns the center of the polygon as a Point object
- `supervision.draw_polygon` function - draw a polygon on a scene
- `supervision.draw_text` function - draw a text on a scene
- `supervision.ColorPalette.default()` - class method - to generate default `ColorPalette`
- `supervision.generate_2d_mask` function - generate a 2D mask from a polygon
- `supervision.PolygonZone` class - to define polygon zones and validate if `supervision.Detections` are in the zone
- `supervision.PolygonZoneAnnotator` class - to draw `supervision.PolygonZone` on scene
🌱 Changed
- `VideoInfo` API - change the property name `resolution` -> `resolution_wh` to make it more descriptive; convert `VideoInfo` to `dataclass`
- `process_frame` API - change argument name `frame` -> `scene` to make it consistent with other classes and methods
- `LineCounter` API - rename class `LineCounter` -> `LineZone` to make it consistent with `PolygonZone`
- `LineCounterAnnotator` API - rename class `LineCounterAnnotator` -> `LineZoneAnnotator`
🏆 Contributors
* SkalskiP
* capjamesg