-
-
Notifications
You must be signed in to change notification settings - Fork 16.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add segment line predictions #9571
Conversation
Signed-off-by: Glenn Jocher <[email protected]>
for more information, see https://pre-commit.ci
@glenn-jocher This is the current stragetegy to merge multi-part segments implemented by @Laughing-q
|
@AyushExel ah got it. Perhaps we should duplicate merge_multi_segments into YOLOv5 then as well. In the past I've inserted None between breaks in the segments. This works for plotting as the None segments are usually ignored by matplotlib etc, but for --save-txt annotations I'm not sure how to handle these multi-part instances. |
@glenn-jocher merging the merge_multi_parts and running the model results through it should solve the problem I think. |
@glenn-jocher That's nice! I was thinking about doing the same thing, I've seen some issues there and the users seem to want this feature. |
Ok I think this is fine for now. I experimented a bit and found that simply selecting the largest segment yielded the best results, at least on our test images. We don't want to duplicate code as it's already causing many headaches for maintenance, so let's leave the JSON2YOLO code there. The segment generation takes about 1ms per image on our test images, so it's only run if --save-txt is used, in which case the segment labels are saved there. Plotting is unaffected (below images are only for debugging). |
@AyushExel @Laughing-q I'm adding this for outputting segment predictions outlines. I'm running into issues when objects are composed of multiple segments. What's been the COCO segment strategy for multi-part objects up until now?
EDIT: I used this tutorial to get started. Contours will be returned as a list, and I've concatenated them together for outputting and plotting, but this causes issues when cv2 breaks a prediction into multiple subsegments.
Signed-off-by: Glenn Jocher [email protected]
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Upgraded segmentation output with polygon support for more accurate object outlines. 🎨
📊 Key Changes
masks2segments
to convert masks to polygon segments..txt
.🎯 Purpose & Impact
This update enhances the YOLOv5 model's ability to not only detect but also delineate object shapes more precisely, which could significantly benefit applications that require detailed object recognition.