Monocular Depth from One Image
One photo has no baseline, yet size, overlap, and haze hint at distance. Monocular depth learns those cues to guess meters from a single view.
Why Does This Exist?
Stereo rigs cost money and calibration, and most web photos have one view only. Monocular depth exists to guess geometry where no baseline exists, using learned priors over size and layout. It powers background blur, single-image 3D photos, and scale-free pretraining for Depth Anything style foundation models.
This page covers the single-image formulation and its scale handling. The family map is depth estimation; metric stereo is stereo depth estimation; sparse-guided densification is depth completion.
Think of It Like This
An artist shading depth from memory
An artist draws a road shrinking to a dot and shades distant hills pale blue without measuring anything. Cars get small with distance because memory says so, not because a ruler confirmed it.
Nets are the artist and training sets are the memory. The analogy stops at novelty: artists extrapolate to alien scenes while nets collapse outside their training mix.
How It Actually Works
The net maps to inverse depth or disparity trained with a scale-and-shift-invariant loss: predictions and truth are median-aligned via and that minimize before scoring. Metric variants add camera intrinsics or a scale head to output directly but generalize worse across cameras. At test time, one sparse lidar return or known object height fixes and turns the relative map metric. Ordinal cues such as occlusion edges and vanishing points emerge in middle layers.
Worked numbers
Truth depths , , m with raw outputs , , (perfect shape, wrong scale). Median ratio maps outputs to , , m exactly, AbsRel . Adding percent noise to outputs gives predictions , , m with mean AbsRel .
Code
def median_scale(pred: list[float], gt: list[float]) -> float: ratios = sorted(g / p for g, p in zip(gt, pred)) # robust scale from pairs return ratios[len(ratios) // 2]
print(median_scale([0.5, 1.0, 2.0], [2.0, 4.0, 8.0])) # -> 4.0Watch Out For
Deploying relative depth as meters
Relative maps look right in colormap but their numbers are arbitrary; feeding them to planning yields confident wrong distances. The symptom is perfect-looking previews with percent scale error. Always attach a scale source such as sparse lidar, stereo, or known height before acting.
The Quick Version
- Monocular depth predicts shape from one image using learned size and layout cues.
- Outputs are disparity up to unknown scale and shift, not meters.
- Median alignment against sparse truth recovers metric scale.
- Scale-invariant losses train across mixed cameras without calibration.
- Typical indoor AbsRel after alignment sits near .
- Novel scenes and mirrors break the learned priors first.