From a88eff868e847da7b9e513e2726352e7f05f91c7 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Thu, 23 Mar 2023 14:41:03 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=96=20improve=20documentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/detection/annotate.md | 3 +++ docs/{detection_core.md => detection/core.md} | 0 .../utils.md} | 0 mkdocs.yml | 5 ++-- supervision/detection/annotate.py | 25 ++++++++++--------- 5 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 docs/detection/annotate.md rename docs/{detection_core.md => detection/core.md} (100%) rename docs/{detection_utils.md => detection/utils.md} (100%) diff --git a/docs/detection/annotate.md b/docs/detection/annotate.md new file mode 100644 index 00000000..fcebdec7 --- /dev/null +++ b/docs/detection/annotate.md @@ -0,0 +1,3 @@ +## BoxAnnotator + +:::supervision.detection.annotate.BoxAnnotator \ No newline at end of file diff --git a/docs/detection_core.md b/docs/detection/core.md similarity index 100% rename from docs/detection_core.md rename to docs/detection/core.md diff --git a/docs/detection_utils.md b/docs/detection/utils.md similarity index 100% rename from docs/detection_utils.md rename to docs/detection/utils.md diff --git a/mkdocs.yml b/mkdocs.yml index 9c267275..254e775b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -26,8 +26,9 @@ nav: - API reference: - Video: video.md - Detection: - - Core: detection_core.md - - Utils: detection_utils.md + - Core: detection/core.md + - Annotate: detection/annotate.md + - Utils: detection/utils.md - Draw: - Utils: draw_utils.md - Notebook: notebook.md diff --git a/supervision/detection/annotate.py b/supervision/detection/annotate.py index 29f0fba5..3c74653d 100644 --- a/supervision/detection/annotate.py +++ b/supervision/detection/annotate.py @@ -8,6 +8,19 @@ from supervision.draw.color import Color, ColorPalette class BoxAnnotator: + """ + A class for drawing bounding boxes on an image using detections provided. + + Attributes: + color (Union[Color, ColorPalette]): The color to draw the bounding box, can be a single color or a color palette + thickness (int): The thickness of the bounding box lines, default is 2 + text_color (Color): The color of the text on the bounding box, default is white + text_scale (float): The scale of the text on the bounding box, default is 0.5 + text_thickness (int): The thickness of the text on the bounding box, default is 1 + text_padding (int): The padding around the text on the bounding box, default is 5 + + """ + def __init__( self, color: Union[Color, ColorPalette] = ColorPalette.default(), @@ -17,18 +30,6 @@ class BoxAnnotator: text_thickness: int = 1, text_padding: int = 10, ): - """ - A class for drawing bounding boxes on an image using detections provided. - - Attributes: - color (Union[Color, ColorPalette]): The color to draw the bounding box, can be a single color or a color palette - thickness (int): The thickness of the bounding box lines, default is 2 - text_color (Color): The color of the text on the bounding box, default is white - text_scale (float): The scale of the text on the bounding box, default is 0.5 - text_thickness (int): The thickness of the text on the bounding box, default is 1 - text_padding (int): The padding around the text on the bounding box, default is 5 - - """ self.color: Union[Color, ColorPalette] = color self.thickness: int = thickness self.text_color: Color = text_color