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

about save-txt in yolov5-seg #13330

Open
1 task done
Powerfulidot opened this issue Sep 23, 2024 · 5 comments
Open
1 task done

about save-txt in yolov5-seg #13330

Powerfulidot opened this issue Sep 23, 2024 · 5 comments
Labels
question Further information is requested

Comments

@Powerfulidot
Copy link

Powerfulidot commented Sep 23, 2024

Search before asking

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填充出来的也跟预测的区域不一样。有办法把坐标变成按顺序的吗?

QQ20240923-174819

Additional

No response

@Powerfulidot Powerfulidot added the question Further information is requested label Sep 23, 2024
@UltralyticsAssistant
Copy link
Member

UltralyticsAssistant commented Sep 23, 2024

👋 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:

Status

Check our CI badge: YOLOv5 CI 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! 😊

@Powerfulidot
Copy link
Author

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得到该矩形的四个顶点坐标。但是这做法感觉有点糙,有人有更好的办法吗?

QQ20240924-143531

@glenn-jocher
Copy link
Member

@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
Copy link
Author

Powerfulidot commented Sep 25, 2024

@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.

convexhull does work! thanks a lot!

QQ20240925-085639

@glenn-jocher
Copy link
Member

Great to hear that worked for you! 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
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants