Skip to content

supervision-0.33.0

Latest

Choose a tag to compare

@Borda Borda released this 06 Dec 16:28

v0.33.0: Detection fusion and faster Inference parsing

πŸ“‹ Summary

Combine boxes from several models directly on sv.Detections, and parse Inference responses faster and in more detail.

  • Detection fusion merges ensemble or test-time augmentation results, for boxes, oriented boxes and masks.
  • Inference parsing resizes size-mismatched compact masks in run space, 2.7Γ— to 37Γ— faster in a 20-mask benchmark, and keeps ordered corners and headings of native oriented-box responses.
  • Colour semantic-segmentation maps and split each class into one detection per patch.
  • Measure and draw joint angles from key points.
  • Build detection datasets one image at a time.
  • Drawing and annotating on array views copies far less of the frame.

Check the migration guide before upgrading. It covers scheduled removals, the sv.OverlapFilter.NONE value change, native oriented-box parsing and deprecated imports.

✨ Spotlights / highlights

🀝 Detection fusion

Weighted Box Fusion works directly on sv.Detections. Use fuse with one input per model or augmentation pass. For detections already merged into one input, pass sources and num_models to with_fusion. Without sources, num_models rescales confidence based on the number of detections in each cluster. source_weights controls each source's contribution, and can_seed marks which detections may start a cluster. Pass return_groups=True to get the fused detections and their input rows from one clustering run. With fuse, row indices span the inputs in argument order, so rows 0 and 1 below come from different models. (#3091, #3092, #3093, #3094, #3101, #3103, #3149, #3153, #3157)

import numpy as np
import supervision as sv

model_a = sv.Detections(
    xyxy=np.array([[0, 0, 10, 10]], dtype=float),
    confidence=np.array([0.9]),
    class_id=np.array([0]),
)
model_b = sv.Detections(
    xyxy=np.array([[1, 1, 11, 11], [50, 50, 60, 60]], dtype=float),
    confidence=np.array([0.8, 0.7]),
    class_id=np.array([0, 0]),
)
fused, groups = sv.Detections.fuse(model_a, model_b, return_groups=True)
print(fused.confidence.round(3).tolist())  # [0.85, 0.35]
print(groups)  # [[0, 1], [2]]

πŸ”Œ Inference connection

