Nodes/comfyui_cv/CV DNN Forward All
ComfyUI Node

CV DNN Forward All

Loads a model (.onnx via readNetFromONNX, .tflite via readNetFromTFLite - picked from the file extension) and runs a forward pass returning ALL unconnected output layers at once (multi-output models like YOLO seg heads: a detection tensor + a mask-prototype map). Generic INFERENCE step - pair 'CV DNN Blob From Image' before it and 'CV DNN Pick Output' + a decoder after it. The forward pass runs in the interruptible DNN worker. Leave output_layers blank for every unconnected output, or give a comma-separated list of layer names. MULTI-INPUT models (an optical-flow or change-detection net that takes two frames) are driven through input_names: the blob's batch dimension is split into one group per name.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV DNN Forward All
  • blob
  • outputs
  • output_names
  • count
model
output_layers
backendauto (default backend)
targetauto (default target)
engineauto (default engine)
input_names
Categoryimage/CV/dnn

Inputs (7)

NameTypeDefaultDescription
blobNPARRAY(N, C, H, W) NCHW input blob from 'CV DNN Blob From Image'.
modelCOMBOModel file from ComfyUI/models/onnx (.onnx or .tflite; the loader is picked from the extension).
output_layersoptSTRINGComma-separated output layer names to fetch. Blank = every unconnected output layer (right for most models).
backendoptCOMBOauto (default backend)Compute backend (cv2.dnn.setPreferableBackend). 'auto' leaves the net on its default and is right for almost every model. Listed is not usable: this wheel has no CUDA and no OpenVINO, so those two raise on the classic engine. The GRAPH engine ignores the setting entirely, and OpenCV 5.1 removed the classic engine that honoured it - so on this build the widget has no effect.
targetoptCOMBOauto (default target)Compute target / device (cv2.dnn.setPreferableTarget). 'auto' leaves the net on its default (CPU). Honoured on the CLASSIC engine only, which OpenCV 5.1 removed, and this build reports haveOpenCL() == False - so the widget currently does nothing. HISTORICAL (5.0 classic engine): OpenCL was usually SLOWER - squeezenet 3.6x faster, but yolo26n-seg 0.73x, EAST 0.68x, RAFT 0.26x, YuNet 0.07x.
engineoptCOMBOauto (default engine)DNN engine for ONNX models (cv2.dnn.readNetFromONNX). Ignored for .tflite files. 'auto' lets OpenCV pick. The options depend on the build: OpenCV 5.1 merged 'classic' and 'new graph' into one engine, so 'auto' is the only meaningful choice there, and 'ONNX Runtime' falls back to it unless the build has WITH_ONNXRUNTIME=ON. NOTE for two-frame models: the opencv-zoo RAFT export returns an all-NaN field for some input pairs on the graph engine, whatever this widget says - 'CV Dense Flow (DNN Model)' recovers most of them by re-running with input_names reversed and negating the flow.
input_namesoptSTRINGComma-separated NETWORK INPUT names for a multi-input model. Blank = one unnamed setInput (right for the usual single-input model). With K names the blob's batch dimension N is split into K equal groups, one fed to each named input - so a 2-frame IMAGE batch through 'DNN Blob From Image' drives a two-frame model with input_names = '0,1' (opencv-zoo RAFT), or 'image0,image1' / 'left,right' for other exports. N must be a multiple of K. The groups are CONTIGUOUS, so a batch of pairs is laid out [all first frames][all second frames], NOT interleaved. Whether a batch works at all is the MODEL's business: many two-input exports (opencv-zoo RAFT among them) freeze batch 1 into their constants, and a 2-pair blob then dies in a Concat layer with 'Inconsistent shape' - feed one pair per execution and loop for more. All groups share the one blob's preprocessing, so this fits models whose inputs are images of the SAME size and scaling; a model mixing images with a differently-shaped input is out of reach here.

Outputs (3)

NameTypeDescription
outputsNPARRAYList of raw output arrays, one per fetched layer, in the same order as output_names. Feed 'CV DNN Pick Output' to select one, or 'Inspect CV Data'.
output_namesSTRINGNewline-separated names of the fetched layers, aligned with 'outputs'. Feed 'Preview as Text'.
countINTNumber of output layers fetched.