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

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

暂无评论

发表评论

相关推荐

AP AR mAP ROC AUC(目标检测)

禁止转载!在做目标检测任务的时候,通常会制定规则来评估性能,就如下图所示,后面会慢慢道来其中的原理。 混淆矩阵中 TP、TN、FP、FN
在目标检测中,通常以IoU阈值作为

瑕疵检测(深度学习)

与通用目标检测的区别
相较与整张图片瑕疵区域的占比一般非常小,Faster R-CNN等检测模型对小物体检测不够好
深度学习从低层到高层不断去提炼高层语义信息,层数的增大细节的信息丢失得越多,对于缺