Person Selector SAM3
Person masks from plain text — SAM3 does the segmenting
- sam3_model
- current_image
- reference_1
- outfit_palettes
- depth_map
- sam_model
- reference_2
- reference_3
- reference_4
- reference_5
- reference_6
- reference_7
- reference_8
- reference_9
- reference_10
- person_data
- face_masks
- head_masks
- body_masks
- aux_masks
- preview
- similarities
- matches
- matched_count
- face_count
- report
PersonSelectorMulti can build body masks a few ways - SAM2, seed-growing, YOLO-driven carving. This node throws out most of that machinery and does the whole mask job with SAM3's text grounding. You supply the concept - "person", "face", "head", "upper body", even "backpack" - and SAM3 segments it. Non-overlapping masks by design, because text grounding produces them that way. No SAM2, no BiRefNet, no depth-overlap resolution needed.
It slots into the same position as PersonSelectorMulti: takes reference images, does the ArcFace matching with the same appearance-blend (match_weights, default 50/15/15/20), and emits PERSON_DATA for Person Detailer. The difference is entirely in how masks get made. Instead of a segmentation model plus carving tricks, SAM3 grounds each mask type with its own text prompt and confidence threshold - body at 0.15, face at 0.40, head at 0.30, hair at 0.40. BiSeNet still runs per-face for the fine facial subtypes (skin, eyes, mouth, neck, accessories), because those aren't SAM3-groundable.
The aux system is the fun part
aux_preset gives you upper_body / lower_body, clothing, hands / feet / arms / legs, headless_body, or custom - and custom takes any noun phrase. Want a "shoes" mask? Type "shoes". Regional detailing with zero extra model downloads beyond SAM3 itself. There's also an optional YOLO path (aux_yolo_model) that overrides the text-prompt aux pathway, with aux_yolo_sam_refine turning bbox-only detections into real pixel masks via SAM3 with SAM2 as fallback.
The inputs that matter
sam3_model- from theLoadSAM3Modelnode. Note the pack doesn't ship the loader; you need whichever SAM3 pack provides it.current_image- supports batch input.auto_threshold,threshold,guaranteed_refs,match_weights- the same matching controls as Multi.aux_preset+aux_custom_prompt- the text-driven aux masks.aux_threshold- confidence cutoff for aux detection.
Outputs
person_data, face_masks, head_masks, body_masks, aux_masks, an annotated preview, plus similarities, matches, matched_count, face_count, and report.
Install
Same face deps as the rest of the pack, plus the SAM3 model and its loader:
cd ComfyUI/custom_nodes
git clone https://github.com/ping1979ping/comfyui-FVMtools
pip install insightface>=0.7.3 onnxruntime-gpu>=1.17.0 opencv-python>=4.8.0 numpy>=1.24.0
Common issues
Empty or mushy masks usually mean the threshold for that mask type is off - the per-type config is fixed internally, so for aux masks adjust aux_threshold and lean on a well-lit reference for the rest. If you connect both aux_yolo_model and a preset, YOLO wins - it overrides the text pathway entirely. And if the selector errors at load, the SAM3 model config isn't connected or the loader pack isn't installed; the pack happily tells you sam3_model is required.
Inputs (30)
| Name | Type | Default | Description |
|---|---|---|---|
| sam3_model | SAM3_MODEL_CONFIG | SAM3 model from LoadSAM3Model node | |
| current_image | IMAGE | Image(s) to process. Supports batch input. | |
| auto_threshold | BOOLEAN | true | Auto: optimal 1:1 face-reference assignment. Off: manual threshold. |
| threshold | FLOAT | 0.400–1 | Minimum similarity for matching. Ignored when auto is on. |
| guaranteed_refs | INT | 00–10 | Force-assign first N references to best face. |
| aggregation | COMBO | How to combine similarity scores across reference images. | |
| det_size | COMBO | Face detection resolution. | |
| aux_preset | COMBO | none | Preset aux mask type: - upper_body / lower_body: body halves - clothing: all clothing (no shoes/socks) - hands / feet / arms / legs: body parts - headless_body: body minus head (computed) - custom: uses aux_custom_prompt below |
| aux_custom_prompt | STRING | Custom SAM3 text prompt for aux mask (only used when aux_preset='custom'). Any noun phrase works: 'shoes', 'necklace', 'backpack', etc. | |
| aux_threshold | FLOAT | 0.300.05–1 | Confidence threshold for aux detection. |
| match_weights | STRING | 50/15/15/20 | Face/hair/head/outfit blend: '50/15/15/20' |
| reference_1opt | IMAGE | Reference image(s) for person 1. | |
| outfit_palettesopt | IMAGE | Palette preview images for outfit matching. | |
| depth_mapopt | IMAGE | Depth map for render order sorting. | |
| depth_sort_orderopt | COMBO | front_last | Rendering order for PersonDetailer. |
| aux_yolo_modelopt | COMBO | None | Optional Ultralytics YOLO model for aux detection. Overrides the SAM3 text-prompt aux pathway when set. Bbox-only models are refined to pixel masks via SAM3/SAM when aux_yolo_sam_refine is on. |
| aux_yolo_confidenceopt | FLOAT | 0.300.05–1 | YOLO detection confidence threshold. |
| aux_yolo_label_filteropt | STRING | Comma-separated class-name substrings to keep (empty = all). Example: 'shoe,boot' or 'glasses'. | |
| aux_yolo_sam_refineopt | BOOLEAN | true | On (default): refine bbox-only YOLO detections into pixel masks using SAM3 (priority) → SAM2 (fallback). Off: use raw bbox rectangles as aux masks (today's bbox-only behavior). |
| sam_modelopt | SAM_MODEL | Optional SAM2 model from Impact Pack SAMLoader. Used as fallback when sam3_model isn't suitable for refinement. | |
| aux_yolo_sam_bbox_expansionopt | INT | 00–64 | Pixels to expand bbox before SAM refinement (helps thin objects). |
| reference_2opt | IMAGE | — | |
| reference_3opt | IMAGE | — | |
| reference_4opt | IMAGE | — | |
| reference_5opt | IMAGE | — | |
| reference_6opt | IMAGE | — | |
| reference_7opt | IMAGE | — | |
| reference_8opt | IMAGE | — | |
| reference_9opt | IMAGE | — | |
| reference_10opt | IMAGE | — |
Outputs (11)
| Name | Type | Description |
|---|---|---|
| person_data | PERSON_DATA | — |
| face_masks | MASK | — |
| head_masks | MASK | — |
| body_masks | MASK | — |
| aux_masks | MASK | — |
| preview | IMAGE | — |
| similarities | STRING | — |
| matches | STRING | — |
| matched_count | INT | — |
| face_count | INT | — |
| report | STRING | — |