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

YOLOv8 (RMBG)

Detection-model masks for faces, people, and objects

By 1038lab·Created 2 years ago·Updated 12 days ago· 2,057
YOLOv8 (RMBG)
  • images
  • ANNOTATED_IMAGE
  • MASK
  • MASK_LIST
yolo_modelPut .pt models into /tmp/ComfyUI/models/ultralytics
mask_countall
select_mask_indexnone

YOLOv8 is a fast object detector, and this node turns its detections into masks inside ComfyUI. Point it at an image with a face-detection model loaded and you get masks around every face; load a person model and you get people; load a segmentation model and you get object masks. It's the detect-then-mask pattern that ADetailer made famous, exposed as a plain node.

The reason you'd reach for it: YOLO is quick and it's good at the "find all the instances of this thing" job - faces, hands, people, whatever your .pt model was trained on. That's different from a background remover (subject vs. background) and different from Florence-2 (text-prompted). YOLO is class-based and batchy: it finds every detection of the classes its model knows, and you pick which ones you want.

The catch you need to know up front

This node ships with no model. Look at the yolo_model dropdown and you'll see the default option is literally the instruction: Put .pt models into .../ComfyUI/models/ultralytics. That's not a bug - it's telling you where to put weights. Drop a YOLOv8 .pt file (a face model like face_yolov8m.pt, a person model, or any Ultralytics segmentation checkpoint) into ComfyUI/models/ultralytics, restart, and it'll show up in the dropdown. Until you do that, the node has nothing to run.

The other requirement: YOLO needs the ultralytics Python package, which the pack keeps optional on purpose to avoid dependency conflicts for people who don't use YOLO. Install it yourself with ./ComfyUI/python_embeded/python -m pip install ultralytics --no-deps. The --no-deps matters - it stops ultralytics from dragging in a conflicting torch or opencv.

The inputs and outputs that matter

  • yolo_model - the .pt you dropped into models/ultralytics. This is the whole ballgame; the model decides what gets detected.
  • mask_count - how many detections to turn into masks: all, or a number 1–10. Use all for batch face-fixing, a small number when you only care about the biggest subjects.
  • select_mask_index (optional) - pick a single detection by index (1–10) instead of returning everything. Useful when there are three faces and you only want the second.

Outputs: ANNOTATED_IMAGE (the input with detection boxes drawn on - great for sanity-checking what got found), MASK (the combined mask), and MASK_LIST (one mask per detection, so you can iterate over them downstream).

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 the node loads but the dropdown only shows the "Put .pt models..." placeholder, you haven't added a model yet, or it's in the wrong folder - it must be ComfyUI/models/ultralytics, and you must restart after adding it. If it errors on execution with an import complaint, you skipped the ultralytics install. And if you want more control than this node gives - confidence thresholds, IoU, class filtering, device selection - that's exactly what the YOLOv8 Adv node in the same pack adds. This one is the fast path; the Adv node is when you need to tune the detector.

Category🧪AILab/🧽RMBG

Inputs (4)

NameTypeDefaultDescription
imagesIMAGE
yolo_modelCOMBOPut .pt models into /tmp/ComfyUI/models/ultralyticsYOLOv8 weights stored under /tmp/ComfyUI/models/ultralytics. Advanced controls available on YOLOv8 Adv.
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.

Outputs (3)

NameTypeDescription
ANNOTATED_IMAGEIMAGE
MASKMASK
MASK_LISTMASK