Nodes/SimpleSyrup/Detect SEGS w/ Ultralytics
ComfyUI Node

Detect SEGS w/ Ultralytics

YOLO Detection That Feeds Straight Into Your Detailers

By Artificial-Sweetener·Created 3 months ago·Updated 12 days ago· 2
Detect SEGS w/ Ultralytics
  • image
  • detector_model
  • segs
  • mask
confidence_threshold0.50
size_threshold10
keep_only0
keep_byhighest confidence
bbox_dilation0
sub_dilation0
post_dilation0
crop_factor3.0
sort_orderlargest to smallest
combine_segsfalse

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/ UltralyticsDetail 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_dilation and post_dilation before reaching for crop_factor.
  • Wrong prompt per region - sort_order changed 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.

CategorySimpleSyrup/Detection

Inputs (12)

NameTypeDefaultDescription
imageIMAGEImage to search for detectable regions.
detector_modelDETECTOR_MODELUltralytics model that finds boxes or masks in the input image.
confidence_thresholdFLOAT0.500–1Minimum detection confidence required to keep a region.
size_thresholdINT101–8192Discard regions whose detected box is smaller than this many pixels wide or tall.
keep_onlyINT00–4096Keep only this many detected regions after threshold filtering. Use 0 to keep all regions.
keep_byCOMBOhighest confidenceChoose how regions are ranked when Keep Only is greater than 0.
bbox_dilationINT0-512–512Grow or shrink initial detection boxes in pixels before masks are built.
sub_dilationINT0-512–512Grow or shrink the segmentation refinement mask in pixels before it is applied to detected regions.
post_dilationINT0-512–512Grow or shrink each final cropped SEG mask in pixels after detection and refinement.
crop_factorFLOAT3.00–100How much context to include around each detected region. Use 0 for the full image; higher values make larger SEG crops.
sort_orderCOMBOlargest to smallestOrder the returned SEGS before output and before the combined mask is built.
combine_segsBOOLEANfalseReturn one unioned SEGS region instead of separate regions.

Outputs (2)

NameTypeDescription
segsSEGSDetected regions as separate or combined SEGS based on combine_segs.
maskMASKCombined detected area as a standard ComfyUI mask.