Essential update to the LineZone: when computing line crossings, detections that jitter might be counted twice (or more). This can now be solved with the minimum_crossing_threshold argument. If you set it to 2 or more, extra frames will be used to confirm the crossing, improving the accuracy significantly. (#1540)
Supervision can now be used with Python 3.13. The most renowned update is the ability to run Python without Global Interpreter Lock (GIL). We expect support for this among our dependencies to be inconsistent, but if you do attempt it - let us know the results! (#1595)
Added Mean Average Recall mAR metric, which returns a recall score, averaged over IoU thresholds, detected object classes, and limits imposed on maximum considered detections. (#1661)
Added the metadata variable to Detections. It allows you to store custom data per-image, rather than per-detected-object as was possible with data variable. For example, metadata could be used to store the source video path, camera model or camera parameters. (#1589)
importsupervisionassvfromultralyticsimportYOLOmodel=YOLO("yolov8m")result=model("image.png")[0]detections=sv.Detections.from_ultralytics(result)# Items in `data` must match length of detectionsobject_ids=[numfornuminrange(len(detections))]detections.data["object_number"]=object_ids# Items in `metadata` can be of any length.detections.metadata["camera_model"]="Luxonis OAK-D"
Added a py.typed type hints metafile. It should provide a stronger signal to type annotators and IDEs that type support is available. (#1586)
ByteTrack no longer requires detections to have a class_id (#1637)
draw_line, draw_rectangle, draw_filled_rectangle, draw_polygon, draw_filled_polygon and PolygonZoneAnnotator now comes with a default color (#1591)
Dataset classes are treated as case-sensitive when merging multiple datasets. (#1643)
Small improvements to error handling in polygons: (#1602)
Updated ByteTrack, removing shared variables. Previously, multiple instances of ByteTrack would share some date, requiring liberal use of tracker.reset(). (#1603), (#1528)
Fixed a bug where class_agnostic setting in MeanAveragePrecision would not work. (#1577) hacktoberfest
Removed welcome workflow from our CI system. (#1596)
Large refactor of ByteTrack: STrack moved to separate class, removed superfluous BaseTrack class, removed unused variables (#1603)
Large refactor of RichLabelAnnotator, matching its contents with LabelAnnotator. (#1625)
Enhanced LineZoneAnnotator, allowing the labels to align with the line, even when it's not horizontal. Also, you can now disable text background, and choose to draw labels off-center which minimizes overlaps for multiple LineZone labels. #854
Added per-class counting capabilities to LineZone and introduced LineZoneAnnotatorMulticlass for visualizing the counts per class. This feature allows tracking of individual classes crossing a line, enhancing the flexibility of use cases like traffic monitoring or crowd analysis. #1555
Added from_easyocr, allowing integration of OCR results into the supervision framework. EasyOCR is an open-source optical character recognition (OCR) library that can read text from images. #1515
Added oriented_box_iou_batch function to detection.utils. This function computes Intersection over Union (IoU) for oriented or rotated bounding boxes (OBB). #1502
importnumpyasnpboxes_true=np.array([[[1,0],[0,1],[3,4],[4,3]]])boxes_detection=np.array([[[1,1],[2,0],[4,2],[3,3]]])ious=sv.oriented_box_iou_batch(boxes_true,boxes_detection)print("IoU between true and detected boxes:",ious)
Extended PolygonZoneAnnotator to allow setting opacity when drawing zones, providing enhanced visualization by filling the zone with adjustable transparency. #1527
The frame_resolution_wh parameter in PolygonZone has been removed.
Removed
Supervision installation methods "headless" and "desktop" were removed, as they are no longer needed. pip install supervision[headless] will install the base library and harmlessly warn of non-existent extras.
Supervision now depends on opencv-python rather than opencv-python-headless. #1530
Fixed the COCO 101 point Average Precision algorithm to correctly interpolate precision, providing a more precise calculation of average precision without averaging out intermediate values. #1500
Resolved miscellaneous issues highlighted when building documentation. This mostly includes whitespace adjustments and type inconsistencies. Updated documentation for clarity and fixed formatting issues. Added explicit version for mkdocstrings-python. #1549
Enabled and fixed Ruff rules for code formatting, including changes like avoiding unnecessary iterable allocations and using Optional for default mutable arguments. #1526
Added #1386: Support for Transformers v5 functions in sv.Detections.from_transformers. This includes the DetrImageProcessor methods post_process_object_detection, post_process_panoptic_segmentation, post_process_semantic_segmentation, and post_process_instance_segmentation.
Changed #1434: InferenceSlicer now features an overlap_wh parameter, making it easier to compute slice sizes when handling overlapping slices.
Fix #1448: Various annotator type issues have been resolved, supporting expanded error handling.
Fix #1348: Introduced a new method for seeking to a specific video frame, addressing cases where traditional seek methods were failing. It can be enabled with iterative_seek=True.
Fix #1424: plot_image function now clearly indicates that the size is in inches.
Removed
The track_buffer, track_thresh, and match_thresh parameters in ByteTrack are deprecated and were removed as of supervision-0.23.0. Use lost_track_buffer,track_activation_threshold, and minimum_matching_threshold instead.
Removed
The triggering_position parameter in sv.PolygonZone was removed as of supervision-0.23.0. Use triggering_anchors instead.
Deprecated
overlap_filter_strategy in InferenceSlicer.__init__ is deprecated and will be removed in supervision-0.27.0. Use overlap_strategy instead.
Deprecated
overlap_ratio_wh in InferenceSlicer.__init__ is deprecated and will be removed in supervision-0.27.0. Use overlap_wh instead.
Constructing DetectionDataset with parameter images as Dict[str, np.ndarray] is deprecated and will be removed in supervision-0.26.0. Please pass a list of paths List[str] instead.
Deprecated
The DetectionDataset.images property is deprecated and will be removed in supervision-0.26.0. Please loop over images with for path, image, annotation in dataset:, as that does not require loading all images into memory.
importroboflowfromroboflowimportRoboflowimportsupervisionassvroboflow.login()rf=Roboflow()project=rf.workspace(<WORKSPACE_ID>).project(<PROJECT_ID>)dataset=project.version(<PROJECT_VERSION>).download("coco")ds_train=sv.DetectionDataset.from_coco(images_directory_path=f"{dataset.location}/train",annotations_path=f"{dataset.location}/train/_annotations.coco.json",)path,image,annotation=ds_train[0]# loads image on demandforpath,image,annotationinds_train:# loads image on demand
Added #1296: sv.Detections.from_lmm now supports parsing results from the Florence 2 model, extending the capability to handle outputs from this Large Multimodal Model (LMM). This includes detailed object detection, OCR with region proposals, segmentation, and more. Find out more in our Colab notebook.
Added #1316: sv.KeyPoints.from_mediapipe extended to support FaceMesh from Mediapipe. This enhancement allows for processing both face landmarks from FaceLandmarker, and legacy results from FaceMesh.
Added #1277: if you provide a font that supports symbols of a language, sv.RichLabelAnnotator will draw them on your images.
Various other annotators have been revised to ensure proper in-place functionality when used with numpy arrays. Additionally, we fixed a bug where sv.ColorAnnotator was filling boxes with solid color when used in-place.
BoxAnnotator was removed, however BoundingBoxAnnotator has been renamed to BoxAnnotator. Use a combination of BoxAnnotator and LabelAnnotator to simulate old BoundingBox behavior.
Deprecated
The name BoundingBoxAnnotator has been deprecated and will be removed in supervision-0.26.0. It has been renamed to BoxAnnotator.
Added #975 📝 New Cookbooks: serialize detections into json and csv.
Added #1290: Mostly an internal change, our file utility function now support both str and pathlib paths.
Fixed #787: sv.ByteTrack.update_with_detections which was removing segmentation masks while tracking. Now, ByteTrack can be used alongside segmentation models.
Changed #827: sv.ByteTrack.reset allowing users to clear trackers state, enabling the processing of multiple video files in sequence.
Changed #802: sv.LineZoneAnnotator allowing to hide in/out count using display_in_count and display_out_count properties.
Changed #787: sv.ByteTrack input arguments and docstrings updated to improve readability and ease of use.
Deprecated
The track_buffer, track_thresh, and match_thresh parameters in sv.ByteTrack are deprecated and will be removed in supervision-0.23.0. Use lost_track_buffer,track_activation_threshold, and minimum_matching_threshold instead.
Changed #910: sv.PolygonZone to now accept a list of specific box anchors that must be in zone for a detection to be counted.
Deprecated
The triggering_position parameter in sv.PolygonZone is deprecated and will be removed in supervision-0.23.0. Use triggering_anchors instead.
Changed #875: annotators adding support for Pillow images. All supervision Annotators can now accept an image as either a numpy array or a Pillow Image. They automatically detect its type, draw annotations, and return the output in the same format as the input.
Changed #735: 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].
Changed #756: 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).
Deprecated
sv.ColorPalette.default() is deprecated and will be removed in supervision-0.22.0. Use sv.ColorPalette.DEFAULT instead.
Detections.from_roboflow() is deprecated and will be removed in supervision-0.22.0. Use Detections.from_inference instead.
Fixed #735: 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.
Changed #482: 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.
Changed #465: Annotator argument name from color_map: str to color_lookup: ColorLookup enum to increase type safety.
Added #354: Supervision usage example. You can now learn how to perform traffic flow analysis with Supervision.
Changed #399: 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.
Changed #381: sv.VideoSink now allows to customize the output codec.
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 in sv.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.
Fixed #106: 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.
Added #100: support for dataset inheritance. The current 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.