DLSS 5 Depth Anything V2 Guide:
DLSS5DepthAnythingV2 estimates relative scene depth from individual images or image sequences using Depth Anything V2, helping experimental DLSS workflows understand the spatial arrangement of a scene. It creates a depth guide that distinguishes nearer surfaces from farther surroundings without requiring a depth camera or a manually constructed 3D scene. You can choose between three model sizes to balance detail, processing speed, and graphics-memory use. For sequences, its shared normalization keeps the depth scale more consistent across frames, reducing brightness fluctuations caused by independently rescaling each frame. However, the underlying model analyzes frames independently, so this is not a temporally aware video-depth model and cannot guarantee flicker-free results. Its estimates describe relative, inverse depth rather than measured distances in meters. The selected model downloads on first use and is cached in memory for reuse during the running session.
DLSS 5 Depth Anything V2 Guide Input Parameters:
images
Required input of type IMAGE containing one image or a sequence of frames to analyze. Each frame is processed independently to estimate its relative depth, while sequence-wide normalization can subsequently give the frames a shared depth range. The node expects ComfyUI image tensors with a batch dimension and color values normally ranging from 0 to 1; it clips values to this range and converts them to 8-bit images before model preprocessing. At least one frame is required. Larger images and longer sequences increase processing and memory demands, although inference resolution and the number of frames processed together are controlled separately. There is no default image or numeric minimum/maximum setting for this input.
model
Required selection specifying the Depth Anything V2 model to use. Available options are Small (recommended), Base, and Large, listed in that order; no explicit default is declared in the input definition. Small is the recommended general-purpose starting point and has 24.8 million parameters. Base and Large provide larger alternatives for detail comparisons but are slower and require more graphics memory than Small; a larger model does not guarantee better results for every scene. The choices load the Hugging Face repositories depth-anything/Depth-Anything-V2-Small-hf, depth-anything/Depth-Anything-V2-Base-hf, and depth-anything/Depth-Anything-V2-Large-hf, respectively. Model files download when first needed, and the loaded model and its image processor are reused for the same model and processing device. The supplied context notes noncommercial checkpoint terms for Base and Large, so check the selected model’s license before commercial use.
temporal_normalization
Required BOOLEAN setting with a default of True and options True or False. When enabled, the node calculates one normalization range for the entire sequence using the 2nd and 98th percentiles of depth values sampled at every eighth pixel along each spatial dimension. It then applies that shared range to every frame, helping the same relative depth maintain a more consistent brightness throughout the sequence. When disabled, each frame uses its own 2nd and 98th percentiles calculated across all its pixels, which can improve individual-frame contrast but allow visible brightness shifts between frames. In both modes, values outside the selected range are clipped to the final 0–1 interval. This setting changes how estimates are scaled, not how the model predicts them, so enabling it does not eliminate frame-to-frame estimation errors or provide true temporal tracking.
chunk_size
Required INT setting controlling how many frames are estimated together during each inference pass. The default is 4, the minimum is 1, and the maximum is 32. Larger chunks may improve throughput when your graphics card has enough spare memory, but they also increase peak inference-memory requirements; smaller chunks are useful when processing large models or encountering out-of-memory errors. A value of 1 processes one frame at a time and is a good troubleshooting setting. Chunk size does not add temporal understanding or change the sequence-wide normalization into per-chunk normalization: estimates from all chunks are collected before normalization. Reducing it also does not eliminate the memory required to hold the complete image sequence and accumulated depth results.
input_size
Optional INT setting controlling the size requested from the model’s image preprocessor. The default is 0, the minimum is 0, the maximum is 1536, and the interface step is 14. A value of 0 leaves the model’s native preprocessing unchanged, identified in the node tooltip as 518. A nonzero value supplies the requested height and width to the processor; its resizing rules handle the actual processed dimensions, including alignment to multiples of 14. Values such as 280 or 392 are useful starting points for faster, lower-memory guides, with a possible loss of small details and boundary accuracy. Higher values can retain more image detail but require more computation and memory. Regardless of this setting, the estimated depth is resized back to the original image dimensions before it is returned.
precision
Optional selection with options FP32 and FP16. The function default is FP32, which is also the first listed option and preserves the node’s standard full-precision inference behavior. FP16 enables CUDA automatic mixed precision, allowing suitable NVIDIA GPUs to perform parts of inference with lower-precision arithmetic; this can improve speed and reduce some inference-memory use, although benefits depend on your hardware and workload. It does not explicitly convert the entire cached model to half precision. CPU inference remains FP32 even when FP16 is selected. The node prefers the input’s CUDA device when applicable, otherwise uses an available CUDA device, and falls back to the CPU when CUDA is unavailable.
DLSS 5 Depth Anything V2 Guide Output Parameters:
depth
IMAGE output containing one normalized relative-depth image for each input frame, in the same order and at the original frame dimensions. These are grayscale guides represented as three identical color channels, so they can travel through ordinary ComfyUI image connections. Values range from 0 to 1 after percentile normalization and clipping. Because Depth Anything V2 provides relative inverse depth here, brighter areas generally represent nearer surfaces and darker areas represent farther surfaces; these brightness values are not physical distances and cannot be read as meters. With temporal normalization enabled, all frames share the same normalization range; otherwise, each frame’s brightness scale is adjusted independently. The output is returned on the same device as the supplied images and can be previewed or connected to a compatible depth-guidance input in an experimental DLSS workflow.
DLSS 5 Depth Anything V2 Guide Usage Tips:
- Start with
model = Small (recommended),temporal_normalization = True,chunk_size = 4,input_size = 0, andprecision = FP32for a baseline that follows the node’s recommended model and default processing behavior. - For faster previews on a CUDA GPU, try
input_size = 280or392withprecision = FP16. Compare thin objects, faces, and foreground edges against the native-preprocessing result before using these settings for your final guide. - If graphics memory is limited, reduce
chunk_sizeto1first, then lowerinput_sizeor switch from Base or Large to Small. Very long sequences can still consume substantial system memory because all results are collected before normalization. - Keep
temporal_normalization = Truefor continuous video shots. If you process a clip in separate node executions, each execution calculates its own depth range, so visible scale changes can occur where the resulting segments meet. - Consider processing unrelated shots separately. A shared normalization range across strongly different scenes may reduce useful contrast within an individual shot.
- Use
temporal_normalization = Falsewhen independent still-image contrast matters more than consistency across a batch. Avoid this setting for continuous video if you notice depth brightness pumping between frames. - Compare Base or Large against Small on a few representative frames before processing a full sequence. Check whether any improvement justifies the extra processing time and memory, and review the larger checkpoints’ noncommercial terms.
- If depth contours still flicker with shared normalization enabled, remember that normalization cannot correct changing frame-by-frame predictions. Consider the separate Video Depth Anything node for temporally aware estimation, or evaluate the available temporal depth-stabilization node.
- Allow time and network access for the first model download. Later executions can reuse downloaded files and the model already loaded in the current session, so the first run is not a reliable measure of normal inference speed.
- For experimental neural-rendering nodes that require temporal guidance, connect a compatible motion-vector guide alongside depth. This node estimates depth only; it does not produce motion vectors.
DLSS 5 Depth Anything V2 Guide Common Errors and Solutions:
Invalid depth precision, input size, chunk size or empty frame sequence.
- Explanation: This exact error is raised when
precisionis neitherFP32norFP16,input_sizeis negative,chunk_sizeis less than 1, or the image sequence contains no frames. - Solution: Select one of the listed precision options, use an input size from
0to1536, set chunk size from1to32, and verify that your image or video-loading node supplies at least one frame. If you call the node through a script, check the values passed directly to the function.
KeyError: 'unsupported model name'
- Explanation: A KeyError can occur if a script, API request, or outdated workflow supplies a model name that is not in the node’s model dictionary. The actual message will contain the unrecognized name rather than the illustrative text shown here.
- Solution: Reselect exactly
Small (recommended),Base, orLarge. If an older workflow contains a renamed option, update that selection and save the workflow again.
ModuleNotFoundError: No module named 'transformers'
- Explanation: This possible dependency error means the Python environment running ComfyUI cannot import the Transformers package used to load the depth model.
- Solution: Install the custom node’s documented requirements in the same Python environment that runs ComfyUI, then restart ComfyUI. For portable installations, use their bundled Python rather than an unrelated system installation.
OSError: Can't load image processor or model
- Explanation: A model-loading error with wording similar to this can occur when the selected Hugging Face files are unavailable, incompletely downloaded, inaccessible, or incompatible with the installed dependencies. The detailed message usually identifies the affected repository or file.
- Solution: Confirm internet access for the first run, check available disk space and permissions for the model cache, and retry. If the message indicates a damaged cached file, re-download the affected model files. If it names an unsupported model or processor type, update dependencies according to the custom node’s installation instructions.
ConnectionError, timeout, or SSL error during model download
- Explanation: These possible download errors indicate that the model host could not be reached reliably or that the environment could not verify its secure connection. They are network or environment issues rather than failures of depth estimation.
- Solution: Check your internet connection, proxy or firewall settings, and system clock. Retry after temporary service interruptions, and use an approved network configuration if your environment restricts downloads. Avoid disabling certificate verification as a workaround.
torch.OutOfMemoryError: CUDA out of memory
- Explanation: The selected model and current workload require more graphics memory than is available. Larger models, larger inference sizes, and larger chunks all increase memory demands.
- Solution: Set
chunk_size = 1, tryinput_size = 280or392, and chooseSmall (recommended). On CUDA, FP16 may reduce inference-memory use. Close other GPU-heavy applications; if necessary, restart ComfyUI to clear cached models loaded earlier in the session.
MemoryError or process terminated while processing a long sequence
- Explanation: System memory can be exhausted because the node prepares a CPU copy of the input and accumulates depth results for the entire sequence. Your operating system may terminate the process without a Python error message.
- Solution: Process fewer frames at once, reduce the source-frame dimensions upstream where acceptable, and close memory-heavy applications. Lowering chunk size helps inference memory but does not remove full-sequence storage requirements. If you split a video into separate executions, check for normalization changes at segment boundaries.
ValueError or RuntimeError concerning image shape or channels
- Explanation: These possible processor or tensor errors can occur when the supplied data does not match a normal ComfyUI IMAGE batch, such as a mask connected through an unsuitable conversion or a custom tensor with misplaced dimensions.
- Solution: Test the node with an ordinary RGB image from a standard image-loading node. Ensure any custom conversion produces a batch of images arranged as batch, height, width, and channels, with color values normally in the 0–1 range. Convert masks or unusual image formats into standard RGB images before estimating depth.
