Nodes/comfyui-fvmtools/Person Data Refiner
ComfyUI Node

Person Data Refiner

Regenerate PERSON_DATA masks at a new image resolution. Use after upscaling: takes original person_data + hi-res images, re-detects faces and regenerates all masks at the new resolution while preserving face-to-reference assignments. Accepts either sam_model (SAM2) or sam3_model (SAM3) for body masks. SAM3 takes priority when both are connected. Chainable: when image resolution matches person_data, skips face re-detection entirely and just runs YOLO aux detection. Chain multiple refiners with different aux_model/aux_label combos to build separate aux mask passes (hands, feet, etc.). Optional depth map input improves masks by filling gaps and removing overlapping objects using depth coherence.

By ping1979ping·Created 5 months ago·Updated 2 months ago· 0
Person Data Refiner
  • person_data
  • images
  • sam_model
  • sam3_model
  • depth_map
  • person_data
  • aux_masks
  • report
mask_fill_holestrue
mask_blur0
det_size640
depth_edge_threshold0.05
depth_carve_strength0.80
depth_grow_pixels30
aux_model
aux_confidence0.35
aux_label
aux_fill_holesfalse
aux_expand_pixels0
aux_blend_pixels0
aux_yolo_sam_refinetrue
aux_yolo_sam_bbox_expansion0
CategoryFVM Tools/Face

Inputs (19)

NameTypeDefaultDescription
person_dataPERSON_DATAOriginal PERSON_DATA from Person Selector Multi / SAM3
imagesIMAGENew images (batch size must match original person_data)
mask_fill_holesBOOLEANtrue
mask_blurINT00–100
det_sizeCOMBO640Face detection resolution
sam_modeloptSAM_MODELSAM2 model for body mask generation (fallback when sam3_model not connected)
sam3_modeloptSAM3_MODEL_CONFIGSAM3 model from LoadSAM3Model. Takes priority over sam_model when both connected.
depth_mapoptIMAGEDepth map batch for depth-guided mask refinement
depth_edge_thresholdoptFLOAT0.050.01–0.3Depth gradient threshold for edge detection
depth_carve_strengthoptFLOAT0.800–1How strongly depth edges cut masks
depth_grow_pixelsoptINT300–200Gap filling between depth edges
aux_modeloptCOMBOYOLO segm model for body-part detection (hands, feet, etc.). Runs on the current images and injects results into person_data["aux_masks"]. Chainable: each refiner replaces aux_masks, so chain multiple refiners with different models/labels for separate aux passes. Set to 'none' to skip YOLO. If aux_label is non-empty AND a SAM3 model is connected, the refiner falls back to SAM3 text-grounded segmentation using aux_label as the prompt.
aux_confidenceoptFLOAT0.350.05–1Detection confidence threshold. YOLO path: per-detection score gate. SAM3-text-aux path: passed as the SAM3 grounding threshold (lower = more permissive).
aux_labeloptSTRINGYOLO path: filter detections by class label (substring match; comma-separated for multiple, e.g. 'hand,foot'). Empty = all classes. SAM3-text-aux path (when aux_model='none'): this is the SAM3 grounding prompt itself, e.g. 'legs', 'arms'. Comma-separated values are run as separate prompts and unioned.
aux_fill_holesoptBOOLEANfalseFill holes inside YOLO aux masks
aux_expand_pixelsoptINT00–100Dilate YOLO aux masks by N pixels
aux_blend_pixelsoptINT00–100Gaussian blur radius for YOLO aux mask edges
aux_yolo_sam_refineoptBOOLEANtrueOn (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).
aux_yolo_sam_bbox_expansionoptINT00–64Pixels to expand bbox before SAM refinement (helps thin objects).

Outputs (3)

NameTypeDescription
person_dataPERSON_DATA
aux_masksMASK
reportSTRING