Nodes/SimpleSyrup/SEGS from SAM Output
ComfyUI Node

SEGS from SAM Output

Unprompted segmentation for when you want every region, not just the cat

By Artificial-Sweetener·Created 3 months ago·Updated 12 days ago· 2
SEGS from SAM Output
  • image
  • sam_model
  • segs
  • overlay
segmentation_resolution640
minimum_region_area0

Most segmentation asks a question: "find me the faces," or "find the thing matching this text." SimpleSyrup.SEGSFromSAMOutput asks a different one: "just segment everything." It runs SAM in its automatic, unprompted mode - the same mode that produces those exploded-into-colorful-regions images you've seen - and hands you every region it finds as SEGS. No text prompt, no detector, no class names.

Why would you want that? Because "everything" is sometimes exactly right. You're building a regional workflow and don't know in advance which objects matter - let SAM carve the image into regions, browse them, and pick. You want to mask out all foreground objects from a background. You're exploring a composition and want to see what the model perceives as distinct things. SAM's automatic mode is good at this precisely because it's agnostic - it finds blobs and object boundaries without deciding what they mean, which makes it a great discovery tool before you commit to a specific prompt or detector.

Inputs:

  • image and sam_model - the image to segment and a SAM model from SAM Model Loader (or any compatible SAM_MODEL source).
  • segmentation_resolution - the maximum long edge, in pixels, used for segmentation (default 640). Lower runs faster and omits small details; higher catches finer regions but costs time and memory. Start at 640 and raise it only if the granularity disappoints.
  • minimum_region_area - discard masks smaller than this many pixels in the original image (default 0 = keep everything). This is your spec-killer: SAM auto-mode finds a lot of noise regions, and a nonzero floor here is the difference between 5 usable regions and 50 mostly-empty ones.

Outputs:

  • segs - the automatic regions, one per image, as SEGS.
  • overlay - the source image with retained regions drawn as translucent colors. This is the fastest way to see what you got without touching the SEGS itself.

The overlay output is worth wiring up as a preview even when you think you don't need it. It takes SAM's raw segmentation output and makes it legible, and "look at the overlay, then tune minimum_region_area" is the actual tuning loop for this node.

It plays into the same ecosystem as the rest of the pack - the SEGS output feeds detailers, the pack's regional nodes, or tiled diffusion contexts. Since SimpleSyrup SEGS are Impact-compatible, you can hand these regions to Impact Pack nodes too.

Install: the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/Artificial-Sweetener/SimpleSyrup
cd SimpleSyrup && pip install -r requirements.txt

or ComfyUI Manager → search SimpleSyrup → Install → restart, with a current ComfyUI (v3 extension API). You'll need a SAM model (auto-downloadable via the loader) and the segment-anything package, both part of the pack install. If the output is a sea of tiny regions, raise minimum_region_area and lower segmentation_resolution - you're trading detail for sanity, and for auto-segmentation you usually want the sane version.

CategorySimpleSyrup/Detection

Inputs (4)

NameTypeDefaultDescription
imageIMAGEImage whose automatic regions become SEGS.
sam_modelSAM_MODELSAM model used to find unprompted image regions.
segmentation_resolutionINT64064–8192Maximum long edge in pixels used for segmentation. Lower values run faster and omit smaller details.
minimum_region_areaINT00–268435456Discard masks smaller than this many pixels in the original image.

Outputs (2)

NameTypeDescription
segsSEGSAutomatic image regions as SEGS for detailing, masking, or tiled diffusion.
overlayIMAGESource images with retained SAM regions shown as translucent colors.