> For the complete documentation index, see [llms.txt](https://docs.eyepop.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eyepop.ai/platform/abilities/pretrained-fixed-classes/depth-estimation.md). Agents can also search and read this documentation through its [MCP server](https://docs.eyepop.ai/~gitbook/mcp).

# Depth estimation

Metric depth models that produce a frame-level distance map

Metric depth models produce a frame-level map of distance, which is what [world coordinates](https://docs.eyepop.ai/platform/depth-and-world-coordinates.md) are back-projected from. A Pop names one in [`depthMap`](https://docs.eyepop.ai/platform/pop/pop-object.md) rather than in an inference component.

| Ability                                      | Map fits inside |
| -------------------------------------------- | --------------- |
| `eyepop.depth.metric.small:latest`           | 280 x 280       |
| `eyepop.depth.metric.small-landscape:latest` | 504 x 280       |
| `eyepop.depth.metric.large:latest`           | 518 x 518       |
| `eyepop.depth.metric.large-landscape:latest` | 924 x 518       |

A map always keeps the **source's** aspect ratio. What the ability sets is the box it has to fit inside, so the source's shape decides which edge binds.

The plain variants use a square box, which caps the **longer** edge whichever it is. The `-landscape` variants use a wide one, so landscape media comes back far denser: a 1280x720 source yields 518x291 from `large` but 921x518 from `large-landscape` — more than three times the points. On portrait or square media the two are identical, because the height is already the binding edge.

A smaller map is faster. Map size drives the session's response time and throughput, so pick the smallest one that still resolves what you need to measure.

Only **metric** depth can be back-projected. A model reporting `relative` depth is accepted and silently produces no world coordinates at all, because relative depth is scale- *and* shift-invariant — a scene recovered from it would be distorted rather than merely unscaled.

### Example: a depth map

`eyepop.depth.metric.large` on the street photo, 810 x 1080. A depth map with `toWorld` is a complete Pop on its own, so this one has no components:

{% tabs %}
{% tab title="JSON" %}

```json
{
  "components": [],
  "depthMap": { "ability": "eyepop.depth.metric.large:latest", "toWorld": true }
}
```

{% endtab %}

{% tab title="Python" %}

```python
from eyepop import DepthMap, EyePopSdk
from eyepop.worker.worker_types import Pop, PopDepthMap

pop = Pop(
    components=[],
    depthMap=PopDepthMap(ability="eyepop.depth.metric.large:latest", toWorld=True),
)

with EyePopSdk.sync_worker(pop=pop) as endpoint:
    prediction = endpoint.upload("street.jpg").predict()

depth_map = DepthMap.from_prediction(prediction)
print(f"{depth_map.width} x {depth_map.height}, {prediction['depth']['semantic']}")
print(f"nearest {depth_map.finite_min:.1f}, farthest {depth_map.finite_max:.1f}")
for name, (x, y) in {"pavement": (405, 1000), "bus": (450, 450), "building": (405, 100)}.items():
    print(f"{name:8} {depth_map.at(x, y, prediction['source_width'], prediction['source_height']):.1f}")
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { decodeDepthMap, EyePop, type Pop } from '@eyepop.ai/eyepop'

const pop: Pop = {
    components: [],
    depthMap: { ability: 'eyepop.depth.metric.large:latest', toWorld: true },
}
const endpoint = await EyePop.workerEndpoint({ pop }).connect()

try {
    const results = await endpoint.process({ source: { path: 'street.jpg' } })
    for await (const prediction of results) {
        if (!prediction.depth) continue
        const depthMap = decodeDepthMap(prediction.depth)
        console.log(`${depthMap.width} x ${depthMap.height}, ${prediction.depth.semantic}`)
        console.log(`nearest ${depthMap.finiteMin?.toFixed(1)}, farthest ${depthMap.finiteMax?.toFixed(1)}`)
        const points: Record<string, [number, number]> = { pavement: [405, 1000], bus: [450, 450], building: [405, 100] }
        for (const [name, [x, y]] of Object.entries(points)) {
            console.log(name.padEnd(8), depthMap.at(x, y, prediction.source_width, prediction.source_height).toFixed(1))
        }
    }
} finally {
    await endpoint.disconnect()
}
```

{% endtab %}
{% endtabs %}

```
389 x 518, canonical_metric
nearest 1.3, farthest 10.1
pavement 2.0
bus      4.1
building 8.0
```

The map is a frame-level `depth` member of the prediction, trimmed here:

```json
"depth": {
  "width": 389,
  "height": 518,
  "semantic": "canonical_metric",
  "values": "DiTGQBXBxUDn7cFAjPLFQDmHxkAVwc…",
  "world": "…"
}
```

<figure><img src="https://1072321683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDoCvfjveqiJFmk0cnXCp%2Fuploads%2Fgit-blob-23ff14e64590c12453ce69f5b6a3f0f8d186f156%2Fpretrained-depth.jpg?alt=media" alt="Left: the street photo. Right: its depth map, red for the pavement in front, orange for the people and the bus, green to blue for the building behind" width="600"><figcaption><p>The photo and its depth map: near is warm, far is cool.</p></figcaption></figure>

The map has the photo's aspect ratio at 389 x 518, within this ability's 518 x 518 box. The pavement in front reads nearer than the bus, and the bus nearer than the building. The values are `canonical_metric`: meters up to a factor set by the lens, so they become meters once the platform knows the camera.

### How to use it

* [Depth Maps](https://docs.eyepop.ai/platform/depth-and-world-coordinates/depth-maps.md) — asking for a map, what its values mean, reading the value at a pixel and drawing it as a heatmap.
* [Camera Calibration](https://docs.eyepop.ai/platform/depth-and-world-coordinates/camera-calibration.md) — the lens and pose that turn canonical depth into meters.
* [World Coordinates](https://docs.eyepop.ai/platform/depth-and-world-coordinates/world-coordinates.md) — `toWorld` on a component: each detected object, key point or mask placed in meters, and point clouds for objects and the whole scene.
* [Visualizing in 3D](https://docs.eyepop.ai/platform/depth-and-world-coordinates/visualizing-in-3d.md) — plotting those points.

### Next steps

* [Pretrained, fixed classes](https://docs.eyepop.ai/platform/abilities/pretrained-fixed-classes.md) — every category, and sized variants
* [Open vocabulary](https://docs.eyepop.ai/platform/abilities/open-vocabulary.md) — models that find and classify what you describe in words

Questions about building a Pop? Reach us at <help@eyepop.ai>.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.eyepop.ai/platform/abilities/pretrained-fixed-classes/depth-estimation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
