@@ -59,6 +59,7 @@ class Format(Enum):
59
59
YOLO_WITH_IMAGES = 14
60
60
COCO_WITH_IMAGES = 15
61
61
YOLO_OBB_WITH_IMAGES = 16
62
+ BRUSH_TO_COCO = 17
62
63
63
64
def __str__ (self ):
64
65
return self .name
@@ -167,6 +168,12 @@ class Converter(object):
167
168
"format expected by NVIDIA NeMo models." ,
168
169
"link" : "https://labelstud.io/guide/export.html#ASR-MANIFEST" ,
169
170
"tags" : ["speech recognition" ],
171
+ },
172
+ Format .BRUSH_TO_COCO : {
173
+ "title" : "Brush labels to COCO" ,
174
+ "description" : "Export your brush labels as COCO format for segmentation tasks. Converts RLE encoded masks to COCO polygons." ,
175
+ "link" : "https://labelstud.io/guide/export.html#COCO" ,
176
+ "tags" : ["image segmentation" , "brush annotations" ],
170
177
},
171
178
}
172
179
@@ -293,6 +300,19 @@ def convert(self, input_data, output_data, format, is_dir=True, **kwargs):
293
300
upload_dir = self .upload_dir ,
294
301
download_resources = self .download_resources ,
295
302
)
303
+ elif format == Format .BRUSH_TO_COCO :
304
+ items = (
305
+ self .iter_from_dir (input_data )
306
+ if is_dir
307
+ else self .iter_from_json_file (input_data )
308
+ )
309
+ from label_studio_sdk .converter .exports .brush_to_coco import convert_to_coco
310
+ image_dir = kwargs .get ("image_dir" )
311
+ convert_to_coco (
312
+ items ,
313
+ output_data ,
314
+ output_image_dir = image_dir
315
+ )
296
316
297
317
def _get_data_keys_and_output_tags (self , output_tags = None ):
298
318
data_keys = set ()
@@ -376,6 +396,7 @@ def _get_supported_formats(self):
376
396
):
377
397
all_formats .remove (Format .BRUSH_TO_NUMPY .name )
378
398
all_formats .remove (Format .BRUSH_TO_PNG .name )
399
+ all_formats .remove (Format .BRUSH_TO_COCO .name )
379
400
if not (
380
401
("Audio" in input_tag_types or "AudioPlus" in input_tag_types )
381
402
and "TextArea" in output_tag_types
0 commit comments