Open saskra opened 1 year ago
It's a little bit unclear: you want to have files with brush masks as numpy arrays and coco export file with polygon coordinates?
No, that would be exactly what is already feasible now. I want both as Numpy or PNG export, but unfortunately that doesn't work for polygons at the moment.
So, you mean you want to convert polygon coordinates to png/numpy images?
Yes, that would be great. In fact, I'm writing myself a function that makes such images and arrays out of the polygons after the COCO export. But I was wondering why this is already offered directly in the GUI for brush labels, but not for polygons.
it's because brush labels are pixel-type labeling, it's stored as RLE image and then decoded to png/numpy. Polygons are just arrays of (x,y) coordinates. However, if you could contribute with your converter from polygons to images/numpy, it would be great :-)
I will try. It might be based on this: https://github.com/WillBrennan/SemanticSegmentation/blob/7646661aa0e05f5c5b087f2aeda3faff42c34e00/semantic_segmentation/dataset.py#L103
It looks well.
I guess you need to replace decode_rle
to yours function here:
https://github.com/heartexlabs/label-studio-converter/blob/master/label_studio_converter/brush.py#L123
Or even it's better to write a new function like decode_from_annotation
.
I am working on the same images in the same project with both polygon and more detailed brush masks, which I would like to export and import into Python in the easiest way possible. Right now I'm working on extracting the information I need from the COCO export. However, a welcome simplification for me would be to be able to export both types of labels together with one click as PNG images or even better as Numpy arrays. Would that be possible?