Depth Anything V2
Depth Anything V2 — the depth-map node hiding inside a background-removal pack
- da_model
- images
- depths
- depth_imgs
There's a perfectly good monocular depth estimator living inside a background-removal pack, and it exists for a very specific reason: PDFNet, the depth-guided segmentation model, needs depth maps, and the pack's author got tired of making you build a separate pipeline. So he adapted Kijai's Depth Anything V2 nodes, trimmed the silent downloader (no progress bars, cryptic filenames - his words), and dropped them in under RemBG_SET. The side effect is that you get a standalone depth node for free.
Depth Anything V2 is the HKU/TikTok model that's been the default ControlNet depth preprocessor for years, so this is serious tooling, not a toy. The node takes an image and produces a grayscale map where larger values mean the pixel is closer to the camera. It powers PDFNet automatically when you leave the processing node's depths socket empty - but you can also wire it up explicitly, which is the setup the 06_PDFNet_external_map example workflow demonstrates when the automatic path needs tuning.
Inputs and outputs
da_model(DAMODEL) - comes from the siblingLoad Depth Anything by namenode. There's no other way to get one, so the two nodes always travel together.images(IMAGE) - one or more images; they're normalized and scaled internally.batch_size(INT, default 1) - how many images to process at once. Raise it for video or batch runs.
Outputs:
depths(MASK) - the depth map itself. Feed this into thedepthsinput ofRemove background (full)orGet background mask, or use it as a mask anywhere else in ComfyUI.depth_imgs(IMAGE) - the same data as an image for nodes that don't accept masks. All three RGB channels carry the same buffer.
Install
It's part of the same pack - no extra install:
cd ComfyUI/custom_nodes
git clone https://github.com/set-soft/ComfyUI-RemoveBackground_SET
pip install -r ComfyUI-RemoveBackground_SET/requirements.txt
ComfyUI 0.3.48+, seconohe >= 1.0.6. The Depth Anything models download into ComfyUI/models/depthanything on first use.
Practical notes: pick the model size from the loader's dropdown - Base F16 is the sweet spot and what PDFNet was trained with. Depth maps here are a means to an end for most people, but if you're already doing relighting, ControlNet depth preprocessing, or any compositing where "how far is this pixel" matters, this node saves you installing a whole separate Kijai pack. One honest caveat from the README: depth computed frame-by-frame flickers on video, which is why it's aimed at stills and PDFNet-style still processing rather than temporal depth work. Cheap, self-contained, and genuinely useful beyond its day job.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| da_model | DAMODEL | The model from the `Load Depth Anything by name` node. | |
| images | IMAGE | One or more images to process, will be normalized and scaled. | |
| batch_size | INT | 11–256 | How many images to process at once |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| depths | MASK | The depth map |
| depth_imgs | IMAGE | The same map in a format compatible with nodes that needs an image. The three channels (R, G, B) are the same buffer, shared with the mask. |