Skip to content
DeepForgeby svx
All problems
MediumComputer Visioncv-201

Box Decode with Variance

Problem

Decode variance-scaled offsets back into a box.

For anchor [acx, acy, aw, ah] and offsets [dx, dy, dw, dh] return [acx + dx * v0 * aw, acy + dy * v1 * ah, aw * exp(dw * v2), ah * exp(dh * v3)] rounded to 4 decimal places.

Test cases

case 1
in: [[0,0,10,10],[5,5,3.4657,3.4657],[0.1,0.1,0.2,0.2]]
expected: [5,5,19.9999,19.9999]
case 2
in: [[5,5,10,10],[0,0,0,0],[0.1,0.1,0.2,0.2]]
expected: [5,5,10,10]
case 3
in: [[0,0,10,10],[0.5,0.5,0.6931,0.6931],[1,1,1,1]]
expected: [5,5,19.9991,19.9991]
Starter codePython
def decode_var(anchor, offsets, variances):
    # Your code here
    pass

3 test cases · run your code against them in the editor