LC Detail Finder (BETA) π―
Find Every Face Once, Then Stop Paying for SAM 3
- image
- sam3_masks
- count
What it is
Step one of a three-node chain that gives you a separate detail pass per character. This is the detection step, and it does exactly one thing: run SAM 3 on the picture, hand back every match in one bundle.
Four widgets and two outputs, so it looks like the least interesting node of the three. It's actually the one that saves the most time: SAM 3 detection is the slow part of a detailing pass, and here it happens once for the whole chain - one Finder, a Sorter, then as many redraw nodes as you have characters, none of which re-run the detector.
That beats the classic SEGS arrangement, where each detailer does its own detection pass. Four characters, one SAM 3 encode instead of four.
How it works
You give it words and a threshold, and it asks ComfyUI's built-in SAM 3 detector for up to 16 instances per word. That cap matters: ComfyUI's own SAM 3 node returns one detection per prompt unless you write word:N, so "both hands" is normally a thing you have to spell out. Here it's automatic - the pack appends :16 for you, so hands finds both hands.
Multiple words change what gets counted. face, hair doesn't return a pile of faces and a pile of hair; the first word is the anchor defining the matches, and each later word folds into the anchor it belongs to. The test is geometric: at least 60% of the hair mask must fall inside the face mask's box grown by its own size. So each face comes out as face-plus-its-own-hair, and the hair of the person behind doesn't get glued onto the face in front.
Frames are handled per-frame, and matches are stored in a stable left-to-right order so the Sorter can reorder them without two runs disagreeing about which mask is which. The bundle carries the picture's size along with the masks - that's how downstream nodes know to complain if you resized in between. The preview outlines every match on the first frame and the console prints N found for 'face'.
The inputs worth setting
Four of them, all required:
- image - the picture. Batch in, per-frame out.
- prompt - what to find, default
face, single line. First word is the anchor, later words join their match.face, hairis the common case. - sam3_model - the checkpoint. The dropdown offers the SAM 3.1 download; your own
sam3.pt/sam3.safetensorsinmodels/sam3shows up automatically. - threshold - how sure SAM 3 has to be, default 0.5. Lower finds more and more wrong things. And colour words are a hint, not a filter:
red dresswill happily pick a green one.
Outputs are sam3_masks: the bundle, wired to LC Detail Sorter, or straight into LC Detailer For Each if you want every match redrawn the same way. And count: how many were found in the first image, which is a plain INT - handy for a quick text display, or for realising you have 9 people in the frame and the Sorter only has 8 outputs.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/lonecatone23/ComfyUI_LC_MaskMaker_nodes
# restart ComfyUI
Or install ComfyUI_LC_MaskMaker_nodes through ComfyUI Manager. Requirements are ComfyUI itself plus the model:
- Built-in SAM 3 support, i.e. a reasonably current ComfyUI. Older builds get "This ComfyUI has no built-in SAM 3 support. Update ComfyUI." - the pack calls
comfy_extras.nodes_sam3and won't fake it. sam3.1_multiplex_fp16.safetensors(about 1.7 GB) intomodels/sam3on first run, ungated unlike Meta'sfacebook/sam3, shared by every SAM 3 node in the pack.install.pyonly addstransformersandhuggingface_hubwhen missing; no bundled weights.
Common issues
Count is 0 and the preview is bare. Either the threshold is too high for a small or partly occluded face, or the word isn't something SAM 3 recognises. Try person instead of face, or drop threshold to 0.35.
It found 11 things, most of them nonsense. Lower threshold is usually the culprit: near 0.3 SAM 3 starts inventing matches for words that aren't in the image. Back to 0.5, and use the word that actually describes what you want.
count never changes. It's the first image's count only - fine for stills, misleading for a batch with different people per frame.
Background hair attaching to the wrong face. The 60%-inside rule decides this and it isn't adjustable. Try face, head or person as the second word, or run two Finders with separate prompts.
If you're iterating on redraw settings, this is the node to run once and keep - changing denoise or feather downstream doesn't search again.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | β | |
| prompt | STRING | face | What to find, e.g. face. With several words (face, hair) the first is what gets counted and the others join the match they belong to: each face gets its own hair. |
| sam3_model | COMBO | SAM 3 model that does the finding. Pick the SAM 3.1 download, or use your own sam3.pt / sam3.safetensors in models/sam3. | |
| threshold | FLOAT | 0.500.05β0.95 | How sure SAM 3 has to be. Lower finds more (and more wrong things), higher is pickier. 0.5 is a good start. Colors are only a hint: 'red dress' can still pick a green dress. Things that are not there are not found. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| sam3_masks | LC_SAM3_MASKS | The SAM 3 mask of every match, for LC Detail Sorter (or straight into LC Detailer For Each to redraw them all). |
| count | INT | How many were found (first image). |