compute_mse_loss.m 456 B

12345678910111213
  1. % compute the MSE error given a prediction, a ground truth and a trimap.
  2. % author Ning Xu
  3. % date 2018-1-1
  4. % pred: the predicted alpha matte
  5. % target: the ground truth alpha matte
  6. % trimap: the given trimap
  7. function loss = compute_mse_loss(pred,target,trimap)
  8. error_map = (single(pred)-single(target))/255;
  9. % fprintf('size(error_map) is %s\n', mat2str(size(error_map)))
  10. loss = sum(sum(error_map.^2.*single(trimap==128))) / sum(sum(single(trimap==128)));