Inference responses parse faster and keep more of what the model returns. The speed-up needs no code changes. With compact_masks=True, sv.Detections.from_inference resizes size-mismatched COCO RLE masks in run space instead of decoding a full-image mask. Responses from oriented-object-detection models that carry class_heading keep ordered corners, headings and detection IDs, and sv.InferenceSlicer keeps that metadata across tiles. A response without predictions gives empty detections instead of raising KeyError. (#2696, #2835, #3156, #3159)

Time to parse 20 masks from a 160Γ—160 model grid into a larger image with compact_masks=True, as the median of 7 runs on one machine. Image-sized masks take the same time as before.

Image Solid masks Fragmented masks
720p 14.5 ms β†’ 1.9 ms (7.6Γ—) 21.5 ms β†’ 8.1 ms (2.7Γ—)
1080p 27.2 ms β†’ 2.2 ms (12.4Γ—) 35.6 ms β†’ 9.0 ms (4.0Γ—)
4K 123.5 ms β†’ 3.3 ms (37.4Γ—) 147.6 ms β†’ 11.7 ms (12.6Γ—)

πŸ—ΊοΈ Semantic segmentation

sv.LabelMapAnnotator colours a dense class-id map through a lookup table using a few temporary image-sized arrays, with no mask per class. split_components=True returns one detection per connected patch. (#3047, #3032)

import numpy as np
import supervision as sv

label_map = np.zeros((40, 40), dtype=np.int64)
label_map[5:15, 5:15] = 1
label_map[25:35, 25:35] = 1
scene = np.zeros((40, 40, 3), dtype=np.uint8)
annotated = sv.LabelMapAnnotator(opacity=0.6).annotate(scene.copy(), label_map)
len(sv.Detections.from_semantic_segmentation(label_map, split_components=True))  # 2

🦴 Joint angles

sv.joint_angles returns the angle at a joint for every skeleton, and sv.JointAngleAnnotator draws it. (#2899, #3085)

import numpy as np
import supervision as sv
from supervision.key_points.angles import JointAngle

key_points = sv.KeyPoints(
    xy=np.array([[[100, 50], [100, 100], [150, 100]]], dtype=np.float32)
)
knee = JointAngle(name="knee", start=0, joint=1, end=2)
sv.joint_angles(key_points, [knee])  # 90 degrees

πŸ—‚οΈ Dataset building

Start an empty detection dataset and add images as predictions arrive. add accepts annotations without class_id. YOLO, COCO and Pascal VOC export require it on every non-empty annotation and can raise ValueError after copying images. (#2868)

import numpy as np
import supervision as sv

dataset = sv.DetectionDataset.empty(classes=["person"])
dataset.add(
    "images/frame-0.jpg",
    sv.Detections(xyxy=np.array([[0, 0, 10, 10]], dtype=float), class_id=np.array([0])),
)
len(dataset)  # 1

πŸ”„ Migration guide

This release has no breaking changes. Check three scheduled removals, the sv.OverlapFilter.NONE value change, native oriented-box parsing, changes to dependencies, video decoding, drawing, sliced inference, logging, Pascal VOC export and mixed mask merging, and stricter compact-mask input validation. The guide also covers new warnings for NaN confidence and invalid native oriented-box responses, plus deprecations scheduled for removal in 0.36.0. Top-level supervision exports remain available.

πŸ’₯ Breaking changes

No breaking changes in this release.

πŸ—“οΈ Scheduled removals

πŸ”’ Positional mask_dimension and overlap_metric in sv.mask_non_max_merge

Passing these positionally warned since 0.30.0 and now raises TypeError. Drop mask_dimension and pass overlap_metric by keyword.

# Before (0.32.3)
sv.mask_non_max_merge(predictions, masks, 0.5, 64, sv.OverlapMetric.IOS)
# After (0.33.0)
sv.mask_non_max_merge(predictions, masks, 0.5, overlap_metric=sv.OverlapMetric.IOS)

The old positional call raises this error in 0.33.0.

TypeError: mask_non_max_merge() takes from 2 to 3 positional arguments but 5 were given

πŸ”‘ Keyword mask_dimension in sv.mask_non_max_merge

Deprecated in 0.30.0 and ignored since. It now raises TypeError. Drop the keyword.

# Before (0.32.3)
sv.mask_non_max_merge(predictions, masks, mask_dimension=64)
# After (0.33.0)
sv.mask_non_max_merge(predictions, masks)

Keeping the mask_dimension keyword raises this error in 0.33.0.

TypeError: mask_non_max_merge() got an unexpected keyword argument 'mask_dimension'

πŸ–ΌοΈ sv.DetectionDataset with a dict of in-memory images

The dict form was deprecated in 0.30.0 and now raises TypeError. Save the images and pass a list of their paths. sv.ClassificationDataset still accepts the dict form in 0.33.0.

# Before (0.32.3)
sv.DetectionDataset(classes=classes, images={"a.jpg": image}, annotations=annotations)
# After (0.33.0)
with sv.ImageSink(target_dir_path=".") as sink:
    sink.save_image(image, image_name="a.jpg")
sv.DetectionDataset(classes=classes, images=["a.jpg"], annotations=annotations)

The dict form raises this error in 0.33.0.

TypeError: Passing a `Dict[str, np.ndarray]` into `DetectionDataset` was removed in `0.33.0`. Pass a list of image paths `List[str]` instead.

πŸ”€ Changed behaviour

🏷️ Overlap filter value

KEEP_ALL makes the no-filter strategy explicit and distinguishes it from NON_MAX_SUPPRESSION, NON_MAX_MERGE and Python None. sv.OverlapFilter.NONE and sv.OverlapFilter("none") still resolve to KEEP_ALL as aliases. The only changes are that .value is now "keep_all", .name is "KEEP_ALL", and sv.OverlapFilter.list() returns the new value. Code that compares or stores the string value should use the enum member instead.

print(sv.OverlapFilter.NONE.value, sv.OverlapFilter.NONE.name)
# Before (0.32.3): none NONE
# After (0.33.0): keep_all KEEP_ALL
print(sv.OverlapFilter.list())
# Before (0.32.3): ['none', 'non_max_suppression', 'non_max_merge']
# After (0.33.0): ['keep_all', 'non_max_suppression', 'non_max_merge']

Compare against sv.OverlapFilter.NONE itself to support both releases.

πŸ“ Native oriented-object-detection responses

sv.Detections.from_inference uses native oriented-box parsing when an oriented-object-detection response carries class_heading and passes validation. Use string keys and boolean values in class_heading. Every prediction must include class, class_id, confidence, obb ([center_x, center_y, width, height, angle], with the angle in radians), a non-empty string detection_id, and a boolean heading equal to class_heading[class]. The from_inference docstring lists the validation rules. For valid native responses, xyxy gives the axis-aligned bounds of obb, independent of the response's x, y, width and height. The example uses a response with class_heading, ordinary box fields and native fields.

# Before (0.32.3)
boxes = sv.Detections.from_inference(response).xyxy
# After (0.33.0)
corners = sv.Detections.from_inference(response).data["xyxyxyxy"]

For a prediction with x=50, y=40, width=20, height=10 and obb=[50, 40, 20, 10, 0.5], xyxy changes from [[40.0, 35.0, 60.0, 45.0]] in 0.32.3 to [[38.83, 30.82, 61.17, 49.18]] in 0.33.0. The data dictionary gains xyxyxyxy, heading, detection_id and native_obb alongside class_name.

βœ… Compact-mask input validation

Before: In 0.32.3, fractional uncompressed COCO RLE counts could be truncated. Multidimensional compact-mask row indices raised TypeError at selection or when converted to a dense mask, depending on the index shape.

After: Pass one-dimensional row index arrays or lists to sv.CompactMask. For multidimensional indices, 0.33.0 raises IndexError at selection. Pass whole-number counts to sv.CompactMask.from_coco_rle to avoid ValueError.

πŸ“¦ Dependency floors

Before: pillow>=9.4, av>=14.2, pydeprecate>=0.9,<0.16

After: pillow>=10.4, av>=15.1, pydeprecate>=0.14,<0.17

🎞️ Video decoding and text drawing

With the PyAV fallback, handle RuntimeError when iterating sv.get_video_frames_generator or calling sv.process_video if you previously relied on decoding failures ending processing early. Errors recorded while seeking, reading or skipping frames retain the original decoder error in their exception cause chain. A separate frame-count scan can still raise a decoder error directly.

With OpenCV 5.0, pass a non-negative text_scale to sv.draw_text and annotators that draw labels through OpenCV. A negative scale now raises ValueError.

βœ‚οΈ Sliced inference

If you need tracker IDs in the result of sv.InferenceSlicer, return them from every non-empty tile. When only some non-empty tiles provide IDs, the slicer sets tracker_id to None and warns once per instance. For a windowed raster, use the raster input when you need source pixels because the result omits metadata["source_image"].

Keep the same class_heading map across all native oriented-box tiles, including empty ones. The slicer detects conflicts and raises ValueError even if your callback reuses a result and mutates its map in place.

πŸ“œ Logger names

Loggers follow the modules that emit the messages. Update configurations that name individual loggers. For video, use supervision.video.frames, supervision.video.info, supervision.video.process or supervision.video.sink, depending on the operation.

The CSV and JSON sinks now log under supervision.io.csv_sink and supervision.io.json_sink (previously supervision.detection.tools.csv_sink and supervision.detection.tools.json_sink). Connector messages from supervision.detection.utils.internal now log under supervision.detection.inference.adapters.

Before: logging.getLogger("supervision.utils.video") for video frame messages.

After: logging.getLogger("supervision.video.frames") for those messages.

πŸ“€ Multi-part masks in Pascal VOC export

DetectionDataset.as_pascal_voc now writes the exported polygons of a multi-part mask as children of one <object>. supervision reads all of them. An external reader that takes only the first <polygon> of an object loses the other parts, so update it to read every one. Parts whose contours have fewer than three points, such as a single pixel, are still left out when other parts yield polygons.

Before: one <object> per exported part, one <polygon> each.

After: one <object> per mask with exported polygons, one <polygon> per exported part.

🧩 Merging dense and compact masks

Before: 0.32.3 documented and applied a crop of each dense mask to its xyxy box when sv.Detections.merge mixed dense masks and sv.CompactMask.

After: The merge keeps every dense-mask pixel, so mask area and overlap can grow. To keep the old crop, assign sv.CompactMask.from_dense(detections.mask, detections.xyxy, detections.mask.shape[1:]) to the dense input's detections.mask before merging.

For example, a dense mask that lies outside its xyxy box:

import numpy as np
import supervision as sv

dense_mask = np.zeros((1, 20, 20), dtype=bool)
dense_mask[0, 12:18, 12:18] = True  # lies outside the box below
dense = sv.Detections(xyxy=np.array([[0.0, 0.0, 10.0, 10.0]]), mask=dense_mask)

compact_mask = np.zeros((1, 20, 20), dtype=bool)
compact_mask[0, 2:6, 2:6] = True
compact = sv.Detections(
    xyxy=np.array([[2.0, 2.0, 6.0, 6.0]]),
    mask=sv.CompactMask.from_dense(compact_mask, np.array([[2, 2, 6, 6]]), (20, 20)),
)

merged = sv.Detections.merge([dense, compact])
print(merged.area.tolist())
# Before (0.32.3): [0, 16]
# After (0.33.0): [36, 16]

πŸ•°οΈ Deprecations (removal in 0.36.0)

🧭 Oriented-box responses without or with invalid class_heading

  • Without class_heading, the response still parses as ordinary detections. If it also omits predictions, the result is now empty, whereas 0.32.3 raised KeyError. This fallback emits a deprecation warning in 0.33.0 and is scheduled for removal in 0.36.0.
  • A response with class_heading that fails native validation emits one warning in 0.33.0 and parses as ordinary detections as in 0.32.3, with the same xyxy and only class_name in data. It raises ValueError from 0.36.0.

For a prediction missing detection_id, the warning reads as follows.

The `oriented-object-detection` response failed native oriented-box validation and is parsed as ordinary detections without ordered corners or headings. This fallback is deprecated in `0.33.0` and will raise `ValueError` from `0.36.0`. Original error: Native OBB responses require stable detection_id values

Fix the response fields listed under Changed behaviour.

πŸ”” NaN confidence in suppression and merging

NMS, Soft-NMS and NMM warn about NaN confidence in 0.33.0. NMS and NMM return the same results as 0.32.3. Soft-NMS results can differ only because of the fix that selects the highest current score at each Gaussian Soft-NMS step. A detection with a NaN score can suppress a valid overlapping detection. Remove or replace NaN scores before calling these methods or array functions to avoid ValueError from 0.36.0.

In this example, the NaN score triggers one warning in 0.33.0, and NMS keeps the same rows as in 0.32.3.

detections = sv.Detections(
    xyxy=np.array([[0.0, 0.0, 10.0, 10.0], [1.0, 1.0, 11.0, 11.0]]),
    confidence=np.array([np.nan, 0.8]),
    class_id=np.array([0, 0]),
)
detections.with_nms(threshold=0.5)
NaN confidence in NMS, Soft-NMS and NMM is deprecated in `0.33.0` and will raise `ValueError` from `0.36.0`. Remove or replace NaN scores.

πŸŽ›οΈ Suppression and fusion functions

Use the sv.Detections methods to get filtered Detections directly. Pass the original overlap_metric explicitly. This example uses five-column predictions, so detections has no class_id and the replacement sets class_agnostic=True.

# Before (0.32.3)
keep = sv.box_non_max_suppression(
    predictions, iou_threshold=0.5, overlap_metric=sv.OverlapMetric.IOU
)
detections = detections[keep]
# After (0.33.0)
detections = detections.with_nms(
    threshold=0.5, overlap_metric=sv.OverlapMetric.IOU, overlap_on="box", class_agnostic=True
)
Deprecated Replacement
sv.box_non_max_suppression Detections.with_nms(overlap_on="box")
sv.mask_non_max_suppression Detections.with_nms(overlap_on="mask")
sv.oriented_box_non_max_suppression Detections.with_nms(overlap_on="box") on detections with data["xyxyxyxy"]
sv.box_soft_non_max_suppression Detections.with_soft_nms(overlap_on="box")
sv.mask_soft_non_max_suppression Detections.with_soft_nms(overlap_on="mask")
sv.oriented_box_soft_non_max_suppression Detections.with_soft_nms(overlap_on="box") on detections with data["xyxyxyxy"]
sv.box_weighted_box_fusion Detections.with_fusion(threshold=iou_threshold, overlap_on="box"). By default, detections with masks cluster by mask overlap.

For fusion, keep the original num_models and overlap_metric. Set class_agnostic=True for five-column predictions without class_id. Omit oriented corners from the fusion input to preserve axis-aligned fusion.

overlap_on="box" uses oriented corners when data["xyxyxyxy"] is present. For axis-aligned with_nms, omit those corners, pass the original iou_threshold as threshold and keep the original overlap metric. Select the surviving rows from the original detections as shown below. For axis-aligned with_soft_nms, also omit the corners, pass the original sigma and overlap metric, and keep the returned decayed scores.

import numpy as np
import supervision as sv

boxes = sv.Detections(
    xyxy=detections.xyxy,
    confidence=detections.confidence,
    class_id=detections.class_id,
    data={"index": np.arange(len(detections))},
)
keep = boxes.with_nms(
    threshold=0.5, overlap_on="box", class_agnostic=boxes.class_id is None
).data["index"]
detections = detections[keep]

sv.box_non_max_merge, sv.mask_non_max_merge and sv.oriented_box_non_max_merge stay.

πŸ“‚ Moved modules

Importing from an old path warns and returns the same objects. Set SUPERVISION_DEPRECATION_WARNING=0 to silence the module warnings.

# Before (0.32.3)
from supervision.utils.video import VideoInfo
# After (0.33.0)
from supervision.video.info import VideoInfo

The old import emits this warning in 0.33.0.

`supervision.utils.video` is deprecated in `0.33.0` and will be removed in `0.36.0`. Import from `supervision.video.fps`, `supervision.video.frames`, `supervision.video.info`, `supervision.video.process` or `supervision.video.sink` instead.
Old module New module
supervision.detection.compact_mask supervision.detection.shapes.compact_mask
supervision.detection.line_zone supervision.detection.zones.line_zone
supervision.detection.tools.polygon_zone supervision.detection.zones.polygon_zone
supervision.detection.tools.csv_sink supervision.io.csv_sink
supervision.detection.tools.json_sink supervision.io.json_sink
supervision.detection.tools.inference_slicer supervision.detection.inference.inference_slicer
supervision.detection.tools.smoother supervision.detection.smoother
supervision.detection.tools.transformers supervision.detection.inference.transformers
supervision.detection.vlm supervision.detection.inference.vlm
supervision.detection.utils.vlms supervision.detection.inference.vlms
supervision.detection.utils.boxes supervision.detection.shapes.boxes
supervision.detection.utils.converters supervision.detection.shapes.converters
supervision.detection.utils.masks supervision.detection.shapes.masks
supervision.detection.utils.polygons supervision.detection.shapes.polygons
supervision.detection.utils.matching supervision.detection.overlap.matching
supervision.detection.utils.iou_and_nms supervision.detection.overlap.iou (IoU functions, overlap enums), supervision.detection.overlap.nms (suppression, merge, fusion)
supervision.detection.utils.internal supervision.detection.inference.adapters (connector helpers), supervision.detection.zones.line_zone (cross_product). Data and merge helpers remain importable through the shim during the deprecation window and have no public replacement.
supervision.draw.base supervision.image.types
supervision.draw.utils supervision.draw.primitives
supervision.utils.conversion supervision.image.conversion
supervision.utils.file supervision.io.file
supervision.utils.image supervision.image.ops, supervision.image.sink (ImageSink), supervision.image.url (load_image_from_url)
supervision.utils.image_window supervision.image.window
supervision.utils.notebook supervision.image.notebook
supervision.utils.video supervision.video.fps, supervision.video.frames, supervision.video.info, supervision.video.process, supervision.video.sink

πŸ“ Notable changes

πŸš€ Added

  • Detection fusion β€” sv.Detections.with_fusion, fusion_groups and fuse, with oriented-box and mask support, per-model sources and weights, box_weights (sv.FusionBoxWeights) and can_seed. Pass return_groups=True to with_fusion or fuse to return the fused detections and their input-row groups from one clustering run. (#3091, #3092, #3093, #3094, #3101, #3103, #3149, #3153, #3157)
  • overlap_on β€” choose box or mask overlap in with_nms, with_soft_nms and with_nmm. "box" uses oriented corners when present. with_nmm unions masks in each box-based merge group, except native Inference oriented-box groups, which keep the highest-confidence row and its mask. with_soft_nms also takes overlap_metric. The new sv.OverlapOn enum names the choices. (#3090)
  • Semantic segmentation β€” sv.LabelMapAnnotator and split_components=True in sv.Detections.from_semantic_segmentation. (#3047, #3032)
  • Joint angles β€” sv.joint_angles and sv.JointAngleAnnotator. (#2899, #3085, #3147)
  • COCO RLE round trip β€” sv.CompactMask.to_coco_rle(), plus resize=True and an optional xyxy in sv.CompactMask.from_coco_rle. (#2696)
  • Normal and gradient maps β€” sv.NormalMapAnnotator and sv.GradientMapAnnotator. Gradient maps default to the 2nd to 98th percentile and use the valid minimum and maximum when those percentiles coincide. A fixed range is also available. (#2888)
  • Dataset building β€” sv.DetectionDataset.empty and sv.DetectionDataset.add. (#2868)
  • Native oriented boxes β€” sv.Detections.from_inference parses native oriented-object-detection responses with ordered corners, headings and detection IDs, and sv.InferenceSlicer keeps that metadata across tiles. (#2835)
  • Camera motion β€” sv.PolygonZone.occupancy_ratio accepts coord_transform. (#3120)

🌱 Changed

  • Dependencies β€” minimum pillow 10.4, av 15.1 and pydeprecate 0.14. Measuring variable frame rates uses VideoFrame.duration, which PyAV 14.2 and 15.0 lack. (#3045, #3068, #3128)
  • YOLO load order β€” DetectionDataset.from_yolo and KeyPointsDataset.from_yolo load images in sorted path order. Previously they grouped by extension and followed filesystem order within each group, so even a seeded split can give a different partition after upgrading. (#3081)
  • Drawing on views β€” boxes, dots, triangles, labels, text and shape helpers copy only the regions they touch. (#3116, #3119, #3131, #3140)
  • Translucent fills β€” fills blended by OpenCV raise ValueError if the rows of the writable scene may overlap in memory. (#3104, #3112)
  • Logging β€” loggers follow the moved modules. Update configurations that name individual loggers. (#3128, #3142)
  • Overlap filter β€” sv.OverlapFilter.NONE and "none" still work as aliases of KEEP_ALL. Its .value is now "keep_all", its .name is "KEEP_ALL", and list() returns the new value. (#3091)
  • Native oriented-box parsing β€” a response with class_heading that passes native validation is parsed natively. Its xyxy gives the axis-aligned bounds of obb, and data gains xyxyxyxy, heading, detection_id and native_obb. (#2835, #3156)
  • Masks and NMS β€” lower memory in compact and dense mask NMS and NMM, tighter compact-mask conversion, and run-space resizing of compact RLE input. RLE resizing joins adjacent sampled runs and expands columns in blocks, while sparse compact-mask unions can stay in run space. On NumPy 2.0 or newer, bit-packed boolean mask IoU avoids an extra copy and counts the detection column index toward memory_limit. (#3117, #2886, #3037, #2696, #3159)
  • Heatmaps and mean average recall β€” HeatMapAnnotator.heat_mask updates in place across frames of the same size. Copy it to keep a snapshot. Mean average recall uses more memory to retain matches across size buckets and counts oriented targets with area metadata but no corners as misses. (#3039, #3040)
  • Weighted Box Fusion β€” axis-aligned box fusion is faster and returns bit-for-bit identical results. (#3155)
  • Assets β€” cached files are hashed in chunks. (#3031)
  • Mixed masks β€” In 0.32.3, sv.Detections.merge documented and applied a crop of each dense mask to its xyxy box when merging dense and sv.CompactMask masks. It now keeps every dense-mask pixel, so mask area and mask overlap can grow, and sv.DetectionsSmoother.get_smoothed_detections no longer loses a track's mask outside its averaged box. (#3164)

πŸ—‘οΈ Deprecated

  • sv.box_non_max_suppression, sv.mask_non_max_suppression, sv.oriented_box_non_max_suppression, their three soft variants and sv.box_weighted_box_fusion, in favour of sv.Detections.with_nms, with_soft_nms and with_fusion. Removal in 0.36.0. (#3091)
  • Old detection, image, video, drawing, file and iou_and_nms import paths. Removal in 0.36.0. (#3091, #3128, #3142)
  • oriented-object-detection responses without class_heading and responses with class_heading that fail native validation warn as of 0.33.0 and parse as ordinary detections. In 0.36.0, the fallback for missing class_heading is removed, and responses that fail native validation raise ValueError. (#3156)
  • NMS, Soft-NMS and NMM warn about NaN confidence as of 0.33.0. NMS and NMM return the same results as 0.32.3. Soft-NMS results can differ only because of the fix that selects the highest current score at each Gaussian Soft-NMS step (#3098). Remove or replace NaN scores to avoid ValueError from 0.36.0. (#3164)

❌ Removed

  • Positional overlap_metric and mask_dimension of sv.mask_non_max_merge (warned since 0.30.0). (#3154)
  • The mask_dimension keyword of sv.mask_non_max_merge (deprecated in 0.30.0 and ignored since). (#3154)
  • Dict-of-images input to sv.DetectionDataset (deprecated since 0.30.0). Pass a list of image paths. (#3154)

πŸ”§ Fixed

  • Annotators β€” key point ellipse drawing matches between opaque BGRA and BGR scenes, and halo coverage on grayscale scenes follows the luminance of the colour mask. The OpenCV-free backend can decode non-interlaced 16-bit colour PNG icons at full precision before rounding to 8 bits. (#3147)
  • Drawing β€” helpers draw on non-contiguous views, and BGRA text preserves descenders and mirrored text. (#3102, #3113, #3115)
  • Annotator memory β€” several annotators and sv.JSONSink no longer copy more than they need. (#3104, #3105)
  • Annotators and colors β€” corner line endpoints stop at the opposite edge of small boxes, and sv.Color.from_hex rejects repeated #. (#3095, #3108)
  • Datasets β€” Pascal VOC export keeps the exported polygons of a multi-part mask in one object. Parts whose contours have fewer than three points are still left out when other parts yield polygons. (#3096)
  • Detection and tracking β€” Gaussian Soft-NMS selects by current score, DetectionsSmoother handles mixed masks, and sv.LineZone accepts class names without class ids. (#3098, #3107, #3076)
  • Utilities β€” sv.scale_image recovers whole sizes lost to multiplication rounding. Gemini parsing returns integer class ids for empty results, and the NumPy cv2.mean fallback matches OpenCV. (#3089, #3160, #3139, #2955)
  • Video and drawing backends β€” the PyAV fallback raises RuntimeError from recorded decoder errors while seeking, reading or skipping in sv.get_video_frames_generator and sv.process_video. With OpenCV 5.0, negative text_scale raises ValueError in sv.draw_text and annotators that draw labels through OpenCV. (#3160)
  • Inference responses β€” sv.Detections.from_inference returns empty detections for a response without predictions instead of raising KeyError. (#3156)
  • Sliced inference β€” sv.InferenceSlicer drops tracker IDs when only some non-empty tiles supply them and warns once per instance. Windowed raster results omit metadata["source_image"]. (#3159)
  • Detection overlap and masks β€” mask and oriented-box NMS, NMM and Soft-NMS keep distinct integer class IDs above 2**53 separate. Mask IoU and mask NMS/NMM preserve exact union counts in float32 through 2**24 pixels per mask and use float64 beyond that. sv.Detections.from_inference(..., compact_masks=True) preserves image-sized RLE masks with a side longer than 32768 pixels by decoding them densely and compacting the full frame. (#3159)
  • Detection overlap β€” sv.Detections.with_nmm merges flat (N, 8) oriented corners and preserves their layout. (#3164)
  • Compact masks β€” sv.CompactMask raises IndexError for multidimensional row index arrays or nested lists. sv.CompactMask.from_coco_rle raises ValueError for fractional uncompressed counts and still accepts whole-number floats such as 4.0. (#3164)

πŸ† Contributors

Thanks to everyone who worked on this release.

  • Kari Pikkarainen (@kari-pikkarainen, LinkedIn) β€” added joint angles, improved drawing on views and BGRA scenes, and reduced copying in sv.JSONSink.
  • Ahmet Mert Γ–zacar (@AhmetMert01, LinkedIn) β€” sorted YOLO image loading, fixed mixed masks in DetectionsSmoother and added type checking to tests.
  • acedia (@Acedia11) β€” sped up compact masks, annotators, the OpenCV-free backend and metrics.
  • A Aswanth Raj (@aswanth-07, LinkedIn) β€” fixed small-box corners and multi-part Pascal VOC export.
  • Ishan Mani Singh - CODE7X (@Irresistible-Ishan, LinkedIn) β€” tightened hex color parsing and documented the helpers.
  • josiahhopkins (@josiahhopkins) β€” added coord_transform to occupancy_ratio and strict typing to oriented-box tests.
  • Jyotishman Das (@rishi02102017, LinkedIn) β€” added DetectionDataset.empty and .add.
  • NIKHILA (@Nikhila-Dhevi-R, LinkedIn) β€” added the normal and gradient map annotators.
  • Caio Viotti (@cfviotti, LinkedIn) β€” preserved native oriented geometry and heading.
  • MTaraszewski (@MTaraszewski) β€” kept resized RLE masks compact and added COCO RLE export.
  • Sajjad Pakdamansavoji (@SajjadPSavoji, LinkedIn) β€” counted dense mask overlaps on packed bits.
  • Leandro Rosemberg (@lrosemberg) β€” reduced compact mask NMM memory.
  • Bindu Bhargava Reddy Chintam (@bhargavchintam, LinkedIn) β€” set the Pillow 10.4 floor.
  • Nirlep Makwana (@nirlep1204) β€” fixed Gaussian Soft-NMS selection.
  • kevin (@kevin9327) β€” matched the mean fallback to OpenCV.
  • Christopher Pruijsen (@cpruijsen, LinkedIn) β€” fixed scale_image sizes.
  • Shubham Goel (@shubhamgoel27) β€” fixed line zones for detections without class ids.
  • Vlad Voropaev (@voropaevv, LinkedIn) β€” made asset checksums stream.
  • J Murel (@jmurel) β€” fixed dead documentation links.
  • Jirka Borovec (@Borda, LinkedIn) β€” maintained the release, sped up detection fusion and added its group return option, preserved legacy oriented-box parsing, and worked on theme packages and semantic segmentation.

Thanks also to @Connoravila1 for the packed-bit overlap approach.

Automated contributions from @dependabot, Claude and @claude[bot], @pre-commit-ci[bot], Codex, and Copilot Autofix.


Full changelog: 0.32.3...0.33.0

Drafted by /oss:release, an AI skill in AI Rig. If it saved you time, a ⭐ helps others find it.