Object detectors like Faster R-CNN and SSD generate a dense set of predefined bounding boxes called anchors at every position on a feature grid. Each anchor serves as an initial guess that the network refines during training.
Given a square feature grid size, the original image size, a list of scales, and a list of aspect ratios, generate all anchor boxes in image coordinates.
Iterate over grid cells in row-major order (i then j), and for each cell iterate over scales then aspect ratios.
Input: feature_size = 1, image_size = 8, scales = [4], aspect_ratios = [1.0]
Output: [[2.0, 2.0, 6.0, 6.0]]
Explanation: The only grid cell is centered at (4, 4), and its anchor has width and height 4.
Input: feature_size = 2, image_size = 8, scales = [2], aspect_ratios = [1.0]
Output: [[1.0, 1.0, 3.0, 3.0], [5.0, 1.0, 7.0, 3.0], [1.0, 5.0, 3.0, 7.0], [5.0, 5.0, 7.0, 7.0]]
Compute stride as image_size / feature_size and offset each grid coordinate by 0.5 before scaling.
For scale s and ratio r, use width = s * sqrt(r) and height = s / sqrt(r).
Sign in to take notes on this problem
Accepts: number
Accepts: number
Accepts: array
Accepts: array
Object detectors like Faster R-CNN and SSD generate a dense set of predefined bounding boxes called anchors at every position on a feature grid. Each anchor serves as an initial guess that the network refines during training.
Given a square feature grid size, the original image size, a list of scales, and a list of aspect ratios, generate all anchor boxes in image coordinates.
Iterate over grid cells in row-major order (i then j), and for each cell iterate over scales then aspect ratios.
Input: feature_size = 1, image_size = 8, scales = [4], aspect_ratios = [1.0]
Output: [[2.0, 2.0, 6.0, 6.0]]
Explanation: The only grid cell is centered at (4, 4), and its anchor has width and height 4.
Input: feature_size = 2, image_size = 8, scales = [2], aspect_ratios = [1.0]
Output: [[1.0, 1.0, 3.0, 3.0], [5.0, 1.0, 7.0, 3.0], [1.0, 5.0, 3.0, 7.0], [5.0, 5.0, 7.0, 7.0]]
Compute stride as image_size / feature_size and offset each grid coordinate by 0.5 before scaling.
For scale s and ratio r, use width = s * sqrt(r) and height = s / sqrt(r).
Sign in to take notes on this problem
Accepts: number
Accepts: number
Accepts: array
Accepts: array