Skip to content

supervision-0.30.7

Latest

Choose a tag to compare

@Borda Borda released this 04 Oct 12:41

v0.30.7 β€” Fewer hangs, truer mAP

Eight bug fixes: video processing, dataset export, mAP and Transformers loading no longer fail or hang silently.

  • process_video raises on a failed write instead of hanging.
  • MeanAveragePrecision matches pycocotools where recall lands on a threshold.
  • Dataset export can write back into the folder the images came from.
  • from_transformers reads semantic output that includes per-pixel scores.

Drop-in upgrade, no code changes. Stored mAP baselines may shift slightly.

✨ Spotlights / highlights

sv.process_video stops hanging (#2636)

A frame the writer rejects, or a callback that returns None, now raises instead of blocking forever.

import supervision as sv

def callback(frame, index):
    sv.BoxAnnotator().annotate(frame.copy(), detections)  # forgot `return`

sv.process_video("in.mp4", "out.mp4", callback)
# before: hangs after `writer_buffer` frames
# now:    TypeError naming the frame

sv.metrics.MeanAveragePrecision matches pycocotools (#2638)

Recall thresholds and recall are float64, as in COCOeval. A class whose recall lands exactly on a threshold used to score slightly high: mAP@50 0.7470 instead of 0.7415 in one case.

Datasets re-export in place (#2637)

ds = sv.DetectionDataset.from_coco(
    images_directory_path="data",
    annotations_path="data/_annotations.coco.json",
)
ds.as_coco(
    images_directory_path="data",
    annotations_path="data/_annotations.coco.json",
)
# before: shutil.SameFileError
# now:    annotations rewritten, images left in place

Transformers semantic output with scores (#2643)

sv.Detections.from_transformers accepts results from return_segmentation_scores=True instead of raising KeyError: 'segments_info'.

πŸ”„ Migration guide

No migration required for this release.

πŸ“ Notable changes

πŸ”§ Fixed

  • sv.process_video raises RuntimeError("Writer thread raised: ...") or TypeError instead of hanging when a frame cannot be written or a callback returns None. (#2636)
  • sv.metrics.MeanAveragePrecision computes IoU and recall thresholds, IoUs and recall in float64, matching pycocotools. mAP changes only for classes whose recall lands exactly on one of the 101 thresholds, by up to about 0.007 mAP@50. (#2638)
  • sv.DetectionDataset.as_yolo, as_pascal_voc, as_coco, as_createml and as_labelme export into the folder the images were loaded from instead of failing with shutil.SameFileError. (#2637)
  • sv.Detections.from_transformers accepts semantic segmentation output with segmentation_scores; per-pixel scores stay out of per-detection confidence. (#2643)
  • sv.crop_image clips finite crop coordinates outside the 32-bit integer range to the image bounds, instead of wrapping to an empty crop. (#2642)
  • sv.DetectionDataset.as_labelme gives disconnected components of one mask a shared group ID, so from_labelme rebuilds one detection. (#2640)
  • sv.DetectionDataset.as_labelme, as_yolo and as_pascal_voc export in-memory grayscale (height, width) images. (#2641)
  • sv.KeyPoints.with_nms keeps skeletons with zero joints instead of raising a zero-size reduction error. (#2639)

πŸ† Contributors

  • kevin (@kevin9327) β€” stopped process_video hangs, made mAP match pycocotools, and fixed in-place dataset export.
  • Marvel Harisson (@INo-xious, LinkedIn) β€” fixed LabelMe grouping, grayscale dataset export and keypoint NMS.
  • NIKHIL (@Nikhi00718) β€” fixed crop_image clipping and Transformers semantic output loading.

Full changelog: 0.30.6...0.30.7