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_videoraises on a failed write instead of hanging.MeanAveragePrecisionmatchespycocotoolswhere recall lands on a threshold.- Dataset export can write back into the folder the images came from.
from_transformersreads 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 framesv.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 placeTransformers 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_videoraisesRuntimeError("Writer thread raised: ...")orTypeErrorinstead of hanging when a frame cannot be written or a callback returnsNone. (#2636)sv.metrics.MeanAveragePrecisioncomputes IoU and recall thresholds, IoUs and recall in float64, matchingpycocotools. 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_createmlandas_labelmeexport into the folder the images were loaded from instead of failing withshutil.SameFileError. (#2637)sv.Detections.from_transformersaccepts semantic segmentation output withsegmentation_scores; per-pixel scores stay out of per-detectionconfidence. (#2643)sv.crop_imageclips finite crop coordinates outside the 32-bit integer range to the image bounds, instead of wrapping to an empty crop. (#2642)sv.DetectionDataset.as_labelmegives disconnected components of one mask a shared group ID, sofrom_labelmerebuilds one detection. (#2640)sv.DetectionDataset.as_labelme,as_yoloandas_pascal_vocexport in-memory grayscale(height, width)images. (#2641)sv.KeyPoints.with_nmskeeps skeletons with zero joints instead of raising a zero-size reduction error. (#2639)
🏆 Contributors
- kevin (@kevin9327) — stopped
process_videohangs, made mAP matchpycocotools, and fixed in-place dataset export. - Marvel Harisson (@INo-xious, LinkedIn) — fixed LabelMe grouping, grayscale dataset export and keypoint NMS.
- NIKHIL (@Nikhi00718) — fixed
crop_imageclipping and Transformers semantic output loading.
Full changelog: 0.30.6...0.30.7