facebookresearch / facebookresearch/sam2

Issue: Handling Multiple Connected Regions from SAM2 for YOLO Segmentation Training

Open
#201 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
19.9k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

Hello,
I'm encountering a challenge when using Segment Anything 2 (SAM2) generated masks for YOLO segmentation model training. I'd appreciate any insights or suggestions on how to address this issue.
Current Situation:

Using SAM2 to generate object masks
These masks sometimes contain multiple connected regions for a single object
Preparing data for YOLO segmentation model training

Problem:
The YOLO segmentation model training process expects each object annotation to be a single polygon (one connected region) per line. However, the SAM2-generated masks often produce multiple connected regions for a single object.
Impact:
This mismatch leads to incorrect object annotations, especially for objects that are naturally segmented or partially occluded in the image.
Attempted Solution:
I've tried to merge multiple connected regions into a single connected region, but the results have been inconsistent and not sufficiently stable for reliable training data.
Question:
Are there any recommended approaches or best practices for handling this situation? Specifically, I'm looking for methods to:

Effectively combine multiple connected regions into a single, coherent polygon suitable for YOLO segmentation training, or
Adapt the YOLO segmentation training process to handle multiple polygons for a single object annotation.

Any guidance, examples, or references to relevant resources would be greatly appreciated. Thank you in advance for your time and expertise!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.