about save-txt in yolov5-seg
Search before asking
- [X] I have searched the YOLOv5 issues and discussions and found no similar questions.
Question
when activating "save-txt" in yolov5-seg.py, a txt with the coordinates of the predicted region is saved, but i found that the coordinates seem not to be in sequence, that is to say when i use fillpoly in opencv, the coordinates seem unable to form a polygon like the one of prediction. is there a way to make the coordinates in sequence?
我发现启用save-txt后保存的包含预测分割区域的txt里的坐标似乎不是按顺序的(指坐标的保存顺序不是围着分割区域的)?用opencv的fillpoly填充出来的也跟预测的区域不一样。有办法把坐标变成按顺序的吗?
Additional
No response
👋 Hello @Powerfulidot, thank you for bringing this to our attention! 🚀
Please explore our YOLOv5 Tutorials to learn more about features and setup, including guidance on exporting results.
Since you've described this as potentially a 🐛 Bug Report, could you provide a minimum reproducible example? This includes any code snippets, configurations, and specific commands you've used. This will greatly assist our debugging process.
Requirements
Ensure your environment is set up according to the requirements.txt. Python>=3.8.0 and PyTorch>=1.8 are necessary. You can start by running:
git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install
Environments
YOLOv5 can be executed in the following verified environments, which come with pre-installed dependencies like CUDA, CUDNN, Python, and PyTorch:
- Notebooks:
- Google Cloud: GCP Quickstart Guide
- Amazon: AWS Quickstart Guide
- Docker Image: Docker Quickstart Guide
Status
Check our CI badge: to ensure all tests are currently passing for correct operation of YOLOv5 features.
Introducing YOLOv8 🚀
Additionally, you might want to explore our new YOLOv8, which brings state-of-the-art performance and ease of use for various tasks. Check the YOLOv8 Docs and get started with:
pip install ultralytics
This is an automated response. An Ultralytics engineer will assist you soon. Thanks for your patience! 😊
UPDATE: my current method is to fill the polygon by the coordinates, then use minAreaRect in OpenCV to form a minimum bounding rectangle of the polygon, then use boxPoints and order_points in imutils to get the coordinates of 4 vertexs. BUT this feels kinda junky. anybody has better method?
我目前的做法是用坐标填充出多边形,然后用opencv的minAreaRec生成该多边形的最小外接矩形,然后用boxPoints和imutils的order_points得到该矩形的四个顶点坐标。但是这做法感觉有点糙,有人有更好的办法吗?
@Powerfulidot you might consider using OpenCV's convexHull to order the points correctly for polygon formation. This can help streamline your process and ensure the coordinates form a proper shape. If the issue persists, please verify with the latest YOLOv5 version.
@Powerfulidot you might consider using OpenCV's
convexHullto order the points correctly for polygon formation. This can help streamline your process and ensure the coordinates form a proper shape. If the issue persists, please verify with the latest YOLOv5 version.
convexhull does work! thanks a lot!
Great to hear that worked for you! If you have any more questions or need further assistance, feel free to ask.
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.
For additional resources and information, please see the links below:
- Docs: https://docs.ultralytics.com
- HUB: https://hub.ultralytics.com
- Community: https://community.ultralytics.com
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLO 🚀 and Vision AI ⭐