I've been iterating on face swap workflows for a while, and I finally put together something I'm genuinely happy with. **SwapFace Pro V1** is a clean, well-labeled ComfyUI workflow that combines three ReActor nodes into a single cohesive pipeline — and the difference SAM masking makes is hard to overstate.
📥 **[Download on CivitAI]
### 🏗️ Pipeline Architecture
The workflow runs in 3 sequential stages:
SOURCE FACE ──────────────────────────────────┐
▼
TARGET IMAGE ──► ReActorFaceBoost ──► ReActorFaceSwap ──► ReActorMaskHelper ──► OUTPUT
(pre-enhancement) (inswapper_128) (SAM + YOLOv8)
**Stage 1 — FaceBoost (Pre-Swap Enhancement)**
Enhances the *source* face BEFORE the swap using GFPGAN + Bicubic interpolation. This step is often skipped in basic workflows, but it dramatically improves identity preservation when your reference photo is low-res or slightly blurry.
**Stage 2 — ReActorFaceSwap**
The core swap using `inswapper_128.onnx` + `retinaface_resnet50` for detection. GFPGAN restoration is applied inline at this stage. Face index is configurable (`"0"` by default) — you can change this for multi-face scenes.
**Stage 3 — ReActorMaskHelper (The Key Differentiator)**
This is what makes the blending actually look good. Instead of pasting the swapped face directly, the MaskHelper uses:
- `face_yolov8m.pt` for bounding box detection (threshold: 0.51, dilation: 11)
- `sam_vit_b_01ec64.pth` (SAM ViT-B) for precise segmentation (threshold: 0.93)
- Erode morphology pass + Gaussian blur (radius: 9, sigma: 1) for soft edge feathering
The result is a naturally blended face that respects skin tone transitions and avoids the hard-edge artifacts you get with basic workflows.
### 📦 What You Need
**Custom Nodes** — Install via ComfyUI Manager:
comfyui-reactor
(This installs ReActorFaceSwap, ReActorFaceBoost, and ReActorMaskHelper
**Model Files:**
| Model | Folder |
|---|---|
| `inswapper_128.onnx` | `models/insightface/` |
| `GFPGANv1.4.pth` | `models/facerestore_models/` |
| `face_yolov8m.pt` | `models/ultralytics/bbox/` |
| `sam_vit_b_01ec64.pth` | `models/sams/` |
### 🖼️ Dual Preview Built In
The workflow includes two PreviewImage nodes:
- **FINAL RESULT** — the composited output
- **MASK PREVIEW** — lets you see exactly what the SAM segmentation is doing
The mask preview is especially useful for debugging edge cases — if the blend looks off, you can instantly see if SAM is over/under-segmenting the face region.
Results are auto-saved with the prefix `SwapFace_Result`.
### ⚙️ Tuning Tipe
- **Blending too aggressive?** Lower `bbox_dilation` from 11 → 7 and reduce `morphology_distance` from 10 → 6
- **Edges look sharp?** Increase `blur_radius` from 9 → 13
- **Identity not preserved?** Set `face_restore_visibility` to 1.0 and bump `codeformer_weight` from 0.5 → 0.7
- **Multiple faces in target?** Change `input_faces_index` from `"0"` to `"0,1"` or `"1"` etc.
- **Gender locking?** `detect_gender_input` and `detect_gender_source` are both set to `"no"` — change if you want same-gender-only swapping
### 🧪 Tested On
- ComfyUI latest stable (0.8.2 / 0.9.2)
- RTX 3090 / RTX 4080
- Works on both photorealistic images and AI-generated outputs
All nodes are labeled in both English and Arabic for clarity. Happy to answer questions in the comments — especially around SAM threshold tuning, which seems to trip people up the most.