YOLOv8 Adv (RMBG)
YOLO detection masks with confidence, IoU, and class filtering
- images
- ANNOTATED_IMAGE
- MASK
- MASK_LIST
Same YOLOv8 detection-to-mask job as the basic node, but with the detector's actual knobs exposed. If the plain YOLOv8 node is finding too much, too little, or the wrong things, this is where you fix it - confidence threshold, IoU for overlap merging, class filtering, device selection, the works. It's the difference between "run YOLO" and "run YOLO the way I need it."
Reach for Adv when the basic node's defaults aren't cutting it: you're getting false positives on a busy image, or two overlapping people are merging into one mask, or you only want detections of one specific class out of a model that knows eighty. All of that is a parameter away here.
The same setup applies
Like the basic node, this ships with no model and needs the optional ultralytics package. Drop a YOLOv8 .pt into ComfyUI/models/ultralytics (a face model, person model, or segmentation checkpoint), and install ultralytics with ./ComfyUI/python_embeded/python -m pip install ultralytics --no-deps - the --no-deps keeps it from pulling a conflicting torch. Without both, the node has nothing to run. The yolo_model dropdown's default is literally the instruction "Put .pt models into .../models/ultralytics," which is your reminder.
The inputs that matter
Beyond yolo_model, mask_count, and select_mask_index (which work exactly as in the basic node), Adv gives you the detector controls:
conf(0–1, default 0.25) - confidence threshold. The big one. Raise it to cut false positives (fewer, more-certain detections); lower it to catch faint or small subjects the model is unsure about. If you're getting junk detections, raise this first.iou(0–1, default 0.45) - the overlap threshold for non-max suppression. Controls how aggressively overlapping boxes get merged. Lower it when two close subjects keep collapsing into one; raise it if one subject is being split into several.classes- a filter string. Restrict detection to specific class IDs so a general model only reports, say, people and ignores everything else.device-auto/cuda/cpu/mps. Leave onautounless you're forcing CPU for a reason.max_det(default 300) andagnostic_nms(default off) - cap on total detections, and whether NMS ignores class when merging. Corner-case dials; defaults are fine for most work.retina_masks(default on) - higher-quality mask edges from the segmentation head. Leave it on unless you need the speed.
Outputs match the basic node: ANNOTATED_IMAGE (detections drawn on, for sanity-checking), MASK (combined), and MASK_LIST (one per detection).
How to install it
- ComfyUI Manager: search
Comfyui-RMBG, install, restart. - Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/1038lab/ComfyUI-RMBG, thenpip install -r requirements.txt, then the ultralytics step above, then restart.
Common issues
If it errors on run, you skipped ultralytics. If the dropdown is empty of real models, your .pt isn't in ComfyUI/models/ultralytics or you didn't restart. And the most common tuning mistake: cranking conf down to catch a hard-to-find subject and then drowning in false positives - tune conf and iou together, and use the ANNOTATED_IMAGE output to see exactly what changed with each adjustment instead of guessing. If you don't need any of these knobs, the plain YOLOv8 node is less to think about.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| yolo_model | COMBO | Put .pt models into /tmp/ComfyUI/models/ultralytics | YOLOv8 weights stored under /tmp/ComfyUI/models/ultralytics (subfolders allowed). |
| mask_count | COMBO | all | Merge this many detections. 'all' merges everything (or just the selected index when specified). |
| select_mask_indexopt | COMBO | none | 1-based index of the first mask to keep. Use 'none' to start from the first detection. |
| confopt | FLOAT | 0.250–1 | Confidence threshold forwarded to Ultralytics. |
| iouopt | FLOAT | 0.450–1 | IOU used during NMS. |
| classesopt | STRING | Comma list or ranges of class IDs; empty keeps every class. | |
| deviceopt | COMBO | auto | Force a device or auto-detect CUDA → MPS → CPU. |
| max_detopt | INT | 3001–1000 | Maximum detections per image. |
| retina_masksopt | BOOLEAN | true | Use high-resolution masks (Ultralytics retina_masks flag). |
| agnostic_nmsopt | BOOLEAN | false | Enable class-agnostic NMS. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| ANNOTATED_IMAGE | IMAGE | — |
| MASK | MASK | — |
| MASK_LIST | MASK | — |