SSD
算法在先验框匹配上,采用了两个原则:
- 对于图像中每一个 ground truth 找到与其 IOU 最大的的先验框, 该先验框为正样本, 若一个先验框没有与任何的 ground truth 匹配,则为负样本。
- 对于剩下的未匹配的先验框,若与某个 ground truth 的 IOU 大于某个阈值(一般取0.5),则该先验框也与 ground truth 匹配
通过代码可以看出:
def match(threshold, truths, priors, variances, labels, loc_t, conf_t, idx):
"""Match each prior box with the ground truth box of the highest jaccard
overlap, encode the bounding boxes, then return the matched indices
corresponding to both confidence and location preds.
Args:
threshold: (float) The overlap threshold used when mathing boxes.
truths: (tensor) Ground truth boxes, Shape: [num_obj, 4].
priors: (tensor) Prior boxes from priorbox layers, Shape: [n_priors,4].
variances: (tensor) Variances corresponding to each prior coord,
Shape: [num_priors, 4].
labels: