Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

feat: Support Yolo v8 for import to LS #286

Merged
merged 1 commit into from
May 2, 2024
Merged
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 @@ -111,7 +111,9 @@ 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()
values = line.split()
label_id, x, y, width, height = values[0:5]
score = float(values[5]) if len(values) >= 6 else None
x, y, width, height = (
float(x),
float(y),
Expand All @@ -135,6 +137,8 @@ def convert_yolo_to_ls(
"original_width": image_width,
"original_height": image_height,
}
if score:
item["score"] = score
task[out_type][0]['result'].append(item)

tasks.append(task)
Expand Down
Loading