在进行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
暂无评论