From 277a9cb6b9d3d073b1232e167b3edfddebeee696 Mon Sep 17 00:00:00 2001 From: kirilllzaitsev Date: Wed, 26 Jul 2023 12:36:49 +0200 Subject: [PATCH] import polygon_to_mask from supervision --- supervision/dataset/formats/pascal_voc.py | 8 +------- .../formats/{test_pascal.py => test_pascal_voc.py} | 0 2 files changed, 1 insertion(+), 7 deletions(-) rename test/dataset/formats/{test_pascal.py => test_pascal_voc.py} (100%) diff --git a/supervision/dataset/formats/pascal_voc.py b/supervision/dataset/formats/pascal_voc.py index 8f3fb090..8cc3cef2 100644 --- a/supervision/dataset/formats/pascal_voc.py +++ b/supervision/dataset/formats/pascal_voc.py @@ -9,7 +9,7 @@ import numpy as np from supervision.dataset.utils import approximate_mask_with_polygons from supervision.detection.core import Detections -from supervision.detection.utils import polygon_to_xyxy +from supervision.detection.utils import polygon_to_mask, polygon_to_xyxy from supervision.utils.file import list_files_with_extensions @@ -210,12 +210,6 @@ def load_pascal_voc_annotations( return classes, images, annotations -def polygon_to_mask(polygon: np.ndarray, resolution_wh: Tuple[int, int]) -> np.ndarray: - mask = np.zeros(resolution_wh, dtype=np.uint8) - cv2.fillPoly(mask, pts=[polygon], color=1) - return mask - - def load_pascal_voc_annotations_v1( annotation_path: str, ) -> Tuple[str, Detections, List[str]]: diff --git a/test/dataset/formats/test_pascal.py b/test/dataset/formats/test_pascal_voc.py similarity index 100% rename from test/dataset/formats/test_pascal.py rename to test/dataset/formats/test_pascal_voc.py