Home
Softono
ComfyUI-Depth-Anything-Tensorrt

ComfyUI-Depth-Anything-Tensorrt

Open source Python
131
Stars
14
Forks
1
Issues
5
Watchers
1 week
Last Commit

About ComfyUI-Depth-Anything-Tensorrt

<div align="center"> # ComfyUI Depth Anything TensorRT [![python](https://img.shields.io/badge/python-3.12.3-green)](https://www.python.org/downloads/release/python-3123//) [![cuda](https://img.shields.io/badge/cuda-13.1-green)](https://developer.nvidia.com/cuda-downloads) [![trt](https://img.shields.io/badge/TRT-10.14.1.48-green)](https://developer.nvidia.com/tensorrt) [![mit](https://img.shields.io/badge/license-MIT-blue)](https://github.com/spacewalk01/depth-anything-tensorrt/blob/main/LICENSE) </div> This repo provides a ComfyUI Custom Node implementation of the [Depth-Anything-Tensorrt](https://github.com/spacewalk01/depth-anything-tensorrt) in Python for ultra fast depth map generation (up to 14x faster than [comfyui_controlnet_aux](https://github.com/Fannovel16/comfyui_controlnet_aux)) **Last tested**: 03 June 2026 (ComfyUI v0.23.0 | Torch 2.12.0 | Python 3.12.3 | H100 | CUDA 13.0 | Ubuntu 24.04) <p align="center"> <img src="assets/demo.gif" /> </p> ## ⭐ Support If you like my projects and wi ...

Platforms

Web Self-hosted

Languages

Python

Links

ComfyUI Depth Anything TensorRT

python cuda trt mit

This repo provides a ComfyUI Custom Node implementation of the Depth-Anything-Tensorrt in Python for ultra fast depth map generation (up to 14x faster than comfyui_controlnet_aux)

Last tested: 03 June 2026 (ComfyUI v0.23.0 | Torch 2.12.0 | Python 3.12.3 | H100 | CUDA 13.0 | Ubuntu 24.04)

⭐ Support

If you like my projects and wish to see updates and new features, please consider supporting me. It helps a lot!

ComfyUI-Depth-Anything-Tensorrt ComfyUI-Upscaler-Tensorrt ComfyUI-Dwpose-Tensorrt ComfyUI-Rife-Tensorrt

ComfyUI-Whisper ComfyUI_InvSR ComfyUI-FLOAT ComfyUI-Thera ComfyUI-Video-Depth-Anything ComfyUI-PiperTTS

Special thanks to livepeer.org for having supported the project!

buy-me-coffees paypal-donation

⏱️ Performance (Depth Anything V1)

Note: The following results were benchmarked on FP16 engines inside ComfyUI

Device Model Model Input (WxH) Image Resolution (WxH) FPS
RTX4090 Depth-Anything-S 518x518 1280x720 35
RTX4090 Depth-Anything-B 518x518 1280x720 33
RTX4090 Depth-Anything-L 518x518 1280x720 24
H100 Depth-Anything-L 518x518 1280x720 125+

⏱️ Performance (Depth Anything V2)

Note: The following results were benchmarked on FP16 engines inside ComfyUI

Device Model Model Input (WxH) Image Resolution (WxH) FPS
H100 Depth-Anything-S 518x518 1280x720 213
H100 Depth-Anything-B 518x518 1280x720 180
H100 Depth-Anything-L 518x518 1280x720 109

⏱️ Performance (Depth Anything V3)

Note: The following results were benchmarked on FP16 engines inside ComfyUI

Device Model Model Input (WxH) Image Resolution (WxH) FPS
RTX5090 DA3Mono-Large 518x518 1280x720 85
RTX5090 DA3Metric-Large 518x518 1280x720 85

⏱️ Performance (Distill Any Depth)

Note: The following results were benchmarked on FP16 engines inside ComfyUI

Device Model Model Input (WxH) Image Resolution (WxH) FPS
H100 Distill-Any-Depth-Multi-Teacher-Small 518x518 1280x720 76
H100 Distill-Any-Depth-Multi-Teacher-Base 518x518 1280x720 68
H100 Distill-Any-Depth-Multi-Teacher-Large 518x518 1280x720 59
H100 Distill-Any-Depth-Dav2-Teacher-Large-2w-iter 518x518 1280x720 57

🚀 Installation

Navigate to the ComfyUI /custom_nodes directory

git clone https://github.com/yuvraj108c/ComfyUI-Depth-Anything-Tensorrt.git
cd ./ComfyUI-Depth-Anything-Tensorrt
pip install -r requirements.txt

🛠️ Building TensorRT Engine

There are two ways to build TensorRT engines:

