segment-anything icon indicating copy to clipboard operation
segment-anything copied to clipboard

Convert .json mask file to a polygon format to be read on CVAT

Open JordaoCassiano opened this issue 1 year ago • 1 comments

I ran the amg.py script in a folder containing images and passed the --convert-to-rle parameter. Is it possible to convert the JSON COCO RLE generated into a polygon format that can be read as an annotation in CVAT, for example?

JordaoCassiano avatar Apr 18 '23 17:04 JordaoCassiano

You can convert sam mask to polygon points using imantics.

from imantics import Polygons, Mask

...
polygons = Mask(sam_mask).polygons()
points = polygons.points[0]

# save points to COCO json format, which can be read by CVAT.

DuinoDu avatar Apr 26 '23 03:04 DuinoDu