YOLO v2 anchors
in .cfg file
[region]anchors = 1.3221, 1.73145, 3.19275, 4.00944, 5.05587, 8.09892, 9.47112, 4.84053, 11.2364, 10.0071 # height,width each anchor
bias_match=1
classes=4
coords=4
num=5
softmax=1
jitter=.3
rescore=1
instead of choosing priors by hand, we run k-means clustering on the training set bounding boxes to automatically find good priors.
k-means algorithm
randomly initialize k cluster centroids u1,u2,...,uk
repeat{
# step 1 : cluster assignment for training data
for i =1 to m
c(i):=index(from 1 to k) of cluster centroid
closest to x(i)
# step 2 : move centroid
for k=1 to K
uk :=average(mean) of points assigned to cluster k
}