From 77be96effc9d6598f690ece3beb2887042e27ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C4=8Cuhel?= <79118988+HonzaCuhel@users.noreply.github.com> Date: Sun, 3 Nov 2024 21:48:09 +0100 Subject: [PATCH] Fix: LuxonisDataset Converter - bbox computation (#70) Fix: computation of x, y, w, h --- datadreamer/utils/luxonis_dataset_converter.py | 14 +++++++------- media/coverage_badge.svg | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/datadreamer/utils/luxonis_dataset_converter.py b/datadreamer/utils/luxonis_dataset_converter.py index 8462ea1..5cde762 100644 --- a/datadreamer/utils/luxonis_dataset_converter.py +++ b/datadreamer/utils/luxonis_dataset_converter.py @@ -109,18 +109,18 @@ def dataset_generator(): if "boxes" in data[image_path]: boxes = data[image_path]["boxes"] for box, label in zip(boxes, labels): - x, y, w, h = box[0], box[1], box[2] - box[0], box[3] - box[1] - x = max(0, x) - y = max(0, y) + x, y = max(0, box[0] / width), max(0, box[1] / height) + w = min(box[2] / width - x, 1 - x) + h = min(box[3] / height - y, 1 - y) yield { "file": image_full_path, "annotation": { "class": class_names[label], "type": "boundingbox", - "x": x / width, - "y": y / height, - "w": w / width, - "h": h / height, + "x": x, + "y": y, + "w": w, + "h": h, }, } diff --git a/media/coverage_badge.svg b/media/coverage_badge.svg index 6c15cac..179c6a1 100644 --- a/media/coverage_badge.svg +++ b/media/coverage_badge.svg @@ -9,13 +9,13 @@ - + coverage coverage - 75% - 75% + 63% + 63%