YOLOv8 (RMBG)
Detection-model masks for faces, people, and objects
- images
- ANNOTATED_IMAGE
- MASK
- MASK_LIST
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.ptyou dropped intomodels/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. Useallfor 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, thenpip 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.
Inputs (4)
| 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. Advanced controls available on YOLOv8 Adv. |
| 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. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| ANNOTATED_IMAGE | IMAGE | — |
| MASK | MASK | — |
| MASK_LIST | MASK | — |