The package version has been updated from 0.17.0rc8 to 0.17.0. Alongside the version, the changelog has also been updated to reflect the newly introduced or modified features, improvements in existing features, and bug fixes.
30 KiB
0.17.0 December 06, 2023
-
Added #633:
sv.PixelateAnnotatorallowing to pixelate objects on images and videos. -
Added #652:
sv.TriangleAnnotatorallowing to annotate images and videos with triangle markers. -
Added #602:
sv.PolygonAnnotatorallowing to annotate images and videos with segmentation mask outline.
>>> import supervision as sv
>>> image = ...
>>> detections = sv.Detections(...)
>>> polygon_annotator = sv.PolygonAnnotator()
>>> annotated_frame = polygon_annotator.annotate(
... scene=image.copy(),
... detections=detections
... )
>>> from supervision.assets import download_assets, VideoAssets
>>> download_assets(VideoAssets.VEHICLES)
"vehicles.mp4"
-
Added #605:
Position.CENTER_OF_MASSallowing to place labels in center of mass of segmentation masks. -
Added #651:
sv.scale_boxesallowing to scalesv.Detections.xyxyvalues. -
Added #637:
sv.calculate_dynamic_text_scaleandsv.calculate_dynamic_line_thicknessallowing text scale and line thickness to match image resolution. -
Added #620:
sv.Color.as_hexallowing to extract color value in HEX format. -
Added #572:
sv.Classifications.from_timmallowing to load classification result from timm models. -
Added #478:
sv.Classifications.from_clipallowing to load classification result from clip model. -
Added #571:
sv.Detections.from_azure_analyze_imageallowing to load detection results from Azure Image Analysis. -
Changed #646:
sv.BoxMaskAnnotatorrenaming it tosv.ColorAnnotator. -
Changed #606:
sv.MaskAnnotatorto make it 5x faster. -
Fixed #584:
sv.DetectionDataset.from_yoloto ignore empty lines in annotation files. -
Fixed #555:
sv.BlurAnnotatorto trim negative coordinates before bluring detections. -
Fixed #511:
sv.TraceAnnotatorto respect trace position.
0.16.0 October 19, 2023
-
Added #422:
sv.BoxMaskAnnotatorallowing to annotate images and videos with mox masks. -
Added #433:
sv.HaloAnnotatorallowing to annotate images and videos with halo effect.
>>> import supervision as sv
>>> image = ...
>>> detections = sv.Detections(...)
>>> halo_annotator = sv.HaloAnnotator()
>>> annotated_frame = halo_annotator.annotate(
... scene=image.copy(),
... detections=detections
... )
-
Added #466:
sv.HeatMapAnnotatorallowing to annotate videos with heat maps. -
Added #492:
sv.DotAnnotatorallowing to annotate images and videos with dots. -
Added #449:
sv.draw_imageallowing to draw an image onto a given scene with specified opacity and dimensions. -
Added #280:
sv.FPSMonitorfor monitoring frames per second (FPS) to benchmark latency. -
Changed #482:
sv.LineZone.tiggernow returnTuple[np.ndarray, np.ndarray]. The first array indicates which detections have crossed the line from outside to inside. The second array indicates which detections have crossed the line from inside to outside. -
Changed #465: Annotator argument name from
color_map: strtocolor_lookup: ColorLookupenum to increase type safety. -
Changed #426:
sv.MaskAnnotatorallowing 2x faster annotation. -
Fixed #477: Poetry env definition allowing proper local installation.
-
Fixed #430:
sv.ByteTrackto returnnp.array([], dtype=int)whensvDetectionsis empty.
!!! warning
`sv.Detections.from_yolov8` and `sv.Classifications.from_yolov8` as those are now replaced by [`sv.Detections.from_ultralytics`](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_ultralytics) and [`sv.Classifications.from_ultralytics`](https://supervision.roboflow.com/classification/core/#supervision.classification.core.Classifications.from_ultralytics).
0.15.0 October 5, 2023
-
Added #170:
sv.BoundingBoxAnnotatorallowing to annotate images and videos with bounding boxes. -
Added #170:
sv.BoxCornerAnnotatorallowing to annotate images and videos with just bounding box corners. -
Added #170:
sv.MaskAnnotatorallowing to annotate images and videos with segmentation masks. -
Added #170:
sv.EllipseAnnotatorallowing to annotate images and videos with ellipses (sports game style). -
Added #386:
sv.CircleAnnotatorallowing to annotate images and videos with circles. -
Added #354:
sv.TraceAnnotatorallowing to draw path of moving objects on videos. -
Added #405:
sv.BlurAnnotatorallowing to blur objects on images and videos.
>>> import supervision as sv
>>> image = ...
>>> detections = sv.Detections(...)
>>> bounding_box_annotator = sv.BoundingBoxAnnotator()
>>> annotated_frame = bounding_box_annotator.annotate(
... scene=image.copy(),
... detections=detections
... )
-
Added #354: Supervision usage example. You can now learn how to perform traffic flow analysis with Supervision.
-
Changed #399:
sv.Detections.from_roboflownow does not requireclass_listto be specified. Theclass_idvalue can be extracted directly from the inference response. -
Changed #381:
sv.VideoSinknow allows to customize the output codec. -
Changed #361:
sv.InferenceSlicercan now operate in multithreading mode. -
Fixed #348:
sv.Detections.from_deepsparseto allow processing empty deepsparse result object.
0.14.0 August 31, 2023
- Added #282: support for SAHI inference technique with
sv.InferenceSlicer.
>>> import cv2
>>> import supervision as sv
>>> 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)
-
Added #297:
Detections.from_deepsparseto enable seamless integration with DeepSparse framework. -
Added #281:
sv.Classifications.from_ultralyticsto enable seamless integration with Ultralytics framework. This will enable you to use supervision with all models that Ultralytics supports.
!!! warning
[sv.Detections.from_yolov8](https://roboflow.github.io/supervision/detection/core/#supervision.detection.core.Detections.from_yolov8) and [sv.Classifications.from_yolov8](https://supervision.roboflow.com/classification/core/#supervision.classification.core.Classifications.from_yolov8) are now deprecated and will be removed with supervision-0.16.0 release.
-
Added #341: First supervision usage example script showing how to detect and track objects on video using YOLOv8 + Supervision.
-
Changed #296:
sv.ClassificationDatasetandsv.DetectionDatasetnow use image path (not image name) as dataset keys. -
Fixed #300:
Detections.from_roboflowto filter out polygons with less than 3 points.
0.13.0 August 8, 2023
- Added #236: support for mean average precision (mAP) for object detection models with
sv.MeanAveragePrecision.
>>> 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
-
Added #256: support for ByteTrack for object tracking with
sv.ByteTrack. -
Added #222:
sv.Detections.from_ultralyticsto enable seamless integration with Ultralytics framework. This will enable you to usesupervisionwith all models that Ultralytics supports.
!!! warning
[`sv.Detections.from_yolov8`](https://roboflow.github.io/supervision/detection/core/#supervision.detection.core.Detections.from_yolov8) is now deprecated and will be removed with `supervision-0.15.0` release.
-
Added #191:
sv.Detections.from_paddledetto enable seamless integration with PaddleDetection framework. -
Added #245: support for loading PASCAL VOC segmentation datasets with
sv.DetectionDataset..
0.12.0 July 24, 2023
!!! warning
With the `supervision-0.12.0` release, we are terminating official support for Python 3.7.
- Added #177: initial support for object detection model benchmarking with
sv.ConfusionMatrix.
>>> 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.]
])
-
Added #173:
Detections.from_mmdetectionto enable seamless integration with MMDetection framework. -
Added #130: ability to install package in
headlessordesktopmode. -
Changed #180: packing method from
setup.pytopyproject.toml. -
Fixed #188:
sv.DetectionDataset.from_cooccan't be loaded when there are images without annotations. -
Fixed #226:
sv.DetectionDataset.from_yolocan't load background instances.
0.11.1 June 29, 2023
- Fix #165:
as_folder_structurefails to savesv.ClassificationDatasetwhen it is result of inference.
0.11.0 June 28, 2023
- Added #150: ability to load and save
sv.DetectionDatasetin COCO format usingas_cocoandfrom_cocomethods.
>>> import supervision as sv
>>> ds = sv.DetectionDataset.from_coco(
... images_directory_path='...',
... annotations_path='...'
... )
>>> ds.as_coco(
... images_directory_path='...',
... annotations_path='...'
... )
- Added #158: ability to marge multiple
sv.DetectionDatasettogether usingmergemethod.
>>> 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']
-
Added #162: additional
startandendarguments tosv.get_video_frames_generatorallowing to generate frames only for a selected part of the video. -
Fix #157: incorrect loading of YOLO dataset class names from
data.yaml.
0.10.0 June 14, 2023
- Added #125: ability to load and save
sv.ClassificationDatasetin a folder structure format.
>>> import supervision as sv
>>> cs = sv.ClassificationDataset.from_folder_structure(
... root_directory_path='...'
... )
>>> cs.as_folder_structure(
... root_directory_path='...'
... )
-
Added #125: support for
sv.ClassificationDataset.splitallowing to dividesv.ClassificationDatasetinto two parts. -
Added #110: ability to extract masks from Roboflow API results using
sv.Detections.from_roboflow. -
Added commit hash: Supervision Quickstart notebook where you can learn more about Detection, Dataset and Video APIs.
-
Changed #135:
sv.get_video_frames_generatordocumentation to better describe actual behavior.
0.9.0 June 7, 2023
- Added #118: ability to select
sv.Detectionsby index, list of indexes or slice. Here is an example illustrating the new selection methods.
>>> import supervision as sv
>>> detections = sv.Detections(...)
>>> len(detections[0])
1
>>> len(detections[[0, 1]])
2
>>> len(detections[0:2])
2
-
Added #101: ability to extract masks from YOLOv8 result using
sv.Detections.from_yolov8. Here is an example illustrating how to extract boolean masks from the result of the YOLOv8 model inference. -
Added #122: ability to crop image using
sv.crop. Here is an example showing how to get a separate crop for each detection insv.Detections. -
Added #120: ability to conveniently save multiple images into directory using
sv.ImageSink. Here is an example showing how to save every tenth video frame as a separate image.
>>> 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 #106: inconvenient handling of
sv.PolygonZonecoordinates. Nowsv.PolygonZoneaccepts coordinates in the form of[[x1, y1], [x2, y2], ...]that can be both integers and floats.
0.8.0 May 17, 2023
- Added #100: support for dataset inheritance. The current
Datasetgot renamed toDetectionDataset. NowDetectionDatasetinherits fromBaseDataset. This change was made to enforce the future consistency of APIs of different types of computer vision datasets. - Added #100: ability to save datasets in YOLO format using
DetectionDataset.as_yolo.
>>> import roboflow
>>> from roboflow import Roboflow
>>> import supervision as sv
>>> roboflow.login()
>>> rf = Roboflow()
>>> project = rf.workspace(WORKSPACE_ID).project(PROJECT_ID)
>>> dataset = project.version(PROJECT_VERSION).download("yolov5")
>>> ds = sv.DetectionDataset.from_yolo(
... images_directory_path=f"{dataset.location}/train/images",
... annotations_directory_path=f"{dataset.location}/train/labels",
... data_yaml_path=f"{dataset.location}/data.yaml"
... )
>>> ds.classes
['dog', 'person']
- Added #102: support for
DetectionDataset.splitallowing to divideDetectionDatasetinto two parts.
>>> 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 #100: default value of
approximation_percentageparameter from0.75to0.0inDetectionDataset.as_yoloandDetectionDataset.as_pascal_voc.
0.7.0 May 11, 2023
- Added #91:
Detections.from_yolo_nasto enable seamless integration with YOLO-NAS model. - Added #86: ability to load datasets in YOLO format using
Dataset.from_yolo. - Added #84:
Detections.mergeto merge multipleDetectionsobjects together. - Fixed #81:
LineZoneAnnotator.annotatedoes not return annotated frame. - Changed #44:
LineZoneAnnotator.annotateto allow for custom text for the in and out tags.
0.6.0 April 19, 2023
- Added #71: initial
Datasetsupport and ability to saveDetectionsin Pascal VOC XML format. - Added #71: new
mask_to_polygons,filter_polygons_by_area,polygon_to_xyxyandapproximate_polygonutilities. - Added #72: ability to load Pascal VOC XML object detections dataset as
Dataset. - Changed #70: order of
Detectionsattributes to make it consistent with order of objects in__iter__tuple. - Changed #71:
generate_2d_masktopolygon_to_mask.
0.5.2 April 13, 2023
- Fixed #63:
LineZone.triggerfunction expects 4 values instead of 5.
0.5.1 April 12, 2023
- Fixed
Detections.__getitem__method did not return mask for selected item. - Fixed
Detections.areacrashed for mask detections.
0.5.0 April 10, 2023
- Added #58:
Detections.maskto enable segmentation support. - Added #58:
MaskAnnotatorto allow easyDetections.maskannotation. - Added #58:
Detections.from_samto enable native Segment Anything Model (SAM) support. - Changed #58:
Detections.areabehaviour to work not only with boxes but also with masks.
0.4.0 April 5, 2023
- Added #46:
Detections.emptyto allow easy creation of emptyDetectionsobjects. - Added #56:
Detections.from_roboflowto allow easy creation ofDetectionsobjects from Roboflow API inference results. - Added #56:
plot_images_gridto allow easy plotting of multiple images on single plot. - Added #56: initial support for Pascal VOC XML format with
detections_to_voc_xmlmethod. - Changed #56:
show_frame_in_notebookrefactored and renamed toplot_image.
0.3.2 March 23, 2023
- Changed #50: Allow
Detections.class_idto beNone.
0.3.1 March 6, 2023
- Fixed #41:
PolygonZonethrows an exception when the object touches the bottom edge of the image. - Fixed #42:
Detections.wth_nmsmethod throws an exception whenDetectionsis empty. - Changed #36:
Detections.wth_nmssupport class agnostic and non-class agnostic case.
0.3.0 March 6, 2023
- Changed: Allow
Detections.confidenceto beNone. - Added:
Detections.from_transformersandDetections.from_detectron2to enable seamless integration with Transformers and Detectron2 models. - Added:
Detections.areato dynamically calculate bounding box area. - Added:
Detections.wth_nmsto filter out double detections with NMS. Initial - only class agnostic - implementation.
0.2.0 February 2, 2023
- Added: Advanced
Detectionsfiltering with pandas-like API. - Added:
Detections.from_yolov5andDetections.from_yolov8to enable seamless integration with YOLOv5 and YOLOv8 models.
0.1.0 January 19, 2023
Say hello to Supervision 👋