yuvraj108c/ComfyUI-Depth-Anything-Tensorrt

ComfyUI Depth Anything (v1/v2/v3/distill-any-depth) Tensorrt Custom Node (up to 14x faster) ⚡

Python

136

54 commits

updated Jun 4, 2026

See the code

README

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

DeviceModelModel Input (WxH)Image Resolution (WxH)FPS
RTX4090Depth-Anything-S518x5181280x72035
RTX4090Depth-Anything-B518x5181280x72033
RTX4090Depth-Anything-L518x5181280x72024
H100Depth-Anything-L518x5181280x720125+

⏱️ Performance (Depth Anything V2)

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

DeviceModelModel Input (WxH)Image Resolution (WxH)FPS
H100Depth-Anything-S518x5181280x720213
H100Depth-Anything-B518x5181280x720180
H100Depth-Anything-L518x5181280x720109

⏱️ Performance (Depth Anything V3)

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

DeviceModelModel Input (WxH)Image Resolution (WxH)FPS
RTX5090DA3Mono-Large518x5181280x72085
RTX5090DA3Metric-Large518x5181280x72085

⏱️ Performance (Distill Any Depth)

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

DeviceModelModel Input (WxH)Image Resolution (WxH)FPS
H100Distill-Any-Depth-Multi-Teacher-Small518x5181280x72076
H100Distill-Any-Depth-Multi-Teacher-Base518x5181280x72068
H100Distill-Any-Depth-Multi-Teacher-Large518x5181280x72059
H100Distill-Any-Depth-Dav2-Teacher-Large-2w-iter518x5181280x72057

🚀 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
  1. 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.
    ParameterDefaultRangeDescription
    temporal_strength0.450.0 – 0.95Controls how strongly stable pixels inherit depth from the previous stabilized frame. Higher values reduce more flicker but may introduce trails.
    depth_consistency0.050.001 – 0.50Controls which depth changes are considered stable enough to smooth. Lower values better preserve motion and object edges.
    align_depth_rangetruetrue/falseCorrects frame-to-frame global relative-depth scale and offset pulsing before temporal smoothing.
    alignment_strength0.700.0 – 1.0Controls 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:
    ParameterDefaultRangeDescription
    colormap—grayscale, inferno, viridis, plasma, magma, turbo, jet, hot, cool, spring, summer, autumn, winter, bone, rainbow, ocean, hsv, parula, pinkColor scheme for depth visualization
    invertfalsetrue/falseFlip depth so near becomes far and vice versa
    contrast1.00.1 – 5.0Spread of depth values around the midpoint
    brightness0.0-1.0 – 1.0Shifts all depth values up or down
    gamma1.00.1 – 5.0Non-linear tone curve. Below 1.0 reveals detail in distant regions, above 1.0 in near regions
    percentile_clip2.00.0 – 20.0Clips 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

comfyui
comfyui-nodes
depth-anything
depth-map
onnx
stable-diffusion
tensorrt
tensorrt-inference

yuvraj108c/ComfyUI-Depth-Anything-Tensorrt

ComfyUI Depth Anything (v1/v2/v3/distill-any-depth) Tensorrt Custom Node (up to 14x faster) ⚡

Python

136

54 commits

updated Jun 4, 2026

See the code

README

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

DeviceModelModel Input (WxH)Image Resolution (WxH)FPS
RTX4090Depth-Anything-S518x5181280x72035
RTX4090Depth-Anything-B518x5181280x72033
RTX4090Depth-Anything-L518x5181280x72024
H100Depth-Anything-L518x5181280x720125+

⏱️ Performance (Depth Anything V2)

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

DeviceModelModel Input (WxH)Image Resolution (WxH)FPS
H100Depth-Anything-S518x5181280x720213
H100Depth-Anything-B518x5181280x720180
H100Depth-Anything-L518x5181280x720109

⏱️ Performance (Depth Anything V3)

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

DeviceModelModel Input (WxH)Image Resolution (WxH)FPS
RTX5090DA3Mono-Large518x5181280x72085
RTX5090DA3Metric-Large518x5181280x72085

⏱️ Performance (Distill Any Depth)

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

DeviceModelModel Input (WxH)Image Resolution (WxH)FPS
H100Distill-Any-Depth-Multi-Teacher-Small518x5181280x72076
H100Distill-Any-Depth-Multi-Teacher-Base518x5181280x72068
H100Distill-Any-Depth-Multi-Teacher-Large518x5181280x72059
H100Distill-Any-Depth-Dav2-Teacher-Large-2w-iter518x5181280x72057

🚀 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
  1. 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.
    ParameterDefaultRangeDescription
    temporal_strength0.450.0 – 0.95Controls how strongly stable pixels inherit depth from the previous stabilized frame. Higher values reduce more flicker but may introduce trails.
    depth_consistency0.050.001 – 0.50Controls which depth changes are considered stable enough to smooth. Lower values better preserve motion and object edges.
    align_depth_rangetruetrue/falseCorrects frame-to-frame global relative-depth scale and offset pulsing before temporal smoothing.
    alignment_strength0.700.0 – 1.0Controls 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:
    ParameterDefaultRangeDescription
    colormap—grayscale, inferno, viridis, plasma, magma, turbo, jet, hot, cool, spring, summer, autumn, winter, bone, rainbow, ocean, hsv, parula, pinkColor scheme for depth visualization
    invertfalsetrue/falseFlip depth so near becomes far and vice versa
    contrast1.00.1 – 5.0Spread of depth values around the midpoint
    brightness0.0-1.0 – 1.0Shifts all depth values up or down
    gamma1.00.1 – 5.0Non-linear tone curve. Below 1.0 reveals detail in distant regions, above 1.0 in near regions
    percentile_clip2.00.0 – 20.0Clips 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

comfyui
comfyui-nodes
depth-anything
depth-map
onnx
stable-diffusion
tensorrt
tensorrt-inference