Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion label_studio_converter/imports/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,15 @@ def convert_yolo_to_ls(
# convert all bounding boxes to Label Studio Results
lines = file.readlines()
for line in lines:
label_id, x, y, width, height = line.split()
label_id, x, y, width, height = line.split()[:5]
conf = line.split()[-1] if out_type == 'predictions' else None
x, y, width, height = (
float(x),
float(y),
float(width),
float(height),
)
conf = float(conf) if conf is not None else None
item = {
"id": uuid.uuid4().hex[0:10],
"type": "rectanglelabels",
Expand All @@ -134,6 +136,8 @@ def convert_yolo_to_ls(
"original_width": image_width,
"original_height": image_height,
}
if out_type == 'predictions':
item["score"] = conf
task[out_type][0]['result'].append(item)

tasks.append(task)
Expand Down