Skip to content

Commit

Permalink
fix: fix #97
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-Shen committed Apr 22, 2024
1 parent f6d39bb commit 8db39c1
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions labelu/internal/common/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,13 @@ def convert_to_coco(
polygon_area = _polygonArea(x_coordinates, y_coordinates)
elif tool.get("toolName") == "rectTool":
# rect
if (
tool_result.get("x")
and tool_result.get("y")
and tool_result.get("width")
and tool_result.get("height")
):
bbox.append(tool_result.get("x"))
bbox.append(tool_result.get("y"))
bbox.append(tool_result.get("width"))
bbox.append(tool_result.get("height"))
x = tool_result.get("x")
y = tool_result.get("y")
width = tool_result.get("width")
height = tool_result.get("height")

if x is not None and y is not None and width is not None and height is not None:
bbox.extend([x, y, width, height])
polygon_area = tool_result.get("width", 0) * tool_result.get(
"height", 0
)
Expand Down

0 comments on commit 8db39c1

Please sign in to comment.