ComfyUI Node
CV DNN Mask Output
Converts a segmentation model's raw NCHW output blob into a ComfyUI MASK. Squeezes the batch/channel dims, optionally applies sigmoid (for models that output logits), resizes to the original image size and normalises to 0-1. Pair with 'OpenCV DNN Forward' (engine=classic for Swin-Transformer models like BiRefNet).
CV DNN Mask Output
- blob
- image
- mask
◄sigmoidauto►
◄width0►
◄height0►
Categoryimage/CV/dnn
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| blob | NPARRAY | Raw output from 'CV DNN Forward'. Typically (1, 1, H, W) for a single-channel segmentation model. | |
| sigmoid | COMBO | auto | 'auto' applies sigmoid only when values lie outside [0, 1] (i.e. raw logits). 'yes' always applies it. 'no' skips it (model already outputs probabilities). |
| imageopt | NPARRAY,IMAGE | Original input image, used to read the target resize dimensions. If disconnected, 'width' and 'height' widgets are used instead (0 = keep the model's native resolution). Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size. | |
| widthopt | INT | 00–8192 | Target mask width in px. 0 = keep the model's output resolution (or use the connected image's width). |
| heightopt | INT | 00–8192 | Target mask height in px. 0 = keep the model's output resolution (or use the connected image's height). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | Float32 MASK in [0, 1] at the target resolution. Feed into 'Overlay Masks' or any mask consumer. |