github roboflow/supervision 0.9.0
supervision-0.9.0

latest releases: 0.25.0, 0.25.0rc2, 0.25.0rc1...
17 months ago

🚀 Added

  • Ability to select sv.Detections by index, list of indexes or slice. Here is an example illustrating the new selection methods. (#118)
>>> import supervision as sv

>>> detections = sv.Detections(...)
>>> len(detections[0])
1
>>> len(detections[[0, 1]])
2
>>> len(detections[0:2])
2

supervision-0_9_0-Snap (4)

  • Ability to extract masks from YOLOv8 results using sv.Detections.from_yolov8. Here is an example illustrating how to extract boolean masks from the result of the YOLOv8 model inference. (#101)
>>> import cv2
>>> from ultralytics import YOLO
>>> import supervision as sv

>>> image = cv2.imread(...)
>>> image.shape
(640, 640, 3)

>>> model = YOLO('yolov8s-seg.pt')
>>> result = model(image)[0]
>>> detections = sv.Detections.from_yolov8(result)
>>> detections.mask.shape
(2, 640, 640)
  • Ability to crop the image using sv.crop. Here is an example showing how to get a separate crop for each detection in sv.Detections. (#122)
>>> import cv2
>>> import supervision as sv

>>> image = cv2.imread(...)
>>> detections = sv.Detections(...)
>>> len(detections)
2
>>> crops = [
...     sv.crop(image=image, xyxy=xyxy) 
...     for xyxy 
...     in detections.xyxy
... ]
>>> len(crops)
2
  • Ability to conveniently save multiple images into directory using sv.ImageSink. An example shows how to save every tenth video frame as a separate image. (#120)
>>> import supervision as sv

>>> with sv.ImageSink(target_dir_path='target/directory/path') as sink:
...     for image in sv.get_video_frames_generator(source_path='source_video.mp4', stride=10):
...         sink.save_image(image=image)

🛠️ Fixed

  • Inconvenient handling of sv.PolygonZone coordinates. Now sv.PolygonZone accepts coordinates in the form of [[x1, y1], [x2, y2], ...] that can be both integers and floats. (#106)

🏆 Contributors

@SkalskiP @lomnes-atlast-food @hardikdava

Don't miss a new supervision release

NewReleases is sending notifications on new releases.