Skip to main content
. 2020 Jul 31;20(15):4276. doi: 10.3390/s20154276
Algorithm 1: The pseudocode of K-means
1: Given K cluster center points: (Wi,Hi),i{1,2,,k},Wi,Hi refer to the width and height of each anchor box.
2: Calculate the distance between each ground truth and each cluster center:
d(box,centroid)=1IOU(box,centroid). Since the position of the anchor box is not fixed, the center point of each ground truth is coincident with the clustering center.
3: Recalculate the cluster center for each cluster: Wi=1Niwi,Hi=1Nihi
4: Repeat step 2 and step 3 until the clusters converge.