Nodes/comfyui_cv/CV DNN Mask Output
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).

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV DNN Mask Output
  • blob
  • image
  • mask
sigmoidauto
width0
height0
Categoryimage/CV/dnn

Inputs (5)

NameTypeDefaultDescription
blobNPARRAYRaw output from 'CV DNN Forward'. Typically (1, 1, H, W) for a single-channel segmentation model.
sigmoidCOMBOauto'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).
imageoptNPARRAY,IMAGEOriginal 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.
widthoptINT00–8192Target mask width in px. 0 = keep the model's output resolution (or use the connected image's width).
heightoptINT00–8192Target mask height in px. 0 = keep the model's output resolution (or use the connected image's height).

Outputs (1)

NameTypeDescription
maskMASKFloat32 MASK in [0, 1] at the target resolution. Feed into 'Overlay Masks' or any mask consumer.