ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
49.67k stars 16.11k forks source link

How can I test yolov5 weight that I custom train #8070

Closed bonlycpe closed 2 years ago

bonlycpe commented 2 years ago

Search before asking

Question

How can I test yolov5 weight that I custom train my self

Additional

No response

github-actions[bot] commented 2 years ago

👋 Hello @conandoor1, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.

For business inquiries or professional support requests please visit https://ultralytics.com or email support@ultralytics.com.

Requirements

Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

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

Status

CI CPU testing

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on macOS, Windows, and Ubuntu every 24 hours and on every commit.

bonlycpe commented 2 years ago

I have found this one image

glenn-jocher commented 2 years ago

@conandoor1

python val.py --data DATA.yaml --weights MODEL.pt
bonlycpe commented 2 years ago

thank ^^ , And another question I have see that in train.py have use val.py too that mean every train it will automatically test in the end right , I'm confused about optional in this tutorials that have test too.

image

glenn-jocher commented 2 years ago

@conandoor1 yes train.py runs validation every epoch and after training completes on best.pt.

bonlycpe commented 2 years ago

@glenn-jocher Thank ^^

bonlycpe commented 2 years ago

@glenn-jocher how can I get result like in tutorial I away got like this image image

glenn-jocher commented 2 years ago

@conandoor1 the second pic you have there is showing pycocotools results. These are only applied when evaluating the COCO dataset.

bonlycpe commented 2 years ago

@glenn-jocher Thank ^^

pabsan-0 commented 2 years ago

@glenn-jocher Hello! I get wildly different AP results when comparing val.py and testing myself with pycocotools:

Could you please shed some light on why is this happening and whether it is normal?

I've had this scame scenario happen too with YoloR. Back in the day I got the same-ish custom (6 class) AP results with pycocotools and darknet... pycocotools repo hasnt changed ever since so it is my understanding pycocotools metrics should be fine for custom data too.

glenn-jocher commented 2 years ago

@pabsan-0 👋 hi, thanks for letting us know about this possible problem with YOLOv5 🚀. We've created a few short guidelines below to help users provide what we need in order to start investigating a possible problem.

How to create a Minimal, Reproducible Example

When asking a question, people will be better able to provide help if you provide code that they can easily understand and use to reproduce the problem. This is referred to by community members as creating a minimum reproducible example. Your code that reproduces the problem should be:

For Ultralytics to provide assistance your code should also be:

If you believe your problem meets all the above criteria, please close this issue and raise a new one using the 🐛 Bug Report template with a minimum reproducible example to help us better understand and diagnose your problem.

Thank you! 😃

pabsan-0 commented 2 years ago

@glenn-jocher Hello! Thanks for your reply. After reading your previous answer in this thread I though you discouraged COCO metrics for non-COCO datasets and I assumed either yolov5 somehow just would not play nice with external COCO validation or that this diff was my data's fault.

Then I saw this other issue in which you state --conf-thresh should be 0.001. I made this correction and both validation approaches seem to yield the same results now (with the usual 1% diff). Will raise my own issue if something alike comes up again.

Cheers!

glenn-jocher commented 2 years ago

@pabsan-0 great, I'm glad your metrics align.

github-actions[bot] commented 2 years ago

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.

Access additional YOLOv5 🚀 resources:

Access additional Ultralytics ⚡ resources:

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 YOLOv5 🚀 and Vision AI ⭐!