Method 1: Using the EngineBuilder Node

  1. Insert node by Right Click -> tensorrt -> Depth Anything Engine Builder
  2. Select the model version (v1 or v2 or DAD) and size (small, base, or large)
  3. Optionally customize the engine name, FP16 settings, and onnx path
  4. Run the workflow to build the engine

The engine will be automatically downloaded and built in the specified location. Refresh the webpage or strike 'r' on your keyboard, and the new engine will appear in the Depth Anything Tensorrt node.

Method 2: Manual Building

  1. Download one of the available onnx models:
  2. Run the export script, e.g
    python export_trt.py --onnx-path ./depth_anything_vitl14-fp16.onnx --trt-path ./depth_anything_vitl14-fp16.engine
  3. Place the exported engine inside ComfyUI /models/tensorrt/depth-anything directory

☀️ Usage

Depth Anything Tensorrt (Basic)

  • Insert node by Right Click -> tensorrt -> Depth Anything Tensorrt
  • Choose the appropriate engine from the dropdown
  • Returns a grayscale depth image (IMAGE type) ready for direct use in workflows

Depth Anything Advanced + Temporal Stabilizer + Depth Map Display

For more control over depth visualization, use the advanced pipeline:

Depth Anything Tensorrt Advanced
        │ depths
        ▼
Depth Temporal Stabilizer Fast GPU    (optional, recommended for video)
        │ depths
        ▼
Depth Map Display
  1. Depth Anything Tensorrt Advanced (Right Click -> tensorrt -> Depth Anything Tensorrt Advanced)

    • Returns raw linear depth values instead of a processed image.
  2. Depth Temporal Stabilizer Fast GPU (Right Click -> tensorrt -> Depth Temporal Stabilizer Fast GPU)

    • Reduces mild frame-to-frame flickering and relative depth-range pulsing using fast CUDA temporal smoothing.
    • Very high smoothing values can cause trailing on fast-moving objects or strong camera motion.
    Parameter Default Range Description
    temporal_strength 0.45 0.0 – 0.95 Controls how strongly stable pixels inherit depth from the previous stabilized frame. Higher values reduce more flicker but may introduce trails.
    depth_consistency 0.05 0.001 – 0.50 Controls which depth changes are considered stable enough to smooth. Lower values better preserve motion and object edges.
    align_depth_range true true/false Corrects frame-to-frame global relative-depth scale and offset pulsing before temporal smoothing.
    alignment_strength 0.70 0.0 – 1.0 Controls how strongly global depth-range alignment is applied. Increasing this usually has less ghosting risk than increasing temporal smoothing.
  3. Depth Map Display (Right Click -> tensorrt -> Depth Map Display)

    • Visualizes raw depth values using colormaps with the following adjustments:
    Parameter Default Range Description
    colormap grayscale, inferno, viridis, plasma, magma, turbo, jet, hot, cool, spring, summer, autumn, winter, bone, rainbow, ocean, hsv, parula, pink Color scheme for depth visualization
    invert false true/false Flip depth so near becomes far and vice versa
    contrast 1.0 0.1 – 5.0 Spread of depth values around the midpoint
    brightness 0.0 -1.0 – 1.0 Shifts all depth values up or down
    gamma 1.0 0.1 – 5.0 Non-linear tone curve. Below 1.0 reveals detail in distant regions, above 1.0 in near regions
    percentile_clip 2.0 0.0 – 20.0 Clips outlier depth values at this percentile from both ends before normalizing. Prevents extreme values from compressing the useful range

📝 Changelog

  • 03/06/2026

    • Added fast GPU-based temporal depth stabilizer node to reduce flickering in video depth maps
  • 02/06/2026

    • Added example workflows
  • 31/01/2026

    • Added multiple depth colormaps
    • Added Depth Map Display adjustments: contrast, brightness, gamma, percentile clipping
    • Added tooltips, descriptions, and output tooltips to all nodes
  • 29/01/2026

    • Major refactoring (file structure, logging)
    • Moved model definitions to config/models.json
    • Use huggingface_hub to download onnx models
  • 10/01/2026

  • 16/09/2025

  • 08/07/2025

  • 20/05/2025

  • 02/07/2024

    • Add Depth Anything V2 onnx models + benchmarks
    • Merge PR for engine caching in memory by BuffMcBigHuge
  • 26/04/2024

    • Update to tensorrt 10.0.1
    • Massive code refactor, remove trtexec, remove pycuda, show engine building progress
    • Update and standardise engine directory and node category for upcoming tensorrt custom nodes suite
  • 7/04/2024

    • Fix image resize bug during depth map post processing
  • 30/03/2024

    • Fix CUDNN_STATUS_MAPPING_ERROR
  • 27/03/2024

    • Major refactor and optimisation (remove subprocess)

👏 Credits