ComfyUI Node
CV DNN Forward
Loads an ONNX model with cv2.dnn.readNetFromONNX and runs a forward pass on the input blob. Generic INFERENCE step for any ONNX model - pair 'CV DNN Blob From Image' before it and 'CV DNN Images From Blob' after it to rebuild images. The forward pass runs in the interruptible DNN worker. Leave output_layer blank for the model's default output, or name a specific layer. The compute backend/target can be picked (advanced) for builds that support acceleration.
CV DNN Forward
- blob
- output
◄model▾►
◄output_layer►
◄backendauto (default backend)►
◄targetauto (default target)►
◄engineauto (default engine)►
Categoryimage/CV/dnn
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| blob | NPARRAY | (N, C, H, W) NCHW input blob from 'CV DNN Blob From Image' (or any NCHW float array). | |
| model | COMBO | ONNX model file from ComfyUI/models/onnx to run. | |
| output_layeropt | STRING | Name of the output layer to fetch. Blank = the model's single / default output (right for most models). | |
| backendopt | COMBO | auto (default backend) | Compute backend (cv2.dnn.setPreferableBackend). 'auto' leaves the net on its default and is right for almost every model. Only backends present in the loaded build are listed, but PRESENT IS NOT USABLE: this wheel is built without CUDA and without OpenVINO, so 'CUDA' and 'Inference Engine' raise on the classic engine. The GRAPH engine ignores this setting entirely (it warns 'Back-ends are not supported by the new graph engine for now'), and only the CLASSIC engine honoured it - OpenCV 5.1 removed that engine, so on this build the widget has NO effect on any model. |
| targetopt | COMBO | auto (default target) | Compute target / device (cv2.dnn.setPreferableTarget). 'auto' leaves the net on its default (CPU). Honoured on the CLASSIC engine only - OpenCV 5.1 removed that engine, and this build also reports haveOpenCL() == False, so the widget currently does NOTHING (squeezenet times identically across every target). HISTORICAL, on the 5.0 classic engine: OpenCL was a per-model lottery and usually a LOSS - squeezenet 3.6x faster, but yolo26n-seg 0.73x, EAST 0.68x, RAFT 0.26x and YuNet 0.07x (14x SLOWER), partly because that build's OpenCL kernel for 'dnn/activations' failed to compile and those layers fell back per-layer with a device round trip each way. |
| engineopt | COMBO | auto (default engine) | DNN engine passed to cv2.dnn.readNetFromONNX, chosen once at model load time. WHICH OPTIONS EXIST DEPENDS ON THE BUILD: OpenCV 5.0 offered 'classic' (the 4.x per-layer engine) and 'new graph'; 5.1 merged them into a single 'OpenCV (built-in graph)' - the graph engine - so there 'auto' is the only meaningful choice. 'ONNX Runtime' needs a build with WITH_ONNXRUNTIME=ON and otherwise falls back to the built-in engine with a warning. A workflow saved with an engine this build lacks is remapped and logs a warning - it does not silently become 'auto'. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | NPARRAY | The raw output blob from the network (NCHW for image models). Feed 'CV DNN Images From Blob' to turn an image output back into a picture, or 'Inspect CV Data' to see its shape. |