Nodes/comfyui-fvmtools/Person Data Filter
ComfyUI Node

Person Data Filter

Split PERSON_DATA into a filtered and a remaining set. source: all_detected = every person the selector found (works without reference images); matched_refs = only the reference-matched slots. gate: gender (female/male) via SAM3 'woman'/'man' grounding with InsightFace fallback — or any free SAM3 text prompt, which overrides the gender widget when non-empty. rank: sort_by (area / horizontal / vertical / depth / index) where ascending = smallest, leftmost, topmost, farthest, first. cut: top_n keeps the first N, nth keeps exactly the N-th. Both outputs are re-indexed as fresh reference slots — feed either one directly into a PersonDetailer.

By ping1979ping·Created 6 months ago·Updated 5 days ago· 0
Person Data Filter
  • person_data
  • images
  • sam3_model
  • filtered
  • remaining
  • filtered_masks
  • remaining_masks
  • preview
  • filtered_count
  • remaining_count
  • report
◄sourceall_detected►
◄genderany►
◄sort_byarea►
◄orderdescending►
◄modetop_n►
◄count1►
◄sam3_prompt►
◄sam3_threshold0.30►
◄min_overlap0.15►
◄det_size640►
◄invertfalse►
CategoryFVM Tools/Face

Inputs (14)

NameTypeDefaultDescription
person_dataPERSON_DATAPERSON_DATA from Person Selector SAM3 / Multi / Data Refiner
sourceCOMBOall_detectedall_detected: every person the selector found (per_face_masks). Works even with no reference image connected. matched_refs: only the slots that matched a reference image.
genderCOMBOanyContent gate. 'any' disables it. Ignored when sam3_prompt is filled.
sort_byCOMBOareaRanking criterion: area - body mask pixel count horizontal - body centroid X vertical - body centroid Y depth - needs depth_map on the selector index - original detection / slot order
orderCOMBOdescendingascending = smallest / leftmost / topmost / farthest first. descending = largest / rightmost / bottommost / nearest first.
modeCOMBOtop_ntop_n: keep the first `count` after sorting (0 = keep all). nth: keep exactly the `count`-th one (1-based).
countINT10–32top_n: how many persons to keep (0 = all that pass the gate). nth: which one to keep, 1-based.
sam3_promptSTRINGFree SAM3 text prompt, e.g. 'woman in red dress', 'child', 'person with backpack'. When non-empty it REPLACES the gender criterion. Empty = the gender widget applies.
sam3_thresholdFLOAT0.300.05–1SAM3 grounding confidence threshold for the gate.
min_overlapFLOAT0.150.01–1Minimum fraction of a grounded mask that must fall inside a person's body mask before that person counts as a hit.
imagesoptIMAGEThe image(s) the person_data was built from. Needed for the gender / free-text gate and the preview.
sam3_modeloptSAM3_MODEL_CONFIGSAM3 model from LoadSAM3Model. Needed for the free-text gate and SAM3-based gender.
det_sizeoptCOMBO640Face detection resolution for the InsightFace gender fallback.
invertoptBOOLEANfalseSwap the two outputs — filtered becomes remaining and vice versa.

Outputs (8)

NameTypeDescription
filteredPERSON_DATA—
remainingPERSON_DATA—
filtered_masksMASK—
remaining_masksMASK—
previewIMAGE—
filtered_countINT—
remaining_countINT—
reportSTRING—