All problems
Image MAE
Problem
Compute the mean absolute error between two same-shaped grayscale images.
For every pixel accumulate abs(a - b) and divide by the number of pixels, rounding the result to 4 decimal places.
Test cases
case 1
in: [[[1,2],[3,4]],[[1,1],[3,6]]]
expected: 0.75
case 2
in: [[[10,20]],[[20,10]]]
expected: 10
case 3
in: [[[1,2],[3,4]],[[1,2],[3,4]]]
expected: 0
Starter codePython
def image_mae(a, b):
# Your code here
pass3 test cases · run your code against them in the editor