ultralytics / yolov5

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

Conf_thres and iou_thres #8615

Closed tdhooghe closed 2 years ago

tdhooghe commented 2 years ago

Search before asking

Question

Hi Glenn, others,

I wondered how you arrived at a .25 conf_thres and .45 iou_thres for the detect.py and model_hub implementations. Did you by any chance do a study that I can look into?

Kind regards,

Additional

No response

glenn-jocher commented 2 years ago

@tdhooghe these are detection standard values across a few different tools, i.e. CoreML uses the same thresholds by default.

tdhooghe commented 2 years ago

Thank you for your quick response! Could you maybe point me into the direction of which other tools use this threshold and why these values are accepted in general?

creativesalam commented 2 years ago

@tdhooghe It depends on your application which values work better for you. Default might work for most people but it is not guaranteed that these values are better for all applications. E.g. I use conf_thres=0.6 in my current project because for my problem False Positive is very dangerous. Higher conf_thres will suppress false positive but at the cost of missing some detections and vice versa. It is up to you to decide what better suits to your business problem.

P.S. False positive can also be suppressed by adding more background images but it is just for your understanding. You can always tweak these values to get your desirable outcome.

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 ⭐!

Alberto1404 commented 1 year ago

@tdhooghe It depends on your application which values work better for you. Default might work for most people but it is not guaranteed that these values are better for all applications. E.g. I use conf_thres=0.6 in my current project because for my problem False Positive is very dangerous. Higher conf_thres will suppress false positive but at the cost of missing some detections and vice versa. It is up to you to decide what better suits to your business problem.

P.S. False positive can also be suppressed by adding more background images but it is just for your understanding. You can always tweak these values to get your desirable outcome.

Hello @creativesalam . Let me know if I am wrong. This is an example training results I obtained for a custom dataset.

results confusion_matrix F1_curve P_curve PR_curve R_curve Based on these, what conf-thres and iou-thres should I use when running detect.py?