From f372fb69e98ce82a345cdbe1aba254fbad23e81d Mon Sep 17 00:00:00 2001 From: Mayank Agarwal Date: Tue, 1 Aug 2023 23:29:09 +0530 Subject: [PATCH] reformat according to makefile --- supervision/dataset/formats/pascal_voc.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/supervision/dataset/formats/pascal_voc.py b/supervision/dataset/formats/pascal_voc.py index 928a13dd..dae48a49 100644 --- a/supervision/dataset/formats/pascal_voc.py +++ b/supervision/dataset/formats/pascal_voc.py @@ -224,7 +224,7 @@ def detections_from_xml_obj( y2 = int(bbox.find("ymax").text) xyxy.append([x1, y1, x2, y2]) - + with_masks = obj.find("polygon") is not None with_masks = force_masks if force_masks else with_masks @@ -237,12 +237,12 @@ def detections_from_xml_obj( ) masks.append(mask_from_polygon) - xyxy = np.array(xyxy) if len(xyxy) > 0 else np.empty((0, 4))] - + xyxy = np.array(xyxy) if len(xyxy) > 0 else np.empty((0, 4)) + # Correction functions for VOC XML format as bounding boxes in VOC XML start at (1,1) not (0,0). Refer: # https://github.com/roboflow/supervision/issues/144 xyxy = np.array(xyxy) - 1 - + for k in set(class_names): if k not in extended_classes: extended_classes.append(k) @@ -259,7 +259,6 @@ def detections_from_xml_obj( return annotation, extended_classes - def parse_polygon_points(polygon: Element) -> List[List[int]]: polygon_points = [] coords = polygon.findall(".//*")