NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #4225 most downloaded on PyPI
A set of easy-to-use utils that will come in handy in any Computer Vision project
Last release today
17 Sep 2026
Ships fairly regularly
a new release about every 3 weeks
Nearly every release is documented
notes for 44 of 48 stable releases
Nothing withdrawn
no release was ever pulled
4 years old
108 releases · first in 2023
One column per quarter.
> sv.ColorPalette.default() is deprecated and will be removed in supervision-0.21.0. Use sv.ColorPalette.DEFAULT instead.
sv.PercentageBarAnnotator allowing to annotate images and videos with percentage values representing confidence or other custom property. (#720)import supervision as sv
image = ...
detections = sv.Detections(...)
percentage_bar_annotator = sv.PercentageBarAnnotator()
annotated_frame = percentage_bar_annotator.annotate(
scene=image.copy(),
detections=detections
)
sv.RoundBoxAnnotator allowing to annotate images and videos with rounded corners bounding boxes. (#702)sv.DetectionsSmoother allowing for smoothing detections over multiple frames in video tracking. (#696)https://github.com/roboflow/supervision/assets/26109316/4dd703ad-ffba-492b-97ff-1be84e237e83
sv.OrientedBoxAnnotator allowing to annotate images and videos with OBB (Oriented Bounding Boxes). (#770)import cv2
import supervision as sv
from ultralytics import YOLO
image = cv2.imread(<SOURCE_IMAGE_PATH>)
model = YOLO("yolov8n-obb.pt")
result = model(image)[0]
detections = sv.Detections.from_ultralytics(result)
oriented_box_annotator = sv.OrientedBoxAnnotator()
annotated_frame = oriented_box_annotator.annotate(
scene=image.copy(),
detections=detections
)
sv.ColorPalette.from_matplotlib allowing users to create a sv.ColorPalette instance from a Matplotlib color palette. (#769)import supervision as sv
sv.ColorPalette.from_matplotlib('viridis', 5)
# ColorPalette(colors=[Color(r=68, g=1, b=84), Color(r=59, g=82, b=139), ...])
sv.Detections.from_ultralytics adding support for OBB (Oriented Bounding Boxes). (#770)sv.LineZone to now accept a list of specific box anchors that must cross the line for a detection to be counted. This update marks a significant improvement from the previous requirement, where all four box corners were necessary. Users can now specify a single anchor, such as sv.Position.BOTTOM_CENTER, or any other combination of anchors defined as List[sv.Position]. (#735)sv.Detections to support custom payload. (#700)sv.Color's and sv.ColorPalette's method of accessing predefined colors, transitioning from a function-based approach (sv.Color.red()) to a more intuitive and conventional property-based method (sv.Color.RED). (#756) (#769)[!WARNING]
sv.ColorPalette.default()is deprecated and will be removed insupervision-0.21.0. Usesv.ColorPalette.DEFAULTinstead.
sv.ColorPalette.DEFAULT value, giving users a more extensive set of annotation colors. (#769)sv.Detections.from_roboflow to sv.Detections.from_inference streamlining its functionality to be compatible with both the both inference pip package and the Roboflow hosted API. (#677)[!WARNING]
Detections.from_roboflow()is deprecated and will be removed insupervision-0.21.0. UseDetections.from_inferenceinstead.
import cv2
import supervision as sv
from inference.models.utils import get_roboflow_model
image = cv2.imread(<SOURCE_IMAGE_PATH>)
model = get_roboflow_model(model_id="yolov8s-640")
result = model.infer(image)[0]
detections = sv.Detections.from_inference(result)
sv.LineZone functionality to accurately update the counter when an object crosses a line from any direction, including from the side. This enhancement enables more precise tracking and analytics, such as calculating individual in/out counts for each lane on the road. (#735)https://github.com/roboflow/supervision/assets/26109316/412c4d9c-b228-4bcc-a4c7-e6a0c8f2da6e
@onuralpszr (Onuralp SEZER), @HinePo (Rafael Levy), @xaristeidou (Christoforos Aristeidou), @revtheundead (Utku Özbek), @paulguerrie (Paul Guerrie), @yeldarby (Brad Dwyer), @capjamesg (James Gallagher), @SkalskiP (Piotr Skalski)
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
@onuralpszr (Onuralp SEZER), @SkalskiP (Piotr Skalski)
@onuralpszr (Onuralp SEZER), @SkalskiP (Piotr Skalski)
Nothing published for this version
`sv.PixelateAnnotator` allowing to pixelate objects on images and videos.
sv.PixelateAnnotator allowing to pixelate objects on images and videos. (#633)https://github.com/roboflow/supervision/assets/26109316/c2d4b3b1-fd19-44bb-94ec-f21b28dfd05f
sv.TriangleAnnotator allowing to annotate images and videos with triangle markers. (#652)
sv.PolygonAnnotator allowing to annotate images and videos with segmentation mask outline. (#602)
>>> import supervision as sv
>>> image = ...
>>> detections = sv.Detections(...)
>>> polygon_annotator = sv.PolygonAnnotator()
>>> annotated_frame = polygon_annotator.annotate(
... scene=image.copy(),
... detections=detections
... )
https://github.com/roboflow/supervision/assets/26109316/c9236bf7-6ba4-4799-bf2a-b5532ad3591b
sv.assets allowing download of video files that you can use in your demos. (#476)
>>> from supervision.assets import download_assets, VideoAssets
>>> download_assets(VideoAssets.VEHICLES)
"vehicles.mp4"
Position.CENTER_OF_MASS allowing to place labels in center of mass of segmentation masks. (#605)
sv.scale_boxes allowing to scale sv.Detections.xyxy values. (#651)
sv.calculate_dynamic_text_scale and sv.calculate_dynamic_line_thickness allowing text scale and line thickness to match image resolution. (#637)
sv.Color.as_hex allowing to extract color value in HEX format. (#620)
sv.Classifications.from_timm allowing to load classification result from timm models. (#572)
sv.Classifications.from_clip allowing to load classification result from clip model. (#478)
sv.Detections.from_azure_analyze_image allowing to load detection results from Azure Image Analysis. (#571)
sv.BoxMaskAnnotator renaming it to sv.ColorAnnotator. (#646)
sv.MaskAnnotator to make it 5x faster. (#606)
sv.DetectionDataset.from_yolo to ignore empty lines in annotation files. (#584)
sv.BlurAnnotator to trim negative coordinates before bluring detections. (#555)
sv.TraceAnnotator to respect trace position. (#511)
@onuralpszr (Onuralp SEZER), @hugoles (Hugo Dutra), @karanjakhar (Karan Jakhar), @kim-jeonghyun (Jeonghyun Kim), @fdloopes ( Felipe Lopes), @abhishek7kalra (Abhishek Kalra), @SummitStudiosDev, @xenteros @capjamesg (James Gallagher), @SkalskiP (Piotr Skalski)
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
https://github.com/roboflow/supervision/assets/26109316/691e219c-0565-4403-9218-ab5644f39bce
https://github.com/roboflow/supervision/assets/26109316/691e219c-0565-4403-9218-ab5644f39bce
sv.BoxMaskAnnotator allowing to annotate images and videos with mox masks. (#422)sv.HaloAnnotator allowing to annotate images and videos with halo effect. (#433)>>> import supervision as sv
>>> image = ...
>>> detections = sv.Detections(...)
>>> halo_annotator = sv.HaloAnnotator()
>>> annotated_frame = halo_annotator.annotate(
... scene=image.copy(),
... detections=detections
... )
sv.HeatMapAnnotator allowing to annotate videos with heat maps. (#466)sv.DotAnnotator allowing to annotate images and videos with dots. (#492)sv.draw_image allowing to draw an image onto a given scene with specified opacity and dimensions. (#449)sv.FPSMonitor for monitoring frames per second (FPS) to benchmark latency. (#280)sv.LineZone.trigger now return Tuple[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. (#482)color_map: str to color_lookup: ColorLookup enum to increase type safety. (#465)sv.MaskAnnotator allowing 2x faster annotation. (#426)sv.ByteTrack to return np.array([], dtype=int) when svDetections is empty. (#430)MaskAnnotator(color_map="index") color_map set to index (#416)Warning Deleted
sv.Detections.from_yolov8andsv.Classifications.from_yolov8as those are now replaced bysv.Detections.from_ultralyticsandsv.Classifications.from_ultralytics. (#438)
@hardikdava (Hardik Dava), @onuralpszr (Onuralp SEZER), @kapter, @keshav278 (Keshav Subramanian), @akashpambhar (Akash Pambhar), @AntonioConsiglio (Antonio Consiglio), @ashishdatta, @mario-dg (Mario da Graca), @ jayaBalaR (JAYABALAMBIKA.R), @abhishek7kalra (Abhishek Kalra), @PankajKrana (Pankaj Kumar Rana), @capjamesg (James Gallagher), @SkalskiP (Piotr Skalski)
Nothing published for this version
Nothing published for this version
https://github.com/roboflow/supervision/assets/26109316/4d6c4a70-b40e-48fc-9e58-23b7e67bf94a
https://github.com/roboflow/supervision/assets/26109316/4d6c4a70-b40e-48fc-9e58-23b7e67bf94a
sv.LabelAnnotator allowing to annotate images and videos with text. (#170)
sv.BoundingBoxAnnotator allowing to annotate images and videos with bounding boxes. (#170)
sv.BoxCornerAnnotator allowing to annotate images and videos with just bounding box corners. (#170)
sv.MaskAnnotator allowing to annotate images and videos with segmentation masks. (#170)
sv.EllipseAnnotator allowing to annotate images and videos with ellipses (sports game style). (#170)
sv.CircleAnnotator allowing to annotate images and videos with circles. (#386)
sv.TraceAnnotator allowing to draw path of moving objects on videos. (#354)
sv.BlurAnnotator allowing to blur objects on images and videos. (#405)
>>> import supervision as sv
>>> image = ...
>>> detections = sv.Detections(...)
>>> bounding_box_annotator = sv.BoundingBoxAnnotator()
>>> annotated_frame = bounding_box_annotator.annotate(
... scene=image.copy(),
... detections=detections
... )
https://github.com/roboflow/supervision/assets/26109316/c9436828-9fbf-4c25-ae8c-60e9c81b3900
sv.Detections.from_roboflow now does not require class_list to be specified. The class_id value can be extracted directly from the inference response. (#399)
sv.VideoSink now allows to customize the output codec. (#381)
sv.InferenceSlicer can now operate in multithreading mode. (#361)
sv.Detections.from_deepsparse to allow processing empty deepsparse result object. (#348)@hardikdava (Hardik Dava), @onuralpszr (Onuralp SEZER), @Killua7362 (Akshay Bhat), @fcakyon (Fatih C. Akyon), @akashAD98 (Akash A Desai), @Rajarshi-Misra (Rajarshi Misra), @capjamesg (James Gallagher), @SkalskiP (Piotr Skalski)
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
> `sv.Detections.from_yolov8` and `sv.Classifications.from_yolov8` are now deprecated and will be removed with supervision-0.16.0 release.
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)
https://github.com/roboflow/supervision/assets/26109316/da665575-4d74-469c-a1f7-a43b7ee7e214
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_yolov8andsv.Classifications.from_yolov8are now deprecated and will be removed withsupervision-0.16.0release.
First supervision usage example script showing how to detect and track objects on video using YOLOv8 + Supervision. (#341)
https://github.com/roboflow/supervision/assets/26109316/d8128440-6bd7-491a-8c7d-519254b76ec5
sv.ClassificationDataset and sv.DetectionDataset now use image path (not image name) as dataset keys. (#296)Detections.from_roboflow to filter out polygons with less than 3 points. (#300)@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)
Nothing published for this version
Nothing published for this version
> `sv.Detections.from_yolov8` is now deprecated and will be removed with supervision-0.15.0 release.
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
ByteTrack for object tracking with sv.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
... )
https://github.com/roboflow/supervision/assets/26109316/d5d393f5-e577-474a-bc8c-82483ef8a578
sv.Detections.from_ultralytics to enable seamless integration with Ultralytics framework. This will enable you to use supervision with all models that Ultralytics supports. (#222)
Warning
sv.Detections.from_yolov8is now deprecated and will be removed withsupervision-0.15.0release.
sv.Detections.from_paddledet to enable seamless integration with PaddleDetection framework. (#191)
Support for loading PASCAL VOC segmentation datasets with sv.DetectionDataset.. (#245)
@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)
Nothing published for this version
Nothing published for this version
> With the supervision-0.12.0 release, we are terminating official support for Python 3.7.
Warning With the
supervision-0.12.0release, we are terminating official support for Python 3.7. (#179)
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 or desktop mode. (#130)
setup.py to pyproject.toml. (#180)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)@kirilllzaitsev @hardikdava @onuralpszr @Ucag @SkalskiP @capjamesg
`as_folder_structure` fails to save `sv.ClassificationDataset` when it is result of inference.
as_folder_structure fails to save sv.ClassificationDataset when it is result of inference. (https://github.com/roboflow/supervision/pull/165)@capjamesg @SkalskiP
Ability to load and save `sv.DetectionDataset` in COCO format using `as_coco` and `from_coco` methods.
sv.DetectionDataset in COCO format using as_coco and from_coco methods. (https://github.com/roboflow/supervision/pull/150)>>> import supervision as sv
>>> ds = sv.DetectionDataset.from_coco(
... images_directory_path='...',
... annotations_path='...'
... )
>>> ds.as_coco(
... images_directory_path='...',
... annotations_path='...'
... )
sv.DetectionDataset together using merge method. (https://github.com/roboflow/supervision/pull/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']
start and end arguments to sv.get_video_frames_generator allowing to generate frames only for a selected part of the video. (https://github.com/roboflow/supervision/pull/162)data.yaml. (https://github.com/roboflow/supervision/pull/157)@SkalskiP @hardikdava
Ability to load and save `sv.ClassificationDataset` in a folder structure format.
sv.ClassificationDataset in a folder structure format. (https://github.com/roboflow/supervision/pull/125)>>> import supervision as sv
>>> cs = sv.ClassificationDataset.from_folder_structure(
... root_directory_path='...'
... )
>>> cs.as_folder_structure(
... root_directory_path='...'
... )
sv.ClassificationDataset.split allowing to divide sv.ClassificationDataset into two parts. (https://github.com/roboflow/supervision/pull/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. (https://github.com/roboflow/supervision/pull/110)
Supervision Quickstart notebook where you can learn more about Detection, Dataset and Video APIs.
sv.get_video_frames_generator documentation to better describe actual behavior. (https://github.com/roboflow/supervision/pull/135)@capjamesg @dankresio @SkalskiP
Ability to select `sv.Detections` by index, list of indexes or slice. Here is an example illustrating the new selection methods.
sv.Detections by index, list of indexes or slice. Here is an example illustrating the new selection methods. (https://github.com/roboflow/supervision/pull/118)>>> import supervision as sv
>>> detections = sv.Detections(...)
>>> len(detections[0])
1
>>> len(detections[[0, 1]])
2
>>> len(detections[0:2])
2
sv.Detections.from_yolov8. Here is an example illustrating how to extract boolean masks from the result of the YOLOv8 model inference. (https://github.com/roboflow/supervision/pull/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)
sv.crop. Here is an example showing how to get a separate crop for each detection in sv.Detections. (https://github.com/roboflow/supervision/pull/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
sv.ImageSink. An example shows how to save every tenth video frame as a separate image. (https://github.com/roboflow/supervision/pull/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)
sv.PolygonZone coordinates. Now sv.PolygonZone accepts coordinates in the form of [[x1, y1], [x2, y2], ...] that can be both integers and floats. (https://github.com/roboflow/supervision/issues/106)@SkalskiP @lomnes-atlast-food @hardikdava
Support for dataset inheritance. The current Dataset got renamed to DetectionDataset. Now `DetectionDataset` inherits from BaseDataset. This change wa
Dataset got renamed to DetectionDataset. Now DetectionDataset inherits from BaseDataset. This change was made to enforce the future consistency of APIs of different types of computer vision datasets. (https://github.com/roboflow/supervision/pull/100)DetectionDataset.as_yolo. (https://github.com/roboflow/supervision/pull/100)>>> import supervision as sv
>>> ds = sv.DetectionDataset(...)
>>> ds.as_yolo(
... images_directory_path='...',
... annotations_directory_path='...',
... data_yaml_path='...'
... )
DetectionDataset.split allowing to divide DetectionDataset into two parts. (https://github.com/roboflow/supervision/pull/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)
approximation_percentage parameter from 0.75 to 0.0 in DetectionDataset.as_yolo and DetectionDataset.as_pascal_voc. (https://github.com/roboflow/supervision/pull/100)Detections.from_yolo_nas to enable seamless integration with YOLO-NAS model.
Detections.from_yolo_nas to enable seamless integration with YOLO-NAS model. (https://github.com/roboflow/supervision/pull/91)Dataset.from_yolo. (https://github.com/roboflow/supervision/pull/86)Detections.merge to merge multiple Detections objects together. (https://github.com/roboflow/supervision/pull/84)LineZoneAnnotator.annotate to allow for the custom text for the in and out tags. (https://github.com/roboflow/supervision/pull/44)LineZoneAnnotator.annotate does not return annotated frame. (https://github.com/roboflow/supervision/pull/81)Initial Dataset support and ability to save Detections in Pascal VOC XML format.
Dataset support and ability to save Detections in Pascal VOC XML format. (https://github.com/roboflow/supervision/pull/71)mask_to_polygons, filter_polygons_by_area, polygon_to_xyxy and approximate_polygon utilities. (https://github.com/roboflow/supervision/pull/71)Dataset. (https://github.com/roboflow/supervision/pull/72)Detections attributes to make it consistent with order of objects in __iter__ tuple. (https://github.com/roboflow/supervision/pull/70)generate_2d_mask to polygon_to_mask. (https://github.com/roboflow/supervision/pull/71)Fixed LineZone.trigger function expects 4 values instead of 5
LineZone.trigger function expects 4 values instead of 5 (https://github.com/roboflow/supervision/pull/63)Fixed Detections.__getitem__ method did not return mask for selected item.
Detections.__getitem__ method did not return mask for selected item.Detections.area crashed for mask detections.Detections.mask to enable segmentation support.
Detections.mask to enable segmentation support. (https://github.com/roboflow/supervision/pull/58)MaskAnnotator to allow easy Detections.mask annotation. (https://github.com/roboflow/supervision/pull/58)Detections.from_sam to enable native Segment Anything Model (SAM) support. (https://github.com/roboflow/supervision/pull/58)Detections.area behaviour to work not only with boxes but also with masks. (https://github.com/roboflow/supervision/pull/58)Detections.empty to allow easy creation of empty Detections objects.
Detections.empty to allow easy creation of empty Detections objects. (https://github.com/roboflow/supervision/discussions/48)Detections.from_roboflow to allow easy creation of Detections objects from Roboflow API inference results. (https://github.com/roboflow/supervision/pull/56)plot_images_grid to allow easy plotting of multiple images on single plot. (https://github.com/roboflow/supervision/pull/56)detections_to_voc_xml method. (https://github.com/roboflow/supervision/pull/56)show_frame_in_notebook refactored and renamed to plot_image. (https://github.com/roboflow/supervision/pull/56)Drop requirement for class_id in sv.Detections (https://github.com/roboflow/supervision/pull/50) to make it more flexible
class_id in sv.Detections (https://github.com/roboflow/supervision/pull/50) to make it more flexibleDetections.wth_nms support class agnostic and non-class agnostic case
Detections.wth_nms support class agnostic and non-class agnostic case (https://github.com/roboflow/supervision/pull/36)PolygonZone throws an exception when the object touches the bottom edge of the image (https://github.com/roboflow/supervision/issues/41)Detections.wth_nms method throws an exception when Detections is empty (https://github.com/roboflow/supervision/issues/42)New methods in sv.Detections API:
New methods in sv.Detections API:
from_transformers - convert Object Detection 🤗 Transformer result into sv.Detectionsfrom_detectron2 - convert Detectron2 result into sv.Detectionsfrom_coco_annotations - convert COCO annotation into sv.Detectionsarea - dynamically calculated property storing bbox areawith_nms - initial implementation (only class agnostic) of sv.Detections NMSsv.Detections.confidence field Optional.Nothing published for this version
Support for PolygonZone and PolygonZoneAnnotator 🔥
PolygonZone and PolygonZoneAnnotator 🔥<details> <summary>👉 Code example</summary>
import numpy as np
import supervision as sv
from ultralytics import YOLO
# initiate polygon zone
polygon = np.array([
[1900, 1250],
[2350, 1250],
[3500, 2160],
[1250, 2160]
])
video_info = sv.VideoInfo.from_video_path(MALL_VIDEO_PATH)
zone = sv.PolygonZone(polygon=polygon, frame_resolution_wh=video_info.resolution_wh)
# initiate annotators
box_annotator = sv.BoxAnnotator(thickness=4, text_thickness=4, text_scale=2)
zone_annotator = sv.PolygonZoneAnnotator(zone=zone, color=sv.Color.white(), thickness=6, text_thickness=6, text_scale=4)
# extract video frame
generator = sv.get_video_frames_generator(MALL_VIDEO_PATH)
iterator = iter(generator)
frame = next(iterator)
# detect
model = YOLO('yolov8s.pt')
results = model(frame, imgsz=1280)[0]
detections = sv.Detections.from_yolov8(results)
detections = detections[detections.class_id == 0]
zone.trigger(detections=detections)
# annotate
box_annotator = sv.BoxAnnotator(thickness=4, text_thickness=4, text_scale=2)
labels = [f"{model.names[class_id]} {confidence:0.2f}" for _, confidence, class_id, _ in detections]
frame = box_annotator.annotate(scene=frame, detections=detections, labels=labels)
frame = zone_annotator.annotate(scene=frame)
</details>
vs.Detections filtering with pandas-like API.detections = detections[(detections.class_id == 0) & (detections.confidence > 0.5)]
YOLOv5 and YOLOv8 models.import torch
import supervision as sv
model = torch.hub.load('ultralytics/yolov5', 'yolov5x6')
results = model(frame, size=1280)
detections = sv.Detections.from_yolov5(results)
from ultralytics import YOLO
import supervision as sv
model = YOLO('yolov8s.pt')
results = model(frame, imgsz=1280)[0]
detections = sv.Detections.from_yolov8(results)
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 objectsupervision.draw_polygon function - draw a polygon on a scenesupervision.draw_text function - draw a text on a scenesupervision.ColorPalette.default() - class method - to generate default ColorPalettesupervision.generate_2d_mask function - generate a 2D mask from a polygonsupervision.PolygonZone class - to define polygon zones and validate if supervision.Detections are in the zonesupervision.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 dataclassprocess_frame API - change argument name frame -> scene to make it consistent with other classes and methodsLineCounter API - rename class LineCounter -> LineZone to make it consistent with PolygonZoneLineCounterAnnotator API - rename class LineCounterAnnotator -> LineZoneAnnotator🎨 DEFAULT_COLOR_PALETTE, Color, and ColorPalette classes
DEFAULT_COLOR_PALETTE, Color, and ColorPalette classesPoint, Vector, and Rect classesVideoInfo and VideoSink classes as well as get_video_frames_generator
-📓 show_frame_in_notebook utildraw_line, draw_rectangle, draw_filled_rectangle utils addedDetections and BoxAnnotator addedLineCounter and LineCounterAnnotator classes@SkalskiP
Your coding agent can read these notes before it upgrades. Set up the MCP server →