segment-anything
segment-anything copied to clipboard
Convert .json mask file to a polygon format to be read on CVAT
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?
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.