Skip to content
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

How to convert files annotated with linestrip in labelme to yolo #68

Open
DJohn1211 opened this issue Dec 16, 2023 · 13 comments
Open

How to convert files annotated with linestrip in labelme to yolo #68

DJohn1211 opened this issue Dec 16, 2023 · 13 comments

Comments

@DJohn1211
Copy link

In normal circumstances, when we use rectangular boxes to label, we will obtain x1y1 and x2y2, convert the corresponding coordinates to cx cy w h. If I use linestrip to obtain the coordinate xy, how should I convert it to the corresponding coordinate. The corresponding image is as follows.
label
json

@glenn-jocher
Copy link
Member

@DJohn1211 you can convert linestrip annotations from Labelme to YOLO format by calculating the bounding box coordinates from the linestrip points. The Ultralytics documentation at https://docs.ultralytics.com provides detailed instructions for this conversion. Let me know if you need further assistance!

@DJohn1211
Copy link
Author

Hi!I am very excited to receive your reply, but I still don't quite understand what you said about calculating the coordinates of the bounding box based on the underlined points. I couldn't find any relevant content in the website you provided. If you could give me an example of converting x1y1 x2y2 … xnyn to yolo, or could you please provide me with a file? I would greatly appreciate it. Finally, I look forward to your reply.

@glenn-jocher
Copy link
Member

@DJohn1211 certainly! You can calculate the bounding box coordinates (x, y, width, height) from the linestrip points by finding the minimum and maximum x and y coordinates, and then computing the center and dimensions of the bounding box. Unfortunately, I'm not able to provide you with a specific file, but you can refer to the Ultralytics documentation for general conversion guidance. Let me know if you have further questions!

@DJohn1211
Copy link
Author

Thank you for taking the time to reply to my comment. I calculated using the bounding rectangle of the file labeled with linestrip as you said, and the result was very good. However, I have a little doubt. Can YOLOv8 recognize this line as I labeled it, and what should my xy label conversion be like?
1
label_viz

@glenn-jocher
Copy link
Member

@DJohn1211 YOLOv8 should be able to recognize the line labels as you have annotated them. For the xy label conversion, you can use the center (cx, cy) and dimensions (width, height) of the bounding box calculated from the linestrip points. This should enable YOLOv8 to properly detect the line. Let me know if you have further inquiries or need assistance with anything else!

@DJohn1211
Copy link
Author

thank you!!!

@glenn-jocher
Copy link
Member

@DJohn1211 you're welcome! If you have any more questions in the future, feel free to ask. Good luck with your project! 😊

@hariouat
Copy link

hariouat commented Jun 2, 2024

Hello,
Please how to train yolov8 with Linestrip annotation? it's is like keypoint detection?
thanks in advance

@pderrenger
Copy link
Member

Hello! Training YOLOv8 with Linestrip annotations involves treating the linestrips as objects with bounding boxes. It's not exactly like keypoint detection, which typically involves predicting specific points. For Linestrip, you would define the bounding box around the entire strip. Ensure your annotations are converted to the YOLO format (center x, center y, width, height) as discussed earlier. If you need more specific guidance on setting up your training configuration, feel free to ask. Good luck!

@hariouat
Copy link

hariouat commented Jun 2, 2024

Hello! Training YOLOv8 with Linestrip annotations involves treating the linestrips as objects with bounding boxes. It's not exactly like keypoint detection, which typically involves predicting specific points. For Linestrip, you would define the bounding box around the entire strip. Ensure your annotations are converted to the YOLO format (center x, center y, width, height) as discussed earlier. If you need more specific guidance on setting up your training configuration, feel free to ask. Good luck!

Thank you for your reply.

What I did was convert the line strip into two points by taking the first point and the second point to train YOLOv8. Is this also correct? I also ensured that the two points are normalized. Thank you for your feedback.

@pderrenger
Copy link
Member

Hello! Using just the first and last points of the linestrip to define a bounding box is a valid approach, especially if the line is relatively straight. Normalizing these points, as you've done, is crucial for maintaining consistency with the YOLO format. Keep in mind, however, that this method might not capture the full essence of more complex or curved linestrips. If your linestrips are generally straight, your method should work well. If you encounter more complex shapes, consider using the bounding box encompassing all points for better accuracy. Let me know if you need further assistance! 😊

@DJohn1211
Copy link
Author

您好,请问如何使用 Linestrip 注释训练 yolov8?这就像关键点检测?提前致谢

Hello, Please how to train yolov8 with Linestrip annotation? it's is like keypoint detection? thanks in advance

Hi,I think you can use labelme or labelme with sam (segment anything model). And then, you can convert absolute coordinates to relative coordinates. YOLOv8 could be trained with these coordinates.

@glenn-jocher
Copy link
Member

@DJohn1211 hello, to train YOLOv8 with Linestrip annotations, convert the linestrip to bounding boxes and use the YOLO format (center x, center y, width, height). This approach differs from keypoint detection. Ensure your annotations are correctly formatted and normalized. If you need further assistance, feel free to ask.

@DJohn1211
Copy link
Author

thanks,man!!!

@glenn-jocher
Copy link
Member

You're welcome! If you have any more questions or need further assistance, feel free to ask.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants