Nodes/comfyui_gr85/Sam2Segmentation (GR85)
ComfyUI Node

Sam2Segmentation (GR85)

Point- and box-prompted masking, once you've got a SAM2 model loaded

By veighnsche·Created 2 years ago·Updated 8 months ago· 1
Sam2Segmentation (GR85)
  • sam2_model
  • image
  • bboxes
  • mask
  • mask
keep_model_loadedtrue
coordinates_positive
coordinates_negative
individual_objectsfalse
combinetrue

This node's name and shape both point at the same well-known pattern: SAM2, Meta's segment-anything successor, prompted with points and/or boxes to produce a precise pixel mask. The "(GR85)" tag on the display name and the fact that it takes a generic SAM2MODEL input rather than loading a model itself both suggest this is the author's own copy of the segmentation node that ships with the popular kijai SAM2 wrapper pack, kept under a distinct class name so it doesn't collide if you've got the original installed too - comfyui_gr85 doesn't include a SAM2 model loader of its own, which matters for install (below).

How it fits the wider pipeline. SAM/SAM2's whole trick is that it segments any object given a hint - a click point, a bounding box, or text via a paired detector - rather than needing to be trained per-object-class. That's why this node lives in the pack's "GR85/Florence2" category despite not taking a Florence2 input directly: the intended flow is Florence2 doing open-vocabulary text-to-box detection, handing its boxes to this node's bboxes input, and SAM2 turning those rough boxes into pixel-accurate masks. Point prompts work the same way manually, without a detector in front.

The inputs that matter. sam2_model (required) - the loaded SAM2 model, coming from whatever SAM2 loader pack you've installed, not from comfyui_gr85 itself. image (required) - what you're segmenting. keep_model_loaded (default on) - keeps SAM2's weights resident in VRAM between calls instead of reloading each time; flip it off if you're VRAM-constrained and only segmenting occasionally. Optional inputs: coordinates_positive/coordinates_negative (STRING) - point-prompt coordinates, "include this" and "exclude this" clicks, in whatever coordinate-string format your SAM2 loader pack expects. bboxes (BBOX) - box prompts, from Florence2, an Impact Pack detector, or this pack's own Mask Splitter output. individual_objects (default off) - whether multiple prompted regions come back as separate mask entries or get merged. mask (optional MASK) - an existing mask you can feed in to refine or combine with. combine (default on) - whether multiple hits get merged into one final mask. Output is a single mask.

Installing it. comfyui_gr85 goes in the normal way - search it in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/veighnsche/comfyui_gr85

Restart ComfyUI. But sam2_model needs something else feeding it: a SAM2 model-loading node pack (kijai's ComfyUI-segment-anything-2 is the standard one people reach for) that downloads the actual SAM2 checkpoint - a real model download this pack itself doesn't ship or manage.

Where people get stuck. A SAM2MODEL socket with nothing valid to plug into it means the loader pack isn't installed - that's the first thing to check, not this node. Malformed coordinates_positive/coordinates_negative strings are the other common cause of a suspiciously empty output mask - double-check the format your specific SAM2 loader expects before assuming the segmentation itself failed.

CategoryGR85/Florence2

Inputs (9)

NameTypeDefaultDescription
sam2_modelSAM2MODEL
imageIMAGE
keep_model_loadedBOOLEANtrue
coordinates_positiveoptSTRING
coordinates_negativeoptSTRING
bboxesoptBBOX
individual_objectsoptBOOLEANfalse
maskoptMASK
combineoptBOOLEANtrue

Outputs (1)

NameTypeDescription
maskMASK