3
$\begingroup$

What is the benefit of using multiple anchor boxes with the same positions in a single-shot multi-box detector model, like YOLO?

In particular, I notice Google's BlazeFace model does this. If the purpose of an anchor box in a multi-box detector is to provide the model with priors hinting at different possible sizes and positions for a detected object, then what use is providing multiple anchors that provide the same hint?

To consider the BlazeFace example, that model is an SSD-style model but it is trained for detecting multiple faces and facial key points at various size scales. Its authors document it at length and Google ships pretrained weights as part of their MediaPipe product.

Like other SSD-style models, BlazeFace uses anchor boxes which define rects which are used as a starting point for the rects of recognized faces. So what's the value of configuring the network with hundreds of duplicate anchor boxes?

Do the duplicate boxes provide more model capacity simply by representing more weights to be trained, even if they represent training a kernel that applies to exactly the same image?

$\endgroup$
2
  • $\begingroup$ Not a pro but I feel that multiple boxes allow specialization to certain sizes/ aspect ratios. In an extreme case, if we had all the boxes that we want, then each box would be assign to detect a specific aspect ratio or size. However, computationally this would be extremely expensive. This way certain boxes get specialized at certain range of sizes/ aspect ratios. $\endgroup$
    – Javier TG
    Jan 2, 2021 at 17:31
  • 1
    $\begingroup$ But this explanation is a reason why you we should have multiple boxes which have different positions and sizes. I don’t understand how this would explain ever wanting to have, for instance, multiple anchor boxes where two of them had exactly the same position and size. $\endgroup$
    – algal
    Jan 4, 2021 at 22:53

1 Answer 1

1
$\begingroup$

Do not have sufficient reputation to add my comment.

@algal: When i go through most of the existing YOLO implementation, they consider all the given anchor boxes and then filter out best anchor boxes to consider in training. Which means that the case that you mentioned (two anchors which had exactly same position and size) will be filtered to one before training starts. For example you can have a look into this github (https://github.com/zzh8829/yolov3-tf2/blob/master/yolov3_tf2/dataset.py) esp transform targets API.

$\endgroup$
3
  • $\begingroup$ Thank!. I am still a bit confused. You say that most YOLO implementations "consider all the given anchor boxes" but then filter to only the best anchor boxes "before training starts". How does the implementation know which anchor box will be best before training? Before training, the implementation has not seen the data, and so cannot know which boxes are best for the data. How could it know box A is better than box B, irrespective of the data? Box A will be better for some data sets, and box B for other data sets. The point of training is to discover that, right? $\endgroup$
    – algal
    Feb 10, 2021 at 18:49
  • 1
    $\begingroup$ @algal , at least, in YOLOv2 and YOLOv3 the authors use the training data to perform k-means clustering in order to get the anchor boxes with highest IOU, this is detailed in the section Dimension Clusters of the YOLOv2 paper. $\endgroup$
    – Javier TG
    Feb 11, 2021 at 11:16
  • $\begingroup$ @algal, As Javior TG mentioned, we will have to filter out the best anchor boxes wrt our own training data by running the kmeans as first step, then we can find the best anchor boxes based on our own dataset. Assume you have got k (k is variable here) number of anchor boxes (for example 9 anchor boxes as mentioned in the paper), these anchor boxes needs to be transformed wrt to GT and feature map size as we will have 3 different scale (13x13, 26x26, 52x52 if input size is 416) feature maps in YOLOV3. $\endgroup$ Feb 12, 2021 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.