ANCHOR BOX(yolo_head)

Why are the anchor boxes fixed in the start as a parameter in yolo_head?? if they are fixed then how are there different boxes in each grid?? I have the concept that the anchor box is the same as the predicted values of the box…is it the same or not??? kindly explain the use of anchor box In the yolo_head??

yolo_head is responsible for converting model prediction of form (m, width, height, flattened_preds) to form (m, width, height, num_anchors, num_classes_per_anchor).

This method doesn’t know ahead of time, what the number of anchors and number of predicted classes per anchor boxes are. To make this concrete, 425 could mean one of the following:

  1. 5 anchors and 80 classes (this is what we want)
  2. 17 anchors and 20 classes
  3. 25 anchors and 12 classes
  4. 1 anchor and 420 classes

We know that the flattened shape should be interpreted as num_anchors * (num_classes + 5).
Hence the need for passing anchor_boxes to this method.


What is the use of the anchor’s box widths and height in yolo_head? if the feat already has certain dimensions of the box predicted??

They’re used inside yolo_eval.

If you haven’t read this thread, it might illuminate the role the anchor shapes play in bounding box predicted shapes…