-
Notifications
You must be signed in to change notification settings - Fork 130
feat: Import yolo polygons. Includes conversion from bboxes to polygons if user is wishing to transition dataset. #257
Conversation
…s files and asserts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't get to test this out too much, Just thought I'd leave a few comments from issues that came up while using this. Thanks for the help!
[images.append(f'{dir_pth}/{img}') for img in dir_imgs] | ||
if len(dir_lbls) > 0: | ||
[labels.append(f'{dir_pth}/{lbl}') for lbl in dir_lbls] | ||
for image, label in zip(images, labels): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no certainty that the images
and labels
lists will be in the same order, something like for image, label in zip(sorted(images), sorted(labels))
does the trick.
# verify if current labels are boxes | ||
# scan labels list for first non-empty label, peek contents, determine label type | ||
for label in labels: | ||
with open(labels[0]) as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be label
not labels[0]
else: | ||
break # non-empty label found | ||
logger.info(f'sample label: {sample_lbl}') | ||
if len(sample_lbl) < 7: # Polygons expected to consist of 7 items. At least three x,y pairs + class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could be wrong here, but I believe that sample_lbl
will contain a list of strings, each one being the line of the label file (where lines are separate objects). To test whether the sample label has less than 7 fields you should test something like if len(sample_lbl[0].split(' ')) < 7
After careful consideration, we’ve determined that this is more of an improvement than a critical bug. Additionally, it seems to be an outdated request and hasn’t garnered much interest from the community. For these reasons, we will be closing this issue. We will continue developing the converter library as a part of Label Studio SDK. We appreciate your understanding and encourage you to submit your feedback, questions and suggestions here: |
Hi
This PR seamlessly integrates with the current yolo.py imports module.
Based on the yolo_type option, it modifies the content of the task json correspondingly.
Further, it allows: