From e7c242bdd47f2ca12fd6a91c5f3cde49acc99cd2 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Fri, 6 Oct 2023 20:51:31 +0200 Subject: [PATCH] Update annotators in docs and code --- docs/annotators.md | 133 ++++++++++++++++++++------------- supervision/annotators/core.py | 4 +- 2 files changed, 81 insertions(+), 56 deletions(-) diff --git a/docs/annotators.md b/docs/annotators.md index 2fb1ccee..dc4d956f 100644 --- a/docs/annotators.md +++ b/docs/annotators.md @@ -19,48 +19,6 @@ -=== "Mask" - - ```python - >>> import supervision as sv - - >>> image = ... - >>> detections = sv.Detections(...) - - >>> mask_annotator = sv.MaskAnnotator() - >>> annotated_frame = mask_annotator.annotate( - ... scene=image.copy(), - ... detections=detections - ... ) - ``` - -
- - ![mask-annotator-example](https://media.roboflow.com/supervision-annotator-examples/mask-annotator-example.png){ align=center width="800" } - -
- -=== "Ellipse" - - ```python - >>> import supervision as sv - - >>> image = ... - >>> detections = sv.Detections(...) - - >>> ellipse_annotator = sv.EllipseAnnotator() - >>> annotated_frame = ellipse_annotator.annotate( - ... scene=image.copy(), - ... detections=detections - ... ) - ``` - -
- - ![ellipse-annotator-example](https://media.roboflow.com/supervision-annotator-examples/ellipse-annotator-example.png){ align=center width="800" } - -
- === "BoxCorner" ```python @@ -82,6 +40,27 @@ +=== "BoxMaskAnnotator" + + ```python + >>> import supervision as sv + + >>> image = ... + >>> detections = sv.Detections(...) + + >>> box_mask_annotator = sv.BoxMaskAnnotator() + >>> annotated_frame = box_mask_annotator.annotate( + ... scene=image.copy(), + ... detections=detections + ... ) + ``` + +
+ + ![box-mask-annotator-example](https://media.roboflow.com/supervision-annotator-examples/box-mask-annotator-example.png){ align=center width="800" } + +
+ === "Circle" ```python @@ -103,6 +82,48 @@ +=== "Ellipse" + + ```python + >>> import supervision as sv + + >>> image = ... + >>> detections = sv.Detections(...) + + >>> ellipse_annotator = sv.EllipseAnnotator() + >>> annotated_frame = ellipse_annotator.annotate( + ... scene=image.copy(), + ... detections=detections + ... ) + ``` + +
+ + ![ellipse-annotator-example](https://media.roboflow.com/supervision-annotator-examples/ellipse-annotator-example.png){ align=center width="800" } + +
+ +=== "Mask" + + ```python + >>> import supervision as sv + + >>> image = ... + >>> detections = sv.Detections(...) + + >>> mask_annotator = sv.MaskAnnotator() + >>> annotated_frame = mask_annotator.annotate( + ... scene=image.copy(), + ... detections=detections + ... ) + ``` + +
+ + ![mask-annotator-example](https://media.roboflow.com/supervision-annotator-examples/mask-annotator-example.png){ align=center width="800" } + +
+ === "Label" ```python @@ -170,30 +191,34 @@ :::supervision.annotators.core.BoundingBoxAnnotator -## MaskAnnotator - -:::supervision.annotators.core.MaskAnnotator - -## EllipseAnnotator - -:::supervision.annotators.core.EllipseAnnotator - ## BoxCornerAnnotator :::supervision.annotators.core.BoxCornerAnnotator +## BoxMaskAnnotator + +:::supervision.annotators.core.BoxMaskAnnotator + ## CircleAnnotator :::supervision.annotators.core.CircleAnnotator +## EllipseAnnotator + +:::supervision.annotators.core.EllipseAnnotator + +## MaskAnnotator + +:::supervision.annotators.core.MaskAnnotator + ## LabelAnnotator :::supervision.annotators.core.LabelAnnotator -## TraceAnnotator - -:::supervision.annotators.core.TraceAnnotator - ## BlurAnnotator :::supervision.annotators.core.BlurAnnotator + +## TraceAnnotator + +:::supervision.annotators.core.TraceAnnotator \ No newline at end of file diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 7de9d5d7..3fa26bf8 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -205,8 +205,8 @@ class BoxMaskAnnotator(BaseAnnotator): ... ) ``` - ![bounding-box-annotator-example](https://media.roboflow.com/ - supervision-annotator-examples/bounding-box-annotator-example.png) + ![box-mask-annotator-example](https://media.roboflow.com/ + supervision-annotator-examples/box-mask-annotator-example.png) """ mask_image = scene.copy() for detection_idx in range(len(detections)):