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

feat: Import yolo polygons. Includes conversion from bboxes to polygons if user is wishing to transition dataset. #257

Closed
wants to merge 19 commits into from

Conversation

carbaro
Copy link

@carbaro carbaro commented Nov 10, 2023

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:

  • datasets split in subdirectories (e.g. train/val with images/labels each)
  • prediction confidence values with the option --out_type
  • polygonises bboxes automatically
  • implements test where test data is polygonised and converted into JSON

@github-actions github-actions bot added the feat label Nov 10, 2023
Copy link

@obrienwr obrienwr left a 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):
Copy link

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:
Copy link

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
Copy link

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

@makseq makseq changed the title feat: Import yolo-seg labels. Includes conversion from bboxes to polygons if user is wishing to transition dataset. feat: Import yolo polygons. Includes conversion from bboxes to polygons if user is wishing to transition dataset. Jun 4, 2024
@makseq
Copy link
Member

makseq commented Jun 4, 2024

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:
https://github.com/HumanSignal/label-studio-sdk/issues

@makseq makseq closed this Jun 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants