YOLOv3的配置文件中有一段对anchors参数的配置
YOLOv3Head:
# anchor_masks
anchor_masks: [[6, 7, 8], [3, 4, 5], [0, 1, 2]]
# 3x3 anchors
anchors: [[10, 13], [16, 30], [33, 23],
[30, 61], [62, 45], [59, 119],
[116, 90], [156, 198], [373, 326]]
# norm_decay
norm_decay: 0.
# yolo_loss
yolo_loss: YOLOv3Loss
# nms 类型参数,可以设置为[MultiClassNMS, MultiClassSoftNMS, MatrixNMS], 默认使用 MultiClassNMS
根据《YOLO9000:Better, Faster, Stronger》文章中所述:
We encounter two issues with anchor boxes when using them with YOLO. The first is that the box dimensions are hand picked. The network can learn to adjust the boxes appropriately but if we pick better priors for the network to start with we can make it easier for the network to learn to predict good detections.
Instead of choosing priors by hand, we run k-means clustering on the training set bounding boxes to automatically find good priors
根据《YOLOv3: An Incremental Improvement》文章中所述:
YOLOv3算法在COCO数据集上使用K-means类聚了9类anchors,分别应用大中小三种特征图,下图中黄色框为标注框,蓝色框为锚框We still use k-means clustering to determine our bounding box priors. We just sort of chose 9 clusters and 3 scales arbitrarily and then divide up the clusters evenly
across scales. On the COCO dataset the 9 clusters were:
(10×13),(16×30),(33×23),(30×61),(62×45),(59×119),(116 × 90),(156 × 198),(373 × 326).

从数据集中类聚出来的锚框,相当于预测框的一个参考,基于这个参考,算法生成的预测框仅需要在这个锚框的基础上进行“精修或微调fine-tuning”即可,这样算法可以收敛的更快,检测效果更好。
网友评论