Create YOLO Anchors

How to create own anchors for object detection?

Here is a way, similar to what the YOLO inventors did:

  1. Define a quality metric for comparing two boxes, such as Jaccard Index aka IOU.

  2. Feed training set ground truth bounding boxes into a K Means algorithm to find centroids. Each centroid comprises one anchor box shape - remember it’s shape height and width only, no location.

  3. Select a number of a number of centroids optimal for your specific business problem. More allows for more predictions per image, likely faster convergence in localization training due to better baseline ‘prior’ estimates, perhaps better localization predictions, but costs more at runtime due to additional memory footprint and computation.

Hi, can you please describe more because I am not able to understand anything!

K Means is a very well understood and publicly documented unsupervised learning algorithm for sorting collections into groups, or clusters, using a similarity measure. Objects within a group are more ‘like’ one another than they are to the objects in a different group. YOLO applies this approach to define a set of shapes that group the bounding boxes of a training set into clusters. It is done during exploratory data analysis on the training set, then the box shapes output by the K Means algorithm, called the cluster centroids, are used as the anchor box shapes during YOLO CNN training and runtime.