M4Depth icon indicating copy to clipboard operation
M4Depth copied to clipboard

Use of Masking during evaluation

Open mvish7 opened this issue 1 year ago • 0 comments

Hello,

Thanks for making the code available. I was wondering why the masking of near zero ground_truth values was done [here]?(https://github.com/michael-fonder/M4Depth/blob/0f7e229f7571b9bb9ef04248c72fc1cd4fe5c674/metrics.py#L3).

When taking example of RMSE, Without masking

rmse = (gt - pred) ** 2 
rmse = np.sqrt(rmse.mean())

With Masking,

    err = (gt - pred) ** 2
    mask = (gt_depth > 1e-6).astype(np.float16)
    masked_err = err * mask
    masked_err_non_nan = masked_err[~np.isnan(masked_err)]
    reduced_mean = np.sum(masked_err_non_nan) / max(np.sum(mask), 1)
    rmse = np.sqrt(reduced_mean)

Thank you in Advance.

Regards, mvish7

mvish7 avatar Dec 22 '23 10:12 mvish7