Nodes/comfyui_cv/CV YOLO Detect Decode
ComfyUI Node

CV YOLO Detect Decode

Unwraps a YOLO-family detection head into bounding boxes, scores, class ids and labels - WITHOUT any mask handling, so detection-only models work too (chain 'CV YOLO Seg Masks' for instance segmentation). The 'layout' dropdown covers the common head formats: 'rows: xyxy + conf + class id' for NMS-free end-to-end heads (yolo26/yolov11, rows [x1, y1, x2, y2, conf, class_id, ...] in letterboxed pixels, any extra columns pass through to det_rows for the mask stage); 'rows/''columns: xywh center + class scores' for yolov5/v8 heads (per-class score columns, cxcywh boxes, NMS applied); 'separate boxes + confs' for yolov4-style ONNX exports (normalized xyxy boxes (1, N, 1, 4) in 'det' + per-class confidences (1, N, C) wired to 'confs', NMS applied). Boxes are un-letterboxed back to the original image. DATA only - draw with the core 'Draw BBoxes' node. Zero detections is a valid result (found=false, empty outputs). Processes a single image (the first frame of a batch).

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV YOLO Detect Decode
  • det
  • image
  • confs
  • bboxes
  • scores
  • class_ids
  • labels_out
  • det_rows
  • det_count
  • found
ratio1.000
pad_left0
pad_top0
net_size640
conf_threshold0.50
layoutrows: xyxy + conf + class id (NMS-free)
nms_threshold0.45
labels
Categoryimage/CV/dnn

Inputs (11)

NameTypeDefaultDescription
detNPARRAYDetection head output. Shape depends on 'layout': (1, N, 6+C)/(N, 6+C) rows for the NMS-free layout, (N, 4+C) or (1, 4+C, N) for the class-scores layouts, (1, N, 1, 4) normalized xyxy for the separate-boxes layout.
imageNPARRAY,IMAGEThe ORIGINAL image (before letterboxing) - its size is the bbox 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.
ratioFLOAT1.0000.000001–100Letterbox resize ratio from 'CV DNN Letterbox' (1.0 if the image was not letterboxed).
pad_leftINT00–4096Letterbox left padding from 'CV DNN Letterbox'.
pad_topINT00–4096Letterbox top padding from 'CV DNN Letterbox'.
net_sizeINT64032–4096Square letterboxed input size the model ran at. Only used by the 'separate boxes + confs' layout, whose boxes are normalized to [0, 1] of it.
conf_thresholdFLOAT0.500–1Minimum confidence to keep a detection. Lower detects more (and more false positives).
layoutCOMBOrows: xyxy + conf + class id (NMS-free)The detection head's row/column format (see the node description).
confsoptNPARRAYPer-class confidence tensor (1, N, C) - REQUIRED for the 'separate boxes + confs' layout, ignored otherwise.
nms_thresholdoptFLOAT0.450–1Non-maximum suppression IoU, used by the NMS layouts: boxes overlapping by more than this are merged.
labelsoptSTRINGClass names, one per line (line N = class id N), e.g. from 'CV Load Labels'. Blank = detections are labelled by their numeric class id.

Outputs (7)

NameTypeDescription
bboxesBOUNDING_BOXOne {x, y, width, height, score, label} dict per detection in ORIGINAL-image pixels - feed the core 'Draw BBoxes' node.
scoresNPARRAY(N,) float32 confidence per detection, same order as bboxes.
class_idsNPARRAY(N,) int32 class id per detection, same order as bboxes.
labels_outNPARRAY(N,) string array of the class label per detection (the name from 'labels', or the numeric id). Feed 'Preview as Text'.
det_rowsNPARRAY(N, 6+K) float32 kept rows in LETTERBOXED pixels [x1, y1, x2, y2, conf, class_id, ...extra columns from the head - the NMS-free seg layout's mask coefficients ride along here]. Feed 'CV YOLO Seg Masks'. Empty (0, 6) when nothing is detected.
det_countINTNumber of detections kept.
foundBOOLEANTrue when at least one detection passed the confidence threshold. Feed an 'if/else' node to skip downstream visualization when empty.