ComfyUI Node

YOLOE-26 Instance Masks

One mask per object, so you can grab the single dog out of the pack

By Rinne414·Created 6 months ago·Updated 2 months ago· 11
YOLOE-26 Instance Masks
  • model
  • image
  • instance_masks
  • instance_metadata_json
  • count
promptperson
conf0.10
iou0.70
max_det300
mask_threshold0.50
imgsz640

YOLOE-26 Prompt Segment gives you one merged mask for everything your prompt matched. That's fine when you want "all the people" masked at once. It's useless when you want that person - the one in the middle - and not the other eleven. This node is the per-instance version: it returns one mask per detected object, individually addressable, plus JSON that tells you which mask is which.

That single difference is what makes targeted editing possible. Per-instance masks feed per-object inpainting, one-at-a-time detail passes, object replacement, or the pack's own Select Best Instance node. Think of it as the difference between "remove the crowd" and "fix this one face."

How it works

Same segmentation pipeline as the rest of the pack - prompt to classes, set_classes() for embeddings, one predict pass with native-resolution masks. The difference is in the output stage: instead of unioning every instance into a single binary mask, the node keeps each instance's mask separate and outputs them as a batch.

The JSON it emits is what makes the batch navigable. Each entry records which input image a mask came from, its class, confidence, box, area, and - crucially - the output_mask_index, the position of that mask in the instance_masks batch. That's the key that lets other nodes (or your own scripts) map a detection record to its exact mask.

Inputs

The standard family again: model, image, prompt (comma-separated classes), conf, iou, max_det, mask_threshold, imgsz. Defaults are sane - conf 0.1, iou 0.7, max_det 300, imgsz 640. Lower conf to catch more instances, especially for anything unusual.

Outputs

  • instance_masks - a MASK batch, one mask per detected instance, in detection order. Position in the batch lines up with output_mask_index in the metadata.
  • instance_metadata_json - the per-detection records with the mapping to batch positions.
  • count - how many instances were detected.

A note on batch inputs: if you feed it several images, you get one flat batch of masks across all of them, and the metadata's batch index is how you tell which image each mask belongs to.

Installing and using it

The node lives in the Rinne414/ComfyUI-YOLOE26 pack. Install via ComfyUI Manager (search YOLOE-26) or:

cd ComfyUI/custom_nodes
git clone https://github.com/Rinne414/ComfyUI-YOLOE26.git
pip install -r ComfyUI-YOLOE26/requirements.txt

Restart ComfyUI. First run downloads the model and, on first prompt inference, the ~250 MB MobileCLIP text encoder - online required, one time.

Where it sits in a workflow

The natural pairing is Instance MasksSelect Best Instance, which picks the single best mask from this batch and gives you just that one. You can also pipe individual masks into inpainting per instance, or use the metadata in a loop. One caution from the author's own release post: edges are rougher than SAM's, so for anything where mask quality is the whole point, consider refining with Refine Mask or handing the job to SAM. This node is for when you need to work with objects one at a time - and it does exactly that.

CategoryYOLOE26

Inputs (8)

NameTypeDefaultDescription
modelYOLOE_MODEL
imageIMAGE
promptSTRINGpersonText prompt for open-vocabulary segmentation. Separate multiple classes with commas.
confoptFLOAT0.100–1Detection confidence threshold.
iouoptFLOAT0.700–1IoU threshold used by Ultralytics inference.
max_detoptINT3001–1000Maximum number of detections returned per image.
mask_thresholdoptFLOAT0.500–1Threshold used when binarizing instance masks. Recent Ultralytics releases already return binary masks, in which case values below 1.0 have no additional effect and exactly 1.0 empties every mask.
imgszoptINT64064–2048Inference image size.

Outputs (3)

NameTypeDescription
instance_masksMASK
instance_metadata_jsonSTRING
countINT