import polygon_to_mask from supervision

This commit is contained in:
kirilllzaitsev 2023-07-26 12:36:49 +02:00
parent 6dde70eb0c
commit 277a9cb6b9
2 changed files with 1 additions and 7 deletions

View File

@ -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]]: