Object detectors don't guess boxes from nothing. They start from a fixed grid of anchors — reference boxes at every location, in a spread of sizes and shapes — and only learn how to nudge them.
Around a centre point, each (scale, ratio) pair defines one anchor:
1width = scale * sqrt(ratio)2height = scale / sqrt(ratio)
Task: write generate_anchors(center_x, center_y, scales, aspect_ratios) returning boxes as [x1, y1, x2, y2] (top-left, bottom-right), every value rounded to 4 decimal places.
(scale, ratio) combination, looping scales on the outside, ratios on the inside.(center_x, center_y) — half the width each side, half the height above and below.scales returns an empty list.That
sqrtin both formulas isn't decoration. It keepswidth * height = scale²for every ratio, so changing shape doesn't quietly change area — the two knobs stay independent.