diff --git a/docs/annotation/voc.md b/docs/annotation/voc.md deleted file mode 100644 index a6178bf1..00000000 --- a/docs/annotation/voc.md +++ /dev/null @@ -1,3 +0,0 @@ -## detections_to_voc_xml - -:::supervision.annotation.voc.detections_to_voc_xml \ No newline at end of file diff --git a/docs/dataset/core.md b/docs/dataset/core.md new file mode 100644 index 00000000..d3c80720 --- /dev/null +++ b/docs/dataset/core.md @@ -0,0 +1,8 @@ +!!! warning + + `Dataset` API is still fluid and may change. If you use Dataset in your project until further notice, freeze the + `supervision` version in your `requirements.txt`. + +## Dataset + +:::supervision.dataset.core.Dataset \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 14d963f7..7dda7486 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -24,19 +24,19 @@ extra: nav: - Home: index.md - API reference: - - Video: video.md - Detection: - Core: detection/core.md - Annotate: detection/annotate.md - Utils: detection/utils.md - Tools: - Polygon Zone: detection/tools/polygon_zone.md + - Dataset: + - Core: dataset/core.md - Draw: - Utils: draw/utils.md - - Annotations: - - Pascal VOC XML: annotation/voc.md - Notebook: - Utils: notebook/utils.md + - Video: video.md - Changelog: changelog.md theme: diff --git a/supervision/dataset/core.py b/supervision/dataset/core.py index ff33c6a3..c72faf7f 100644 --- a/supervision/dataset/core.py +++ b/supervision/dataset/core.py @@ -31,6 +31,21 @@ class Dataset: minimum_detection_area_percentage: float = 0.0, maximum_detection_area_percentage: float = 1.0, ) -> None: + """ + Exports the dataset to PASCAL VOC format. This method saves the images and their corresponding annotations in + PASCAL VOC format, which consists of XML files. The method allows filtering the detections based on their area + percentage. + + Args: + images_directory_path (Optional[str]): The path to the directory where the images should be saved. + If not provided, images will not be saved. + annotations_directory_path (Optional[str]): The path to the directory where the annotations in + PASCAL VOC format should be saved. If not provided, annotations will not be saved. + minimum_detection_area_percentage (float): The minimum percentage of detection area relative to + the image area for a detection to be included. + maximum_detection_area_percentage (float): The maximum percentage of detection area relative to + the image area for a detection to be included. + """ if images_directory_path: images_path = Path(images_directory_path) images_path.mkdir(parents=True, exist_ok=True) diff --git a/supervision/dataset/formats/pascal_voc.py b/supervision/dataset/formats/pascal_voc.py index 3f6e69bc..c95bbc35 100644 --- a/supervision/dataset/formats/pascal_voc.py +++ b/supervision/dataset/formats/pascal_voc.py @@ -12,7 +12,6 @@ from supervision.detection.utils import ( polygon_to_xyxy, ) - EPSILON = 0.05 diff --git a/supervision/file.py b/supervision/file.py index 56746d4d..e10f6bc7 100644 --- a/supervision/file.py +++ b/supervision/file.py @@ -1,5 +1,5 @@ from pathlib import Path -from typing import Union, Optional, List +from typing import List, Optional, Union def write_text_to_file(content: str, output_path: str) -> None: