ComfyUI Node
CV YOLO Seg Masks
Builds one binary instance MASK per detection from the 'det_rows' of 'CV YOLO Detect Decode' (whose extra columns carry the mask coefficients) plus the model's (1, C, mh, mw) mask-prototype map. Mirrors ultralytics ops.process_mask: logits = coeffs @ proto, crop to the box in proto space, bilinear-upsample to the letterboxed input, threshold at 0 (sigmoid > 0.5), then un-letterbox back to the original image. Only the NMS-free seg layout carries coefficients - a detection-only model or layout raises a clear wiring error here. Zero detections is a valid result (empty mask batch). DATA only - visualize with 'Overlay Masks'. Processes a single image (the first frame of a batch).
CV YOLO Seg Masks
- det_rows
- proto
- image
- masks
- mask_count
◄ratio1.000►
◄pad_left0►
◄pad_top0►
◄net_size640►
Categoryimage/CV/dnn
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| det_rows | NPARRAY | The (N, 6+C) 'det_rows' from 'CV YOLO Detect Decode' (NMS-free seg layout): [x1, y1, x2, y2, conf, class_id, C mask coefficients] in LETTERBOXED pixels. | |
| proto | NPARRAY | Mask-prototype map, (1, C, mh, mw) or (C, mh, mw). C must equal the number of mask coefficients per det row. | |
| image | NPARRAY,IMAGE | The ORIGINAL image (before letterboxing) - its size is the mask target size. An IMAGE batch uses its first frame. 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. | |
| ratio | FLOAT | 1.0000.000001–100 | Letterbox resize ratio from 'CV DNN Letterbox' (1.0 if the image was not letterboxed). |
| pad_left | INT | 00–4096 | Letterbox left padding from 'CV DNN Letterbox'. |
| pad_top | INT | 00–4096 | Letterbox top padding from 'CV DNN Letterbox'. |
| net_size | INT | 64032–4096 | Square letterboxed input size the model ran at (the 'size' used in 'CV DNN Letterbox'). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| masks | MASK | (N, H, W) binary instance masks at the original image size, aligned row-for-row with the Detect Decode bboxes. Feed 'Overlay Masks' or any mask consumer. |
| mask_count | INT | Number of masks built (= the detection count). |