From c2018fa1ba36f0917fbb510a5830ba0c08cf3188 Mon Sep 17 00:00:00 2001 From: Mayank Agarwal Date: Tue, 25 Jul 2023 16:31:26 +0530 Subject: [PATCH] increment polygon --- supervision/dataset/formats/pascal_voc.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/supervision/dataset/formats/pascal_voc.py b/supervision/dataset/formats/pascal_voc.py index b76c3c1b..f4c55733 100644 --- a/supervision/dataset/formats/pascal_voc.py +++ b/supervision/dataset/formats/pascal_voc.py @@ -109,9 +109,7 @@ def detections_to_pascal_voc( for polygon in polygons: xyxy = polygon_to_xyxy(polygon=polygon) next_object = object_to_pascal_voc( - xyxy=xyxy, - name=name, - polygon=polygon, + xyxy=xyxy, name=name, polygon=polygon, ) annotation.append(next_object) else: @@ -149,8 +147,6 @@ def load_pascal_voc_annotations( bbox = obj.find("bndbox") - # 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 x1 = int(bbox.find("xmin").text) y1 = int(bbox.find("ymin").text) x2 = int(bbox.find("xmax").text) @@ -158,6 +154,8 @@ def load_pascal_voc_annotations( xyxy.append([x1, y1, x2, y2]) + # 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 detections = Detections(xyxy=xyxy)