How an anchor-based detector uses them
- At every cell of a feature map, place k anchors, for example three sizes times three aspect ratios.
- During training, match each anchor to ground-truth boxes by IoU: anchors above an upper threshold become positives, those below a lower one become background.
- The network learns to predict, for each positive anchor, the offsets that turn it into the ground-truth box.
- At inference, decode the offsets into boxes, drop low scores and run non-maximum suppression.
tx = (x − xa) / wa ty = (y − ya) / hatw = log(w / wa) th = log(h / ha)Anchor-free detectors
Later designs drop the predefined boxes. FCOS and CenterNet predict a box directly from points on the feature map, and the README of the Supervisely YOLOv8 app notes that, unlike YOLOv5, YOLOv8 uses an anchor-free head. Transformer detectors replace anchors with learned object queries. Fewer hand-set sizes means fewer settings to tune for a new dataset.
Pitfalls
- Anchor shapes that do not fit the data. Very long, thin or tiny objects match no anchor well, so few positives are assigned and recall drops.
- Changing the input resolution, which changes how large objects are relative to the anchors the model was tuned for.
- Reading low recall on small objects as a labeling problem when the anchor sizes are the cause.
Comparing both kinds in Supervisely
The MMDetection 3.0 training app covers anchor-based architectures such as Faster R-CNN and RetinaNet alongside anchor-free ones such as FCOS and CenterNet. Training two of them on the same project and opening a side-by-side report on the model evaluation page shows which suits your object shapes.