facebookresearch / segment-anything

The repository provides code for running inference with the SegmentAnything Model (SAM), links for downloading the trained model checkpoints, and example notebooks that show how to use the model.
Apache License 2.0
46.83k stars 5.55k forks source link

Coco rle to polygon #638

Open MacieJayDaaaaa opened 9 months ago

MacieJayDaaaaa commented 9 months ago

Hello,I am trying to train the YOLOv8-SEG model using SA-1b. Yolov8 requires a Polygon type like x1, y1, x2, y2 ············ I use mask = mask_utils.decode(annotation["segmentation"]) How to convert a mask to a polygon type? Using cv2.findContours will result in excessive data

math-yyj commented 9 months ago

Why insist on polygon?

1 In SA-1B dataset, many mask have holes, and polygon fails to work well. 2 A better way is to customize yolov8's dataloader for RLE format input.