Depth Errors AbsRel RMSE
Relative and absolute depth gaps that price monocular predictions fairly across near and far pixels.
Why Does This Exist?
One meter off at 5 meters matters more than at 50 meters, yet absolute error treats them equally. Depth scoring needs both views: relative gaps for fairness across range and squared gaps for outlier pressure. AbsRel averages , RMSE roots mean squared gaps, so depth reports carry both.
This page computes both on toy depths and names scale traps.
Think of It Like This
Missed exits near and far
Missing an exit by one block downtown hurts more than one mile on a highway. Relative distance prices the downtown miss higher.
AbsRel is that fairness rule, RMSE the tow-truck bill that punishes huge misses anywhere.
How It Actually Works
For valid pixels, and , both lower is better. Mask invalid sky and align scale or shift where the protocol allows before scoring.
Worked toy depths
Take truth with prediction . Gaps are . AbsRel is . RMSE is . Same gaps, two stories: 10 percent relative, 1.581 absolute with outlier lean.
Code
Both depth numbers from the same arrays.
import numpy as np
def depth_scores(pred: np.ndarray, true: np.ndarray) -> tuple[float, float]: absrel = float(np.mean(np.abs(pred - true) / np.maximum(true, 1e-6))) rmse = float(np.sqrt(np.mean((pred - true) ** 2))) return round(absrel, 3), round(rmse, 3)
print(depth_scores(np.array([11.0, 18.0]), np.array([10.0, 20.0])))# -> (0.1, 1.581)Gaps 1 and 2 give 0.1 relative and about 1.581 RMSE.
Watch Out For
Scoring unaligned monocular scale as error
Monocular maps carry scale ambiguity, so raw gaps punish correct shapes. The symptom is a good-looking map with bad numbers. Fix it by median-aligning scale where allowed before scoring.
The Quick Version
- AbsRel averages relative gaps, fair across near and far.
- RMSE roots mean squared gaps, punishing outliers.
- Toy versus gives 0.1 and about 1.581.
- Use both with masked valid pixels and documented alignment.
- Align scale first on monocular protocols.