ultralytics / yolov5

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

how to improve the recall of model #9799

Closed ljz1998zzzz closed 1 year ago

ljz1998zzzz commented 2 years ago

Search before asking

Question

I focus more on recall than precision in my task. And I've tried lower the confidence value to get a higher recall. But it still cannot reach a high level even when I lower the confidence very close to zero.

So I wonder if there is a way I could use to maximize the recall of the model, like changing the loss function somewhere or adding more punishment if the model fails to detect an object, by which I could improve the r value, for example, from 95% to 98%, while the p value can be reduced from 95% to 85% or even less. Do you think this is possible? I'd appreciate any suggestions you provide. Many thanks.

Additional

No response

glenn-jocher commented 2 years ago

@ljz1998zzzz 👋 Hello! Thanks for asking about improving YOLOv5 🚀 training results.

What you want is higher mAP, not higher recall, as you can simply lower confidence to 0.0 to trivially achieve 100% recall anytime you want.

Most of the time good results can be obtained with no changes to the models or training settings, provided your dataset is sufficiently large and well labelled. If at first you don't get good results, there are steps you might be able to take to improve, but we always recommend users first train with all default settings before considering any changes. This helps establish a performance baseline and spot areas for improvement.

If you have questions about your training results we recommend you provide the maximum amount of information possible if you expect a helpful response, including results plots (train losses, val losses, P, R, mAP), PR curve, confusion matrix, training mosaics, test results and dataset statistics images such as labels.png. All of these are located in your project/name directory, typically yolov5/runs/train/exp.

We've put together a full guide for users looking to get the best results on their YOLOv5 trainings below.

Dataset

COCO Analysis

Model Selection

Larger models like YOLOv5x and YOLOv5x6 will produce better results in nearly all cases, but have more parameters, require more CUDA memory to train, and are slower to run. For mobile deployments we recommend YOLOv5s/m, for cloud deployments we recommend YOLOv5l/x. See our README table for a full comparison of all models.

YOLOv5 Models

Training Settings

Before modifying anything, first train with default settings to establish a performance baseline. A full list of train.py settings can be found in the train.py argparser.

Further Reading

If you'd like to know more a good place to start is Karpathy's 'Recipe for Training Neural Networks', which has great ideas for training that apply broadly across all ML domains: http://karpathy.github.io/2019/04/25/recipe/

Good luck 🍀 and let us know if you have any other questions!

ljz1998zzzz commented 2 years ago

@glenn-jocher Thank you for your explanation. I get it.

github-actions[bot] commented 1 year 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 ⭐!

glenn-jocher commented 11 months ago

@ljz1998zzzz you're welcome! 👍 If you have any more questions or need further assistance, feel free to ask. Good luck with your YOLOv5 training!