Nodes/OcclusionMask/Occlusion Mask (Face Protection for ReActor)
ComfyUI Node

Occlusion Mask (Face Protection for ReActor)

A ComfyUI node in image/faceswap with 8 inputs and 3 outputs.

By ialhabbal·Created about a year ago·Updated 3 months ago· 38
Occlusion Mask (Face Protection for ReActor)
  • input_image
  • IMAGE
  • MASK
  • PREVIEW
face_targetLargest face only
face_crop_padding0.15
fallback_to_full_imagefalse
detection_sensitivity0.65
mask_expansion6
edge_softness4
mask_modeSoft (recommended)
Categoryimage/faceswap

Inputs (8)

NameTypeDefaultDescription
input_imageIMAGE
face_targetCOMBOLargest face onlyLargest face only: fastest, best for single-subject images. All faces: processes every detected face independently and unions the masks.
face_crop_paddingFLOAT0.150–0.5How much extra area around the detected face bounding box to include before running the occlusion models. Increase if objects near the face edges are being missed. 15% is a good default.
fallback_to_full_imageBOOLEANfalseIf enabled and no face is detected, the entire image is treated as the face region. Useful for heavily occluded faces. Disable for safety to avoid accidental full-image masking.
detection_sensitivityFLOAT0.650–1Controls how aggressively objects are detected. LOW (0.2–0.4): only very prominent occlusions like a hand covering the face. MID (0.5–0.7): good default — catches microphones, glasses, held objects. HIGH (0.8–1.0): catches subtle occlusions but may bleed into face edges.
mask_expansionINT6-20–50Expands (positive) or shrinks (negative) the detected occlusion mask. Positive values add a safety margin around objects — recommended to avoid faceswap pixels bleeding under object edges. Negative values trim the mask if it's accidentally covering face skin.
edge_softnessINT40–30Gaussian blur applied to the mask AFTER expansion. Soft edges create a smoother transition between the swapped face and the preserved object, avoiding hard seams. 4–8px is recommended for most cases.
mask_modeCOMBOSoft (recommended)Soft: the mask retains gradient values (0.0–1.0) allowing partial blending at object boundaries — best for natural-looking results. Hard: mask is strictly 0 or 1 — use if ReActor produces ghosting artifacts with soft masks.

Outputs (3)

NameTypeDescription
IMAGEIMAGE
MASKMASK
PREVIEWIMAGE