Releases: roboflow/supervision
supervision-0.14.0
π Added
- Support for SAHI inference technique with
sv.InferenceSlicer
. (#282)
>>> import cv2
>>> import supervision as sv
>>> import numpy as np
>>> from ultralytics import YOLO
>>> image = cv2.imread(SOURCE_IMAGE_PATH)
>>> model = YOLO(...)
>>> def callback(image_slice: np.ndarray) -> sv.Detections:
... result = model(image_slice)[0]
... return sv.Detections.from_ultralytics(result)
>>> slicer = sv.InferenceSlicer(callback = callback)
>>> detections = slicer(image)
inference-slicer.mov
-
Detections.from_deepsparse
to enable seamless integration with DeepSparse framework. (#297) -
sv.Classifications.from_ultralytics
to enable seamless integration with Ultralytics framework. This will enable you to use supervision with all models that Ultralytics supports. (#281)Warning
sv.Detections.from_yolov8
andsv.Classifications.from_yolov8
are now deprecated and will be removed withsupervision-0.16.0
release. -
First supervision usage example script showing how to detect and track objects on video using YOLOv8 + Supervision. (#341)
detect-and-track-objects-on-video.mov
π± Changed
sv.ClassificationDataset
andsv.DetectionDataset
now use image path (not image name) as dataset keys. (#296)
π οΈ Fixed
Detections.from_roboflow
to filter out polygons with less than 3 points. (#300)
π Contributors
@hardikdava (Hardik Dava), @onuralpszr (Onuralp SEZER), @mayankagarwals (Mayank Agarwal), @rizavelioglu (Riza Velioglu), @arjun-234 (Arjun D.), @mwitiderrick (Derrick Mwiti), @ShubhamKanitkar32, @gasparitiago (Tiago De Gaspari), @capjamesg (James Gallagher), @SkalskiP (Piotr Skalski)
supervision-0.13.0
π Added
- Support for mean average precision (mAP) for object detection models with
sv.MeanAveragePrecision
. (#236)
>>> import supervision as sv
>>> from ultralytics import YOLO
>>> dataset = sv.DetectionDataset.from_yolo(...)
>>> model = YOLO(...)
>>> def callback(image: np.ndarray) -> sv.Detections:
... result = model(image)[0]
... return sv.Detections.from_yolov8(result)
>>> mean_average_precision = sv.MeanAveragePrecision.benchmark(
... dataset = dataset,
... callback = callback
... )
>>> mean_average_precision.map50_95
0.433
- Support for
ByteTrack
for object tracking withsv.ByteTrack
. (#256)
>>> import supervision as sv
>>> from ultralytics import YOLO
>>> model = YOLO(...)
>>> byte_tracker = sv.ByteTrack()
>>> annotator = sv.BoxAnnotator()
>>> def callback(frame: np.ndarray, index: int) -> np.ndarray:
... results = model(frame)[0]
... detections = sv.Detections.from_yolov8(results)
... detections = byte_tracker.update_from_detections(detections=detections)
... labels = [
... f"#{tracker_id} {model.model.names[class_id]} {confidence:0.2f}"
... for _, _, confidence, class_id, tracker_id
... in detections
... ]
... return annotator.annotate(scene=frame.copy(), detections=detections, labels=labels)
>>> sv.process_video(
... source_path='...',
... target_path='...',
... callback=callback
... )
byte_track_result_small.mp4
-
sv.Detections.from_ultralytics
to enable seamless integration with Ultralytics framework. This will enable you to usesupervision
with all models that Ultralytics supports. (#222)Warning
sv.Detections.from_yolov8
is now deprecated and will be removed withsupervision-0.15.0
release. -
sv.Detections.from_paddledet
to enable seamless integration with PaddleDetection framework. (#191) -
Support for loading PASCAL VOC segmentation datasets with
sv.DetectionDataset.
. (#245)
π Contributors
@hardikdava (Hardik Dava), @kirilllzaitsev (Kirill Zaitsev), @onuralpszr (Onuralp SEZER), @dbroboflow, @mayankagarwals (Mayank Agarwal), @danigarciaoca (Daniel M. GarcΓa-OcaΓ±a), @capjamesg (James Gallagher), @SkalskiP (Piotr Skalski)
supervision-0.12.0
Warning
With thesupervision-0.12.0
release, we are terminating official support for Python 3.7. (#179)
π Added
- Initial support for object detection model benchmarking with
sv.ConfusionMatrix
. (#177)
>>> import supervision as sv
>>> from ultralytics import YOLO
>>> dataset = sv.DetectionDataset.from_yolo(...)
>>> model = YOLO(...)
>>> def callback(image: np.ndarray) -> sv.Detections:
... result = model(image)[0]
... return sv.Detections.from_yolov8(result)
>>> confusion_matrix = sv.ConfusionMatrix.benchmark(
... dataset = dataset,
... callback = callback
... )
>>> confusion_matrix.matrix
array([
[0., 0., 0., 0.],
[0., 1., 0., 1.],
[0., 1., 1., 0.],
[1., 1., 0., 0.]
])
-
Detections.from_mmdetection
to enable seamless integration with MMDetection framework. (#173) -
Ability to install package in
headless
ordesktop
mode. (#130)
π± Changed
- Packing method from
setup.py
topyproject.toml
. (#180)
π οΈ Fixed
sv.DetectionDataset.from_cooc
can't be loaded when there are images without annotations. (#188)sv.DetectionDataset.from_yolo
can't load background instances. (#226)
π Contributors
@kirilllzaitsev @hardikdava @onuralpszr @Ucag @SkalskiP @capjamesg
supervision-0.11.1
π οΈ Fixed
as_folder_structure
fails to savesv.ClassificationDataset
when it is result of inference. (#165)
π Contributors
supervision-0.11.0
π Added
- Ability to load and save
sv.DetectionDataset
in COCO format usingas_coco
andfrom_coco
methods. (#150)
>>> import supervision as sv
>>> ds = sv.DetectionDataset.from_coco(
... images_directory_path='...',
... annotations_path='...'
... )
>>> ds.as_coco(
... images_directory_path='...',
... annotations_path='...'
... )
- Ability to marge multiple
sv.DetectionDataset
together usingmerge
method. (#158)
>>> import supervision as sv
>>> ds_1 = sv.DetectionDataset(...)
>>> len(ds_1)
100
>>> ds_1.classes
['dog', 'person']
>>> ds_2 = sv.DetectionDataset(...)
>>> len(ds_2)
200
>>> ds_2.classes
['cat']
>>> ds_merged = sv.DetectionDataset.merge([ds_1, ds_2])
>>> len(ds_merged)
300
>>> ds_merged.classes
['cat', 'dog', 'person']
- Additional
start
andend
arguments tosv.get_video_frames_generator
allowing to generate frames only for a selected part of the video. (#162)
π οΈ Fixed
- Incorrect loading of YOLO dataset class names from
data.yaml
. (#157)
π Contributors
supervision-0.10.0
π Added
- Ability to load and save
sv.ClassificationDataset
in a folder structure format. (#125)
>>> import supervision as sv
>>> cs = sv.ClassificationDataset.from_folder_structure(
... root_directory_path='...'
... )
>>> cs.as_folder_structure(
... root_directory_path='...'
... )
- Support for
sv.ClassificationDataset.split
allowing to dividesv.ClassificationDataset
into two parts. (#125)
>>> import supervision as sv
>>> cs = sv.ClassificationDataset(...)
>>> train_cs, test_cs = cs.split(split_ratio=0.7, random_state=42, shuffle=True)
>>> len(train_cs), len(test_cs)
(700, 300)
-
Ability to extract masks from Roboflow API results using
sv.Detections.from_roboflow
. (#110) -
Supervision Quickstart notebook where you can learn more about Detection, Dataset and Video APIs.
π± Changed
sv.get_video_frames_generator
documentation to better describe actual behavior. (#135)
π Contributors
supervision-0.9.0
π 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
- 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 insv.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. Nowsv.PolygonZone
accepts coordinates in the form of[[x1, y1], [x2, y2], ...]
that can be both integers and floats. (#106)
π Contributors
supervision-0.8.0
π Added
- Support for dataset inheritance. The current
Dataset
got renamed toDetectionDataset
. NowDetectionDataset
inherits fromBaseDataset
. This change was made to enforce the future consistency of APIs of different types of computer vision datasets. (#100) - Ability to save datasets in YOLO format using
DetectionDataset.as_yolo
. (#100)
>>> import supervision as sv
>>> ds = sv.DetectionDataset(...)
>>> ds.as_yolo(
... images_directory_path='...',
... annotations_directory_path='...',
... data_yaml_path='...'
... )
- Support for
DetectionDataset.split
allowing to divideDetectionDataset
into two parts. (#102)
>>> import supervision as sv
>>> ds = sv.DetectionDataset(...)
>>> train_ds, test_ds = ds.split(split_ratio=0.7, random_state=42, shuffle=True)
>>> len(train_ds), len(test_ds)
(700, 300)
π± Changed
- Default value of
approximation_percentage
parameter from0.75
to0.0
inDetectionDataset.as_yolo
andDetectionDataset.as_pascal_voc
. (#100)
π Contributors
supervision-0.7.0
π Added
Detections.from_yolo_nas
to enable seamless integration with YOLO-NAS model. (#91)- Ability to load datasets in YOLO format using
Dataset.from_yolo
. (#86) Detections.merge
to merge multipleDetections
objects together. (#84)
π± Changed
LineZoneAnnotator.annotate
to allow for the custom text for the in and out tags. (#44)
π οΈ Fixed
LineZoneAnnotator.annotate
does not return annotated frame. (#81)
π Contributors
supervision-0.6.0
π Added
- Initial
Dataset
support and ability to saveDetections
in Pascal VOC XML format. (#71) - New
mask_to_polygons
,filter_polygons_by_area
,polygon_to_xyxy
andapproximate_polygon
utilities. (#71) - Ability to load Pascal VOC XML object detections dataset as
Dataset
. (#72)
π± Changed
- order of
Detections
attributes to make it consistent with order of objects in__iter__
tuple. (#70) generate_2d_mask
topolygon_to_mask
. (#71)