EasyUse/Fixgenerated

SAMLoader (Pipe)(samLoaderForDetailerFix)

SAMLoader (Pipe) bundles a SAM (Segment Anything Model) checkpoint with the detection-hint and mask-processing options used by Detailer Fix workflows.

sam Loader For Detailer Fix

sam_pipe
model_name
COMBO
device_mode
AUTO
sam_detection_hint
COMBO
sam_dilation
0
sam_threshold
0.93
sam_bbox_expansion
0
sam_mask_hint_threshold
0.70
sam_mask_hint_use_negative
COMBO
Easy Use

SAMLoader (Pipe) bundles a SAM (Segment Anything Model) checkpoint with the detection-hint and mask-processing options used by Detailer Fix workflows. It is the pipe-aware counterpart of a plain SAM loader: instead of exposing a raw SAM model, it produces a PIPE_LINE that carries both the model and the segmentation settings, so downstream EasyUse Detailer Fix nodes can apply consistent SAM-based refinement.

Inputs

model_name

Select the SAM checkpoint to load. The dropdown lists the available SAM checkpoints in your ComfyUI models directory.

device_mode

Selects the device used for SAM inference. AUTO lets ComfyUI choose the device automatically, Prefer GPU uses the GPU when available and falls back to CPU otherwise, and CPU forces CPU execution. Use CPU on low-VRAM systems to reduce memory pressure.

sam_detection_hint

Controls what kind of hint is generated from the existing mask or detection before SAM runs. Options:

  • center-1 — use a single point at the center.
  • horizontal-2 — use two points along a horizontal line.
  • vertical-2 — use two points along a vertical line.
  • rect-4 — use four rectangle corner points.
  • diamond-4 — use four diamond corner points.
  • mask-area — use the mask area itself as the hint.
  • mask-points — use points sampled from the mask.
  • mask-point-bbox — use points sampled from the mask plus a bounding box.
  • none — disable point/mask hints; SAM relies on the bounding box prompt.

sam_dilation

Dilation applied to the mask used for SAM detection, in pixels. Positive values expand the mask; negative values erode/shrink it. Use positive dilation to add surrounding context or negative dilation to tighten loose mask edges.

sam_threshold

Threshold from 0 to 1 (default 0.93) applied to the SAM prediction mask when converting it to a binary mask. Higher values keep only the strongest SAM predictions; lower values accept more area.

sam_bbox_expansion

Number of pixels by which to expand the detected bounding box before it is passed to SAM. Larger values give SAM more surrounding context; 0 keeps the detected box unchanged.

sam_mask_hint_threshold

Threshold from 0 to 1 (default 0.7) used when a mask hint is active. Pixels above this value are treated as foreground for the mask hint. Lower values include more of the generated hint mask.

sam_mask_hint_use_negative

Controls whether and how negative mask/point hints are supplied to SAM:

  • False — do not supply negative hints.
  • Small — supply a small negative hint area around the target.
  • Outter — supply negative hints in the outer region outside the target.

The Outter spelling is preserved from the node's option list.

Outputs

PIPE_LINE

A pipeline containing the loaded SAM model and the configured detection-hint, dilation, threshold, bbox-expansion, mask-hint-threshold, and negative-hint settings. Pass this pipe into a Detailer Fix node that accepts a PIPE_LINE input. This is not a raw SAM_MODEL output, so it cannot be connected directly to nodes expecting a plain SAM model.

Usage Notes

  • The default settings are tuned for typical Detailer Fix refinement: AUTO device, center-1 hint, no dilation, 0.93 threshold, no bbox expansion, 0.7 mask-hint threshold, and no negative hints.
  • If SAM masks miss thin or small structures, lower sam_threshold or add a small positive sam_dilation.
  • If masks bleed into the background, raise sam_threshold, apply a negative sam_dilation, or set sam_mask_hint_use_negative to Small or Outter.
  • sam_bbox_expansion is useful when the detected box clips the subject; expanding it lets SAM see more of the object boundary before refining the mask.

Comments

Sign in with GitHub to join the discussion.

Loading comments…