From 981bcc71eae34041387db69e470dc2268130288e Mon Sep 17 00:00:00 2001 From: Hardik Dava <39372750+hardikdava@users.noreply.github.com> Date: Fri, 18 Aug 2023 12:48:09 +0200 Subject: [PATCH] Update coco.py --- supervision/dataset/formats/coco.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/supervision/dataset/formats/coco.py b/supervision/dataset/formats/coco.py index 6f2e3d0f..1159ceb4 100644 --- a/supervision/dataset/formats/coco.py +++ b/supervision/dataset/formats/coco.py @@ -200,9 +200,9 @@ def save_coco_annotations( coco_categories = classes_to_coco_categories(classes=classes) image_id, annotation_id = 1, 1 - for image_name, image in images.items(): + for image_path, image in images.items(): image_height, image_width, _ = image.shape - + image_name =f"{Path(image_path).stem}{Path(image_path).suffix}" coco_image = { "id": image_id, "license": 1, @@ -213,7 +213,7 @@ def save_coco_annotations( } coco_images.append(coco_image) - detections = annotations[image_name] + detections = annotations[image_path] coco_annotation, annotation_id = detections_to_coco_annotations( detections=detections,