File size: 227 Bytes
a3a3ae4
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
from typing import Union

import numpy as np
from PIL.Image import Image as PIL_image # for typing


def L1(pil: Union[PIL_image, np.ndarray], np_image: np.ndarray) -> float:
    return np.abs(np.asarray(pil) - np_image).mean()