Update coco.py

This commit is contained in:
Hardik Dava 2023-08-18 12:48:09 +02:00 committed by GitHub
parent 1d42992e6b
commit 981bcc71ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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,