Yolov8DetectionSegmentation
The tiny YOLO node that crops exactly what you point it at — no Impact Pack required
- image
- cropped image
- cropped mask
- image pass through
- x
- y
- width
- height
- mask
- debug image
Most face-detail workflows in ComfyUI run on Impact Pack, which is great until you realize you pulled in two dozen nodes to do one crop. Yolov8DetectionSegmentation (the class name is Yolov8DS) is the opposite: a single-node YOLOv8 detector that finds an object and hands you the crop, the mask, and the box coordinates. It's the "detect" half of the detect-crop-refine loop, and it's small enough that you can read its entire source in one sitting.
The honest pitch: you're already comfortable wiring a KSampler by hand, and you want a detector without Impact Pack's surface area. The catch, and it's a real one, is that this node only detects and crops. The resample-and-paste-back is on you (its sibling node, ImageCompositeBlurred, does the pasting). If you want a one-click FaceDetailer experience, this isn't it.
How it works
Under the hood it's ultralytics, plain and simple. The node loads whichever .pt file you pick from your models/yolov8 folder, runs YOLO(image), and takes the first bounding box it finds - the source has a TODO: only one image supported comment, which is your warning that "first" isn't a polite "best". If you point it at a crowd, you get whatever box came out first, so keep that in mind for anything with more than one subject.
Three inputs, all required: image, model_name (a dropdown populated from your yolov8 model folder), and class_id (default 0, which is person in the standard COCO classes that most YOLOv8 weights ship with). Set class_id to 0 and a stock person detector finds people; set it to 2 for car, and so on.
The outputs are the interesting part, and there are nine of them. The ones you'll actually wire:
- cropped image - the box region, cut out of your render
- cropped mask - matches the crop, ready to feed an inpaint/denoise pass
- mask - the same mask but at full input image size (the README is explicit: mask output size equals input image size)
- x, y, width, height - the box geometry, which is exactly what you feed to ImageCompositeBlurred to put the crop back
- image pass through - the original untouched image, handy for building branches off
- debug image - the annotated render with boxes/masks drawn, via
results[0].plot()
Segmentation vs. detection
Here's the sneaky bit that trips people up: the model filename decides the mode. If the name contains seg, Seg, or SEG, the node runs the segmentation branch and you get a proper object-shaped mask. Any other name, and you get a rectangular box mask - even if the model is a seg model. Name your files deliberately, or "seg" in a filename will silently change your masks.
In segmentation mode, class_id filters which detected class's mask you get (masks for classes where box.cls == class_id), and the full-frame mask is upscaled back to input resolution with cv2.
Install
From ComfyUI Manager, search comfyui-yolov8-simple and install. Or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/dskjal/comfyui-yolov8-simple
Then restart ComfyUI. The one real dependency is ultralytics==8.3.224, pinned in requirements.txt (Manager installs it for you). The models themselves don't come with the pack - you download them and drop them in ComfyUI/models/yolov8. Any .pt works, including the same bingsu/adetailer face and hand YOLOs the big packs use, which means detection quality is comparable to Impact Pack - you're just trading away its detailer machinery.
Where people get burned
Nothing detected = crash, not empty output. The README is upfront about this: the node just stops when it finds nothing, because returning the input image would push unprocessed images into a detailer loop and OOM it. If your image has no person and you didn't gate the downstream, the workflow dies mid-graph. You need a gate or reroute node before it, or the author's sibling pack comfyui-yolov8-dsuksampler which handles the no-detection case.
Two smaller notes. Because this pulls ultralytics, you're depending on the same AGPL library that had the December 2024 supply-chain scare; the version here is pinned, which is fine, but it's worth knowing what you're installing. And the debug image uses the ultralytics plotting path, which needs opencv - it's a transitive dependency, so it usually "just works," but a stripped install can throw on the seg branch.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| model_name | COMBO | 0 options: | |
| class_id | INT | 0 | — |
Outputs (9)
| Name | Type | Description |
|---|---|---|
| cropped image | IMAGE | — |
| cropped mask | MASK | — |
| image pass through | IMAGE | — |
| x | INT | — |
| y | INT | — |
| width | INT | — |
| height | INT | — |
| mask | MASK | — |
| debug image | IMAGE | — |