yolov5自适应anchors

在进行yolov5训练的时候,会输出:

Analyzing anchors... Best Possible Recall (BPR) = 0.8838. Attempting to generate improved anchors, please wait...
WARNING: Extremely small objects found. 2274 of 14719 labels are < 4 pixels in width or height.
Running kmeans for 9 anchors on 14700 points...
thr=0.25: 0.9927 best possible recall, 5.10 anchors past thr
n=9, img_size=480, metric_all=0.348/0.766-mean/best, past_thr=0.515-mean: 10,3,  18,6,  24,12,  36,16,  42,28,  62,39,  77,68,  110,49,  121,100
Evolving anchors with Genetic Algorithm: fitness = 0.7855: 100%|████████████| 1000/1000 [00:02<00:00, 484.50it/s]
thr=0.25: 0.9972 best possible recall, 5.23 anchors past thr
n=9, img_size=480, metric_all=0.358/0.785-mean/best, past_thr=0.524-mean: 11,2,  16,5,  22,8,  28,12,  36,18,  44,28,  62,39,  79,64,  117,96
New anchors saved to model. Update model *.yaml to use these anchors in the future.

 

函数在train.py的line206 check_anchors函数。check_anchors函数在utils/general.py。

 

Yolov5原本在模型配置文件(如yolov5l.py)中有默认的anchors,这些anchors是基于COCO数据集在640×640图像大小下锚定框的尺寸。Yolov5会自动按照新的数据集的labels自动学习anchors的尺寸。采用 k 均值和遗传学习算法对自定义数据集进行分析,获得适合自定义数据集中对象边界框预测的预设锚定框。

 

一开始会先计算Best Possible Recall (BPR)

再在kmean_anchors函数中进行k 均值和遗传学习算法更新anchors。

版权声明:本文为CSDN博主「zicai_jiayou」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/zicai_jiayou/article/details/109626712

zicai_jiayou

我还没有学会写个人说明!

暂无评论

发表评论

相关推荐

深度学习——PaddlePaddle目标识别昆虫项目(2)

摘要 本文主要介绍的是的有关于的百度飞桨的目标的检测的算法的实战案例。通过使用的百度飞桨来实现的对自己目标进行识别的。后面本人将继续深入原理来对的目标的检测的原理和算法和系统的来实现讲解。基于飞桨(PaddlePaddle&#x

目标检测——yolov3论文精读

📝论文下载 Abstract(摘要) YOLOv3在YOLO的基础上做了一些更新,重点在于提升检测的精度。当图片的分辨率为320 × 320,YOLOv3只使用了22 ms进行检测, m