All problems
Box Decode Offsets
Problem
Decode predicted offsets back into a box given an anchor.
Anchor and box are [cx, cy, w, h]; for offsets [dx, dy, dw, dh] return [acx + dx * aw, acy + dy * ah, aw * exp(dw), ah * exp(dh)] rounded to 4 decimal places.
Test cases
case 1
in: [[0,0,10,10],[0,0,0,0]]
expected: [0,0,10,10]
case 2
in: [[5,5,10,10],[0.2,-0.1,0.6931,-0.6931]]
expected: [7,4,19.9991,5.0002]
case 3
in: [[1,1,2,4],[0.5,0.5,0.6931,-0.6931]]
expected: [2,3,3.9998,2.0001]
Starter codePython
def decode_box(anchor, offsets):
# Your code here
pass3 test cases · run your code against them in the editor