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

@huayue1126 hello there! 👋 #13220

Open
yaober opened this issue May 29, 2024 · 5 comments
Open

@huayue1126 hello there! 👋 #13220

yaober opened this issue May 29, 2024 · 5 comments
Labels

Comments

@yaober
Copy link

yaober commented May 29, 2024

          @huayue1126 hello there! 👋 I tried to use that code to validate my model, but still can not get the mIOU lol. Would you please confirm the solution? Thanks a lot!

To calculate mIoU (mean Intersection over Union) and mPA (mean Pixel Accuracy) from a YOLOv8-seg model, you would typically use the val mode, which validates the model on your data and computes these metrics. By simply running the model in the val mode with your dataset, it should give you these metrics if supported by default. For example:

yolo segment val model=yolov8n-seg.pt data=your_dataset.yaml

Replace your_dataset.yaml with your dataset configuration file. This command assumes that your dataset format and the model are compatible with reporting these segmentation metrics.

If these metrics are not directly provided, you might need to write a custom evaluation script where you compare the predicted segmentation masks against your ground truth masks to calculate mIoU and mPA. For segmentation tasks, these metrics are often critical in many applications for understanding how well the model is performing, especially regarding the overlap (IoU) between predicted segments and the ground truth.

Thanks for reaching out, and don't hesitate to follow up if you have more questions! 😊

Originally posted by @glenn-jocher in #9016 (comment)

Copy link

👋 Hello @yaober, thank you for your interest in Ultralytics YOLOv8 🚀! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.

Install

Pip install the ultralytics package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.

pip install ultralytics

Environments

YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

Ultralytics CI

If this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

@glenn-jocher
Copy link
Member

Hello @yaober! 👋

To calculate mIoU and mPA for your YOLOv8-seg model, you should indeed use the val mode as described. Ensure your dataset is properly configured in your your_dataset.yaml file to support these metrics. If the metrics still don't appear, it may be necessary to implement a custom script to calculate them by comparing the predicted masks against the ground truth.

Here's the command again for clarity:

yolo segment val model=yolov8n-seg.pt data=your_dataset.yaml

If you encounter any specific issues or errors during this process, please provide the error messages or further details, and I'll be glad to assist you further!

@yaober
Copy link
Author

yaober commented May 30, 2024

I do use the command line you provided. and I got the metrics like speed/mAP/BOX_Percision .......... while there is not mIOU. I also check the code of yolov8, I do see mIoU function, but it was not implemented when the val process. could you please check the source code again?

@glenn-jocher
Copy link
Member

@yaober hello!

Thank you for your detailed feedback. It seems that while the mIoU function exists within the YOLOv8 codebase, it might not be automatically applied during the val process for segmentation models. I recommend manually invoking this function in your validation script or modifying the validation pipeline to include mIoU calculation explicitly.

If you need further guidance on how to modify the script or any other assistance, please let me know! I'm here to help. 😊

Copy link

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

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 ⭐

@github-actions github-actions bot added the Stale label Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants