Skip to content
DeepForgeby svx
All problems
MediumComputer Visioncv-385

Scale-Invariant Depth Error

Problem

Compute the scale-invariant depth error between two depth maps.

Over pixels where both depths are positive, take the root mean square of log(pred) - log(gt) using natural logarithms. Return the error rounded to 4 decimal places, or 0.0 when no pixel is valid.

Hint

Taking logs turns a global scale factor into a constant shift that the metric forgives.

Test cases

case 1
in: [[[1,2],[3,4]],[[1,2],[3,4]]]
expected: 0
case 2
in: [[[2,2],[2,2]],[[1,1],[1,1]]]
expected: 0.6931
case 3
in: [[[1,4]],[[1,1]]]
expected: 0.9803
case 4
in: [[[0,2]],[[5,1]]]
expected: 0.6931
Starter codePython
def scale_invariant_depth_error(pred, gt):
    # Your code here
    pass

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