Skip to content
DeepForgeby svx
All problems
MediumComputer Visioncv-251

Optical Flow Endpoint Error

Problem

Compute the mean optical flow endpoint error.

Return the average of sqrt((pred_x - gt_x)^2 + (pred_y - gt_y)^2) over all pixels, rounded to 4 decimal places.

Test cases

case 1
in: [[[1,2],[3,4]],[[0,0],[0,0]],[[1,2],[3,4]],[[0,0],[0,0]]]
expected: 0
case 2
in: [[[0,0]],[[0,0]],[[3,4]],[[0,0]]]
expected: 3.5
case 3
in: [[[1,1]],[[1,1]],[[0,0]],[[0,0]]]
expected: 1.4142
Starter codePython
def flow_endpoint_error(pred_x, pred_y, gt_x, gt_y):
    # Your code here
    pass

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