Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-332

Pixel Accuracy with Ignore

Problem

Compute pixel accuracy while ignoring pixels whose target equals ignore.

Return the fraction of the remaining pixels where pred equals target, rounded to 4 decimal places. Return 0.0 when every pixel is ignored.

Test cases

case 1
in: [[[1,2],[3,4]],[[1,0],[3,-1]],-1]
expected: 0.6667
case 2
in: [[[0,0]],[[-1,-1]],-1]
expected: 0
case 3
in: [[[5,5],[5,5]],[[5,5],[5,5]],-1]
expected: 1
Starter codePython
def pixel_accuracy_ignore(pred, target, ignore):
    # Your code here
    pass

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