compute_sad_loss.m 441 B

1234567891011
  1. % compute the SAD error given a prediction, a ground truth and a trimap.
  2. % author Ning Xu
  3. % date 2018-1-1
  4. function loss = compute_sad_loss(pred,target,trimap)
  5. error_map = abs(single(pred)-single(target))/255;
  6. loss = sum(sum(error_map.*single(trimap==128))) ;
  7. % the loss is scaled by 1000 due to the large images used in our experiment.
  8. % Please check the result table in our paper to make sure the result is correct.
  9. loss = loss / 1000 ;