Nodes/ComfyUI-RMBG/YOLOv8 Adv (RMBG)
ComfyUI Node Runs on cloud

YOLOv8 Adv (RMBG)

YOLO detection masks with confidence, IoU, and class filtering

By 1038lab·Created 2 years ago·Updated 12 days ago· 2,057
YOLOv8 Adv (RMBG)
  • images
  • ANNOTATED_IMAGE
  • MASK
  • MASK_LIST
yolo_modelPut .pt models into /tmp/ComfyUI/models/ultralytics
mask_countall
select_mask_indexnone
conf0.25
iou0.45
classes
deviceauto
max_det300
retina_maskstrue
agnostic_nmsfalse

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 on auto unless you're forcing CPU for a reason.
  • max_det (default 300) and agnostic_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, then pip 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.

Category🧪AILab/🧽RMBG

Inputs (11)

NameTypeDefaultDescription
imagesIMAGE
yolo_modelCOMBOPut .pt models into /tmp/ComfyUI/models/ultralyticsYOLOv8 weights stored under /tmp/ComfyUI/models/ultralytics (subfolders allowed).
mask_countCOMBOallMerge this many detections. 'all' merges everything (or just the selected index when specified).
select_mask_indexoptCOMBOnone1-based index of the first mask to keep. Use 'none' to start from the first detection.
confoptFLOAT0.250–1Confidence threshold forwarded to Ultralytics.
iouoptFLOAT0.450–1IOU used during NMS.
classesoptSTRINGComma list or ranges of class IDs; empty keeps every class.
deviceoptCOMBOautoForce a device or auto-detect CUDA → MPS → CPU.
max_detoptINT3001–1000Maximum detections per image.
retina_masksoptBOOLEANtrueUse high-resolution masks (Ultralytics retina_masks flag).
agnostic_nmsoptBOOLEANfalseEnable class-agnostic NMS.

Outputs (3)

NameTypeDescription
ANNOTATED_IMAGEIMAGE
MASKMASK
MASK_LISTMASK