Detect SEGS w/ Ultralytics
YOLO Detection That Feeds Straight Into Your Detailers
- image
- detector_model
- segs
- mask
Text-based detection (GroundingDINO + SAM) is powerful but slow and fiddly. Sometimes you just want to find faces, hands, or people with a fast YOLO model and get on with it. Detect SEGS w/ Ultralytics is that fast path: it runs an Ultralytics detector over your image and turns every hit into an Impact-compatible SEGS payload, ready for any SimpleSyrup or Impact detailer. Because SEGS is a shared language, the output plugs into Detail SEGS by Scale Factor, Detail SEGS as Regions, Batch SEGS, or Impact's own detailers without conversion.
How it works
You feed it an image and a detector_model (a DETECTOR_MODEL from the pack's Load Ultralytics Model node - any YOLO bounding-box or segmentation model you drop in). Then the node filters and shapes the detections:
- confidence_threshold (0.5): minimum detection confidence to keep.
- size_threshold (10): discard detections whose box is smaller than this in pixels wide or tall.
- keep_only (0) + keep_by (
highest confidence): keep at most this many regions, ranked as chosen; 0 keeps everything. - bbox_dilation / sub_dilation / post_dilation (all 0): grow or shrink detection boxes, the refinement mask, and the final SEG masks respectively - your three chances to adjust region bounds.
- crop_factor (3): context around each region. 0 uses the full image; higher makes larger SEG crops.
- sort_order (
largest to smallest): orders the returned SEGS - and remember order feeds the per-region conditioning batch downstream, so this matters. - combine_segs (false): return one unioned SEGS region instead of separate ones.
Outputs are segs (a list - individual regions, or combined if you toggled it) and mask (the combined detected area as a standard ComfyUI MASK, handy for drawing or VAE inpainting).
The workflow shape
The classic setup is: Load Ultralytics Model (pick a YOLO face or hand model) → Detect SEGS w/ Ultralytics → Detail SEGS by Scale Factor, with a [SEP]-split prompt batch from Encode Prompt Batch if you want each region addressed individually. That's the ADetailer loop, reassembled with far more control over region geometry.
One caution from history: Ultralytics has a demonstrated supply-chain incident (a compromised December 2024 package release), and it reached ComfyUI users through Impact Pack's YOLO path. This pack vendors Ultralytics as a real dependency, so it's worth being on a current install and not pinning ancient versions - the same advice that applies to any pack that pulls it.
Install
Ships in the SimpleSyrup pack. ComfyUI Manager → search SimpleSyrup → Install → restart, or:
Set-Location ComfyUI\custom_nodes
git clone https://github.com/Artificial-Sweetener/SimpleSyrup.git
Set-Location SimpleSyrup
..\..\venv\Scripts\python.exe -m pip install -r requirements.txt
Restart ComfyUI (current build required, v3 extension API). Ultralytics comes as part of the pack's requirements.
Common issues
- No regions detected - lower
confidence_threshold; also check the model actually matches your subject (a face model finds no hands). - Regions too tight/loose - use
bbox_dilationandpost_dilationbefore reaching forcrop_factor. - Wrong prompt per region -
sort_orderchanged the SEGS order, so the conditioning batch no longer lines up. - Missing nodes - update ComfyUI first.
It's the fastest detector-to-detailer bridge in the pack, and the filter knobs are good enough that you rarely need a second detector for cleanup.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Image to search for detectable regions. | |
| detector_model | DETECTOR_MODEL | Ultralytics model that finds boxes or masks in the input image. | |
| confidence_threshold | FLOAT | 0.500–1 | Minimum detection confidence required to keep a region. |
| size_threshold | INT | 101–8192 | Discard regions whose detected box is smaller than this many pixels wide or tall. |
| keep_only | INT | 00–4096 | Keep only this many detected regions after threshold filtering. Use 0 to keep all regions. |
| keep_by | COMBO | highest confidence | Choose how regions are ranked when Keep Only is greater than 0. |
| bbox_dilation | INT | 0-512–512 | Grow or shrink initial detection boxes in pixels before masks are built. |
| sub_dilation | INT | 0-512–512 | Grow or shrink the segmentation refinement mask in pixels before it is applied to detected regions. |
| post_dilation | INT | 0-512–512 | Grow or shrink each final cropped SEG mask in pixels after detection and refinement. |
| crop_factor | FLOAT | 3.00–100 | How much context to include around each detected region. Use 0 for the full image; higher values make larger SEG crops. |
| sort_order | COMBO | largest to smallest | Order the returned SEGS before output and before the combined mask is built. |
| combine_segs | BOOLEAN | false | Return one unioned SEGS region instead of separate regions. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| segs | SEGS | Detected regions as separate or combined SEGS based on combine_segs. |
| mask | MASK | Combined detected area as a standard ComfyUI mask. |