Nodes/ComfyUI_LayerStyle_Advance/LayerMask: EVF-SAM Ultra(Advance)
ComfyUI Node Runs on cloud

LayerMask: EVF-SAM Ultra(Advance)

SAM segmentation from a plain-language prompt, no GroundingDINO detour

By chflame163·Created 2 years ago·Updated 4 months ago· 696
LayerMask: EVF-SAM Ultra(Advance)
  • image
  • image
  • mask
model
precision
load_in_bit
promptsubject
detail_method
detail_erode6
detail_dilate4
black_point0.01
white_point0.99
process_detailtrue
device
max_megapixels2.0

Most text-prompted segmentation in this ecosystem is a two-model relay: GroundingDINO turns your text into a box, SAM turns the box into a mask (that's exactly what the pack's SegmentAnythingUltra node does). EVFSAMUltra skips the relay. It implements EVF-SAM, a model built to take a text prompt directly and produce a segmentation without a separate detection stage in between - one model, one forward pass, from language to mask.

Whether that's actually better than the GroundingDINO+SAM combo depends on your case; a single fused model can be faster and simpler to reason about, while the two-stage approach lets you swap detector and segmenter independently. Worth trying both on the same image if you're not sure which suits your workflow - they're different enough architecturally that they won't always agree on ambiguous prompts.

The inputs and outputs that matter

  • image / prompt (default "subject") - required. Plain-language description of what to segment, same style as SegmentAnythingUltra's prompt field.
  • model - evf-sam2 or evf-sam. The SAM2-based variant is the newer of the two.
  • precision - fp16, bf16, or fp32. fp16 is the usual default choice for speed/memory unless you have a specific reason to run higher precision.
  • load_in_bit - full, 8, or 4. This is the VRAM-vs-quality lever: quantizing to 8-bit or 4-bit trades some accuracy for a meaningfully smaller memory footprint, worth reaching for on tighter cards.
  • detail_method - VITMatte, VITMatte(local), vitmatte-base-composition-1k, PyMatting, or GuidedFilter, the same edge-refinement pass shared across the pack's "Ultra" nodes.
  • detail_erode (default 6) / detail_dilate (default 4), black_point (0.01) / white_point (0.99), process_detail (default on), device (cuda/cpu), max_megapixels (default 2) - the standard detail-pass controls, same behavior as on Florence2Ultra and BenUltra.

Outputs are image and mask.

Installing it

ComfyUI Manager: search "ComfyUI Layer Style Advance". Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle_Advance.git

Run install_requirements.bat (portable) or install requirements.txt yourself, then restart.

Model files are a separate, model-specific download. Grab them from the linked BaiduNetdisk mirror or from HuggingFace (YxZhang/evf-sam2 or YxZhang/evf-sam, matching whichever model option you plan to use), and place each into its own subdirectory under ComfyUI/models/EVF-SAM - the README is specific that each model needs its own subfolder rather than everything dumped into one directory.

Common issues

Model won't load, or loads the wrong weights. Double-check the subdirectory structure under ComfyUI/models/EVF-SAM - mixing evf-sam and evf-sam2 files into the same folder, or flattening them instead of keeping separate subdirectories, is the most likely cause if the model dropdown selection doesn't behave as expected.

Out of memory on a smaller card. Drop load_in_bit to 8 or 4 before giving up on the node entirely - this is exactly the lever built for that situation, and the quality loss from 8-bit quantization is often smaller than people expect.

Segmentation misses or over-includes. As with any text-prompted segmenter, prompt wording matters - short, concrete noun phrases work better than long sentences. Try comparing against SegmentAnythingUltra on the same image and prompt if EVF-SAM consistently underperforms on your specific subject matter.

Edge quality disappointing despite process_detail on. Confirm the VITMatte model actually downloaded if you selected that detail method - like elsewhere in this pack, it silently falls back to a cruder result if the weights aren't present locally.

Category😺dzNodes/LayerMask

Inputs (13)

NameTypeDefaultDescription
imageIMAGE
modelCOMBO2 options: evf-sam2, evf-sam
precisionCOMBO3 options: fp16, bf16, fp32
load_in_bitCOMBO3 options: full, 8, 4
promptSTRINGsubject
detail_methodCOMBO5 options: VITMatte, VITMatte(local), vitmatte-base-composition-1k, PyMatting, GuidedFilter
detail_erodeINT61–255
detail_dilateINT41–255
black_pointFLOAT0.010.01–0.98
white_pointFLOAT0.990.02–0.99
process_detailBOOLEANtrue
deviceCOMBO2 options: cuda, cpu
max_megapixelsFLOAT2.01–999

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK