From 4e874fbebd3eada470a35aec9c74f2f71232db77 Mon Sep 17 00:00:00 2001 From: Tarun Bommawar Date: Thu, 28 May 2026 15:06:51 -0400 Subject: [PATCH 1/2] docs: clarify MaskAnnotator mask requirements --- docs/detection/annotators.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/detection/annotators.md b/docs/detection/annotators.md index 651a62232..1c649f5c5 100644 --- a/docs/detection/annotators.md +++ b/docs/detection/annotators.md @@ -194,6 +194,15 @@ Annotators accept detections and apply box or mask visualizations to the detecti ) ``` + !!! note + + `MaskAnnotator` expects `detections.mask` to contain instance segmentation + masks. Each mask should match the height and width of the image passed + to `annotate`. If your model returns framework-specific results, convert + them to `sv.Detections` first, for example with + `sv.Detections.from_ultralytics(...)` or + `sv.Detections.from_inference(...)`. +
![mask-annotator-example](https://media.roboflow.com/supervision-annotator-examples/mask-annotator-example-purple.png){ align=center width="800" } From 7bfddcda7e728b6238727f28a35b556f5bda5496 Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Fri, 29 May 2026 10:11:34 +0200 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/detection/annotators.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/detection/annotators.md b/docs/detection/annotators.md index 1c649f5c5..60ba3dedf 100644 --- a/docs/detection/annotators.md +++ b/docs/detection/annotators.md @@ -197,10 +197,11 @@ Annotators accept detections and apply box or mask visualizations to the detecti !!! note `MaskAnnotator` expects `detections.mask` to contain instance segmentation - masks. Each mask should match the height and width of the image passed - to `annotate`. If your model returns framework-specific results, convert - them to `sv.Detections` first, for example with - `sv.Detections.from_ultralytics(...)` or + masks aligned to the image passed to `annotate`. For dense masks, provide a + boolean array of shape `(N, H, W)` where `(H, W)` matches the image height + and width (it also accepts `sv.CompactMask`). If your model returns + framework-specific results, convert them to `sv.Detections` first, for + example with `sv.Detections.from_ultralytics(...)` or `sv.Detections.from_inference(...)`.