Skip to content

Commit d4a9f53

Browse files
authored
Merge pull request #1171 from Shared-Reality-Lab/fix-dimensions
Fix dimension rounding error
2 parents 9a2466b + e9a4201 commit d4a9f53

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

preprocessors/object-detection-llm/object-detection-llm.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ def normalize_bbox(bbox, width, height):
6161
"""
6262
x1, y1, x2, y2 = bbox
6363
return [
64-
x1 / width,
65-
y1 / height,
66-
x2 / width,
67-
y2 / height
64+
max(0.0, min(x1 / width, 1.0)),
65+
max(0.0, min(y1 / height, 1.0)),
66+
max(0.0, min(x2 / width, 1.0)),
67+
max(0.0, min(y2 / height, 1.0))
6868
]
6969

7070

0 commit comments

Comments
 (0)