-
Notifications
You must be signed in to change notification settings - Fork 130
fix: Only export bboxes and polygon segmentations to YOLO #196
Conversation
label_studio_converter/converter.py
Outdated
@@ -900,6 +900,10 @@ def _get_labels(self): | |||
category_name_to_id = dict() | |||
|
|||
for name, info in self._schema.items(): | |||
# ignore labels that are not bounding boxes or segmentations |
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.
Sorry for a long review.
- We have to add
rectangle
andpolygon
too - https://labelstud.io/tags/rectangle.html _get_labels
is used in COCO also, COCO supports another set of 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.
This means that there should be a different _get_labels procedure for YOLO and for COCO, right? Because they support different kinds of 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.
I would pass all supported types this way
_get_labels(types=['rectanglelabels', ...])
and used different calls in YOLO and COCO.
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.
One more question - if _get_labels returns nothing, will the image be included to export?
label_studio_converter/converter.py
Outdated
@@ -900,6 +900,10 @@ def _get_labels(self): | |||
category_name_to_id = dict() | |||
|
|||
for name, info in self._schema.items(): | |||
# ignore labels that are not bounding boxes or segmentations |
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 would pass all supported types this way
_get_labels(types=['rectanglelabels', ...])
and used different calls in YOLO and COCO.
label_studio_converter/converter.py
Outdated
@@ -900,6 +900,10 @@ def _get_labels(self): | |||
category_name_to_id = dict() | |||
|
|||
for name, info in self._schema.items(): | |||
# ignore labels that are not bounding boxes or segmentations |
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.
One more question - if _get_labels returns nothing, will the image be included to export?
Sorry for the late response, seems like I have the notifications disabled. To your question: When exporting empty annotations, the images are still exported. So I assume that an empty return value of _get_labes still leads to an export. I now changed it such that the label types are only filtered by 'rectangleLabels' and 'polygonLabels' for YOLO exports. |
Seems like all threads are solved. Can we merge? |
Unfortunately, this fix doesn't work for this case:
Check out this annotations: for each rectangle and polygon we will have a region with labels, but without
|
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: |
Fix issue HumanSignal/label-studio#3556
Only allow specific types of annotations to be added to YOLO.
Otherwise metadata classes are added to classes.txt.
Both RectangleLabels and PolygonLabels are added, as YOLO export now also supports segmentation.
Additionally, it would break COCO exports to only allow RectangleLabels.