Depth Estimation
One depth node, five models, and a camera rig hidden inside
- image
- depth
- confidence
- extrinsics
- intrinsics
- camera_json
Depth maps are one of those things you don't think you need until you do. Feed this node an image and it hands back a grayscale map where brightness is distance - white is close, black is far - and that map does two very different jobs. It constrains a ControlNet pass so you can redraw a scene in another style while keeping the spatial layout, and it gives you raw geometry for parallax video, VR conversion, or a 3D print. Most people grab the Depth Anything preprocessors inside comfyui_controlnet_aux and stop there; this node is for the second job, and it goes a step further.
DepthEstimationNode (display name "Depth Estimation", by indie dev Limbicnation) packages the Depth-Anything family into one node with post-processing built in. It's on ComfyUI Manager and the Comfy Registry, and on first use it auto-downloads the model you pick from Hugging Face. No API, no key - the heaviest lift is that first download.
How it works
Under the hood it loads your model through the Hugging Face transformers depth-estimation pipeline, with a chain of fallbacks behind it: a direct PyTorch implementation of Depth Anything v2, then a MiDaS wrapper, then a hard MiDaS fallback. The source is defensive to a fault - it checks free VRAM before loading and silently drops to CPU if there isn't enough, and it validates its own output with a tiny test image after every load.
The model dropdown has seven entries: Depth-Anything Small/Base/Large (v1), V2-Small/V2-Base, plus MiDaS-Small and MiDaS-Base as legacy options. The README also advertises Depth-Anything-V3 models, but those only appear if you install the optional depth-anything-3 package first - that's why a fresh install doesn't show them. V2 models run in fp32 (fp16 proved unstable with them); v1 and MiDaS use fp16 on GPU. Speed/quality/VRAM ladder: MiDaS-Small fastest, V2-Small the sweet spot (~1.5 GB), V2-Base better (~2.5 GB), V1-Large best-looking but ~4 GB and slow.
The inputs that matter
The full list is in the info schema, but you'll actually touch three things:
- model_name - your main knob. Community consensus: Depth Anything V2 Large is the daily driver for ControlNet; V2-Small if you're just previewing.
- input_size - default 1024 (range 384–8192). This is the resolution the model runs at, and your first lever when something is slow or OOMs. Output gets resized back to your original dimensions, so dropping to 512 barely changes what you see.
- blur_radius and median_size - smoothing post-processing, default 0 (off), which is the right default: for ControlNet you usually want the sharp map, not a smeared one. Contrast and gamma toggles help when the map looks flat.
The two force_* flags are your troubleshooting kit: force_reload reloads the model even if it's cached, and force_cpu dumps everything on CPU - slower, but it gets you out of a CUDA dead end.
The outputs - and the trap
Five outputs: depth (the normalized 0–1 grayscale map, what you wire into a depth ControlNet or a depth-map viewer), confidence (per-pixel confidence visualization), and - here's the differentiator - extrinsics and intrinsics (camera pose tensors, [N, 3, 4] and [N, 3, 3] in OpenCV format) plus a camera_json string with all the camera parameters.
Where people get burned: those camera outputs are only populated when a DA3 model is loaded - the extrinsics/intrinsics flow comes from Depth Anything V3's pose estimation, and for every other model they come back empty. output_raw_depth is the companion flag for the geometry crowd: it returns unnormalized metric-ish depth instead of the 0–1 map, which is what a point-cloud pipeline wants. The node also batches, so you can feed it video frames and get per-frame maps in one pass.
Installing it
The easy way: ComfyUI Manager → search "Depth Estimation" → install, then restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Limbicnation/ComfyUIDepthEstimation.git
cd ComfyUIDepthEstimation
pip install -r requirements.txt
Restart ComfyUI. To unlock the DA3 models (optional, and Apache-2.0 licensed so commercial-friendly):
pip install git+https://github.com/ByteDance-Seed/Depth-Anything-3.git
Dependencies are transformers, timm, huggingface-hub and friends - nothing that isn't already in a typical ComfyUI environment - and the __init__.py is unusually graceful about missing ones: instead of crashing the UI, it registers a placeholder node that tells you exactly what to pip install.
Troubleshooting
- Node shows "Missing Dependencies": it's a placeholder, not a broken install - the node itself tells you the exact command to run.
- Model fails to load: first use needs internet for the download. Some v1 repos on HF can be gated (the README's fix is
huggingface-cli login), but the node keeps hardcoded direct-download URLs for V2 and MiDaS models to dodge that entirely. - CUDA out of memory: smaller model,
input_sizedown to 512 or 384, orforce_cpu. The node auto-falls back to CPU on VRAM checks, but it's slow there. - Garbage or unchanged output: enable
force_reloadand try a different model before blaming your input.
It's a niche node - a one-person project with a handful of search impressions on comfy.icu - but if your workflow's endpoint is a mesh, a parallax video, or a point cloud rather than a fresh generation, it's the shortest path from one image to a full camera pose.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| model_name | COMBO | 7 options: Depth-Anything-Small, Depth-Anything-Base, Depth-Anything-Large, Depth-Anything-V2-Small, Depth-Anything-V2-Base, MiDaS-Small, +1 | |
| input_sizeopt | INT | 1024384–8192 | — |
| blur_radiusopt | FLOAT | 0.00–100 | — |
| median_sizeopt | INT | 00–21 | — |
| apply_auto_contrastopt | BOOLEAN | false | — |
| apply_gammaopt | BOOLEAN | false | — |
| force_reloadopt | BOOLEAN | false | — |
| force_cpuopt | BOOLEAN | false | — |
| enable_camera_estimationopt | BOOLEAN | true | — |
| output_raw_depthopt | BOOLEAN | false | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| depth | IMAGE | — |
| confidence | IMAGE | — |
| extrinsics | CAMERA_EXTRINSICS | — |
| intrinsics | CAMERA_INTRINSICS | — |
| camera_json | STRING | — |