Convert a YOLOv8 seg model detection result to YOLOv8 label #16658
-
I try to convert the results of a YOLOv8 seg model to YOLOv8 label format for using in new model training. Is it a valid approach what I do? My code so far:
Output:
My second approach:
Result:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
👋 Hello @johnlockejrr, thank you for sharing your project with us! 🚀 It seems you're working on converting YOLOv8 segmentation results into a label format suitable for training. If you're encountering any issues or seeking validation on your approach, please ensure that you are using the latest version of Ultralytics and provide a minimum reproducible example to help us understand better. Your code snippet is a great start, but an MRE ensures we can see exactly what you're experiencing. For comprehensive guidance, you might want to check out our Docs where we have sections dedicated to Python and CLI usage examples. To engage with our community for support or brainstorming, join us on Discord 🎧, or participate in discussions over at Discourse. We also have a Subreddit for broader conversations. UpgradeEnsure you are using the latest pip install -U ultralytics EnvironmentsYOLO can be run in verified environments with all dependencies preinstalled, and it's always recommended to use these to mitigate configuration issues: An Ultralytics engineer will be along soon to assist further. Thank you for your patience! 😊 |
Beta Was this translation helpful? Give feedback.
-
@johnlockejrr converting segmentation results to YOLO label format is a valid approach for training. To order "textline" masks top-down, you can sort the contours by their y-coordinate before processing. This will ensure the annotations are in the desired order. If you need further assistance, feel free to ask! |
Beta Was this translation helpful? Give feedback.
-
I changed the second script like this as you suggested, I'm not sure the polygons are sorted top down:
Result:
EDIT: I think this is the answer. |
Beta Was this translation helpful? Give feedback.
I changed the second script like this as you suggested, I'm not sure the polygons are sorted top down: