All problems
Anchor Scales Per Level
Problem
Generate anchor width/height pairs for a feature level.
For each scale s and ratio r return [base_size * s / sqrt(r), base_size * s * sqrt(r)], iterating scales in the outer loop and ratios in the inner loop. Round each value to 4 decimal places.
Test cases
case 1
in: [16,[1,2],[0.5,1,2]]
expected: [[22.6274,11.3137],[16,16],[11.3137,22.6274],[45.2548,22.6274],[32,32],[22.6274,45.2548]]
case 2
in: [8,[1],[1]]
expected: [[8,8]]
case 3
in: [32,[2],[1]]
expected: [[64,64]]
Starter codePython
def anchor_scales(base_size, scales, ratios):
# Your code here
pass3 test cases · run your code against them in the editor