Skip to content
DeepForgeby svx
All problems
HardComputer Visioncv-253

Deformable Conv Offset Sample

Problem

Sample a deformable convolution feature value at (y + offset_y, x + offset_x).

Use bilinear interpolation with the sample coordinates clamped to the feature bounds and round the result to 4 decimal places.

Test cases

case 1
in: [[[1,2,3],[4,5,6],[7,8,9]],1,1,0,0]
expected: 5
case 2
in: [[[1,2,3],[4,5,6],[7,8,9]],1,1,0.5,0]
expected: 6.5
case 3
in: [[[1,2,3],[4,5,6],[7,8,9]],1,1,1,1]
expected: 9
case 4
in: [[[1,2,3],[4,5,6],[7,8,9]],1,1,5,0]
expected: 8
Starter codePython
def deform_sample(feature, y, x, offset_y, offset_x):
    # Your code here
    pass

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