Nodes/ComfyUI-Transformers/Depth Estimation
ComfyUI Node

Depth Estimation

Depth Estimation

By kadirnar·Created 3 years ago·Updated 7 months ago· 25
Depth Estimation
  • image
  • model
  • processor
  • IMAGE

Depth Estimation turns a flat image into a grayscale depth map - white for close, black for far - and that map is the raw material for a bunch of interesting things: ControlNet depth conditioning, parallax "living photo" effects, or just geometry to feed elsewhere. This node is the inference half of the pack's two-node depth workflow, and it's the one node in ComfyUI-Transformers that was clearly built with a real ComfyUI use case in mind.

It's also the pack's odd one out mechanically. Instead of a pipeline() wrapper, it loads the model directly with AutoModelForDepthEstimation and the processor, runs inference under torch.no_grad(), interpolates the predicted depth map back up to your image's resolution, and normalizes it. Crucially, it uses comfy.model_management for device placement and shows a progress bar - it plays nice with ComfyUI's memory management rather than grabbing whatever CUDA device it wants.

The workflow

Depth Estimation is not a standalone node - it needs its sibling. First, Load Depth Model (default Intel/dpt-hybrid-midas) to get a DEPTH_MODEL and an IMAGE_PROCESSOR out. Wire both into this node along with your IMAGE:

  • image - the tensor to estimate depth from.
  • model - the DEPTH_MODEL from Load Depth Model.
  • processor - the IMAGE_PROCESSOR from Load Depth Model.

The output is a single grayscale IMAGE (depth map, normalized 0–1). From there you can feed it to a ControlNet depth preprocessor/loader, or use it for parallax effects.

How to install it

Standard pack install - ComfyUI Manager (search "ComfyUI-Transformers") or:

cd ComfyUI/custom_nodes
git clone https://github.com/kadirnar/ComfyUI-Transformers

Restart ComfyUI. requirements.txt covers transformers>=4.42, torch, and friends; the DPT-hybrid-MiDaS checkpoint is a few hundred MB on first load.

Where people get burned

Two setup traps. First, the default is MiDaS-class DPT - fine and historically the standard, but the community's current default for depth is Depth Anything, which produces sharper edges for ControlNet conditioning. You can type a Depth Anything model ID into the Load Depth Model node if it supports the task, but the pack ships with MiDaS framing, so manage expectations. Second, forgetting the Load Depth Model node entirely: beginners try to feed just an image and hit an unmatchable DEPTH_MODEL input. The two-node split is deliberate - model loads once, inference runs many times. Get both nodes on the canvas and the pattern is actually convenient.

CategoryTransformers/DepthEstimation

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
modelDEPTH_MODEL
processorIMAGE_PROCESSOR

Outputs (1)

NameTypeDescription
IMAGEIMAGE