Depth Anything Tensorrt Format (CRT)
Fix TensorRT depth output so ComfyUI can actually use it
- depth_map
- IMAGE
Depth maps are the backbone of a lot of conditioning - ControlNet-style guidance, V2V depth control, relighting. And Depth Anything is the model everyone reaches for to produce them. But when you run Depth Anything through a TensorRT-optimized pipeline, the output can come out in shapes that ComfyUI's nodes quietly refuse to cooperate with: a raw 2D height×width tensor, a batch without a channel dimension, or a single-channel map when downstream wants RGB.
DepthAnythingTensorrtFormat is the adapter that fixes the seam. You feed it whatever TensorRT handed you, it normalizes the shape into a proper ComfyUI IMAGE tensor - batch, height, width, 3 channels - and optionally applies a colormap so you can see and use it.
How it works
The node is a shape detective. It looks at the incoming tensor's dimensionality and figures out what it actually is:
- 2D
(H, W)→ a single depth map, gets batch and channel dimensions. - 3D
(B, H, W)or(B, H, W, C)→ distinguished by whether the last dim looks like channels (≤ 4) or not. - 4D
(B, H, W, C)→ already in the right layout, passes through.
Once it's in (B, H, W, C) form it handles the value mapping. normalize (default on) rescales the depth values to the 0–1 range, which is what most downstream conditioning expects rather than the raw model output. Then colorize applies one of six looks: grayscale (default, the honest depth map) or the matplotlib-style colormaps viridis, plasma, inferno, magma, turbo - useful when you want a depth visualization you can actually eyeball in a preview node.
Inputs and outputs
- depth_map (
IMAGE) - the TensorRT output, in any of the accepted shapes. - normalize - scale to 0–1 (on by default).
- colorize - grayscale or one of five colormaps.
Output: a single IMAGE in standard ComfyUI format, ready for a ControlNet apply, a depth-to-latent path, or a V2V depth guide input.
Installing it
CRT-Nodes, so: ComfyUI Manager → CRT-Nodes, or clone + pip install -r requirements.txt, restart. Under CRT/Image. No model downloads - it's pure tensor reshaping.
Where people get burned
Mostly, people assume the node generates depth. It doesn't - it formats depth you've already produced with a Depth Anything / TensorRT pipeline. If you're not using TensorRT, you probably don't need this node; a stock Depth Anything preprocessor already outputs ComfyUI-friendly format. The other trap: normalize changes your values, and if your downstream wants raw inverse-depth (closer = higher), turning normalization on flips what "white means" compared to a source that's already scaled. If your conditioning suddenly inverts, toggle normalize and check the colorize preview.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| depth_map | IMAGE | — | |
| normalizeopt | BOOLEAN | true | — |
| colorizeopt | COMBO | grayscale | 6 options: grayscale, viridis, plasma, inferno, magma, turbo |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |