Skip to content

Commit

Permalink
Fix: LuxonisDataset Converter - bbox computation (#70)
Browse files Browse the repository at this point in the history
Fix: computation of x, y, w, h
  • Loading branch information
HonzaCuhel authored Nov 3, 2024
1 parent 749696d commit 77be96e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions datadreamer/utils/luxonis_dataset_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}

Expand Down
6 changes: 3 additions & 3 deletions media/coverage_badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 77be96e

Please sign in to comment.