alpha

mac2025-09-14  17

SAD(Sum of Absolute Differences)

def matte_sad(pred_matte, gt_matte): ''' Sum of Absolute Differences pred_matte : np.array, shape : [h,w] gt_matte : np.array, shape : [h,w] ''' assert(len(pred_matte.shape) == len(gt_matte.shape)) error_sad = np.sum(np.abs(pred_matte - gt_matte)) return error_sad

MSE(Mean Squared Error)

def matte_mse(pred_matte, gt_matte): ''' Mean Squared Error ''' assert(len(pred_matte.shape) == len(gt_matte.shape)) error_mse = np.mean(np.power(pred_matte-gt_matte, 2)) return error_mse

Gradient

def matte_grad(pred_matte, gt_matte): ''' Error measure with Gradient ''' assert(len(pred_matte.shape) == len(gt_matte.shape)) predict_grad = scipy.ndimage.filters.gaussian_filter(pred_matte, 1.4, order=1) gt_grad = scipy.ndimage.filters.gaussian_filter(gt_matte, 1.4, order=1) error_grad = np.sum(np.power(predict_grad - gt_grad, 2)) return error_grad

Connectivity

1

参考文献:

[1]. Christoph Rhemann, et al. A Perceptually Motivated Online Benchmark for Image Matting[CVPR-2019]

最新回复(0)