TL;DR
RAFSwap is a novel face-swapping framework that achieves industry-leading identity consistency and high-resolution quality by employing a dual local-global feature integration strategy. By combining region-aware Transformers with an unsupervised soft-mask predictor, it effectively transfers intricate facial details while maintaining seamless blending with the target background, outperforming existing state-of-the-art methods like MegaFS and FaceShifter.
What Problem Does This Paper Address?
Face swapping aims to transplant a source identity onto a target face while preserving the target's pose, expression, and lighting. Despite recent progress, two major hurdles remain:
- Identity Consistency: Most current methods rely on global feature representations (often using AdaIN). This approach frequently fails to capture fine-grained local details—like the specific shape of a nose or the curve of a brow—and can accidentally inject irrelevant source information like hairstyle or background into the result.
- Harmonious Blending: High-resolution methods based on GAN inversion often struggle to keep the target's original background and occlusions (like eyeglasses or hands) intact. This typically results in visible artifacts or "ghosting" around the facial contours.
Methods
RAFSwap addresses these issues through a sophisticated architecture built upon the pSp GAN inversion framework and a pre-trained StyleGAN2 decoder. The core innovation lies in its two-pronged feature fusion approach:
- Local Facial Region-Aware (FRA) Branch: This branch uses a Region-Aware Identity Tokenizer (RAT) to extract specific features for key facial areas (lips, nose, eyes, and brows). These features are processed by Transformer layers to model complex, misaligned semantic interactions across different scales. Finally, a Region-Aware Identity Projector (RAP) uses cross-attention to spatially map these identity tokens back onto the target face features.
- Global Source Feature-Adaptive (SFA) Branch: To complement the local details, this branch captures broader identity cues, such as skin texture and overall facial proportions, ensuring a holistic identity transfer.
- Face Mask Predictor (FMP): Instead of relying on external, "hard" segmentation masks that often cause edge artifacts, RAFSwap introduces the FMP. This module taps into the rich semantic priors already present in StyleGAN2's feature maps to predict a "soft" facial mask in an unsupervised manner. This allows for a much smoother, more natural blend between the swapped face and the original target background.
Datasets
The authors utilized several standard benchmarks for training and evaluation:
- CelebA-HQ: A high-quality dataset of 30,000 images at 1024x1024 resolution, used primarily for training and high-resolution qualitative testing.
- FaceForensics++: A large-scale forensic dataset used for quantitative comparisons against other state-of-the-art (SOTA) methods.
- Makeup-Wild: Used to demonstrate the model's versatility in an expanded application for makeup transfer.
Key Insights and Ideas
- Local Details are Identity: The paper argues that identity isn't just a global "style" but is rooted in specific local regions. By treating facial parts as discrete tokens, the model can focus on what actually makes a person look like themselves.
- Transformers for Alignment: Using Transformers to handle the interaction between source and target features is a clever way to solve the "misalignment" problem—where a source eye needs to be mapped to a target eye that is at a completely different angle or scale.
- Leveraging Latent Knowledge: The FMP module proves that you don't need explicit mask supervision. The generator already "understands" the boundaries of the face; the FMP simply learns to extract that information for better blending.
- Generalizability: The success of the FRA branch in makeup transfer suggests that region-aware tokenization is a powerful general tool for any task requiring precise, localized feature injection.
Key Results
RAFSwap demonstrates significant improvements over previous SOTA methods:
- Quantitative Superiority: On the FaceForensics++ dataset, RAFSwap achieved an ID retrieval accuracy of 96.70%, a substantial jump over MegaFS (90.83%) and FaceShifter (90.68%).
- Higher Realism: It achieved a lower FID score (13.25) compared to MegaFS (18.81) on CelebA-HQ, indicating the generation of more realistic and high-fidelity images.
- Qualitative Excellence: As shown in Figure 1, RAFSwap handles challenging attributes like bangs and white hair much better than FaceShifter or SimSwap, which often produce artifacts or lose identity in these cases.
- Efficiency: In makeup transfer tasks, RAFSwap proved to be over 10 times faster on a GPU than the specialized PSGAN model.
Limitations and Future Work
The authors acknowledge that, like most inversion-based methods, RAFSwap can struggle with "out-of-range" cases—specifically faces at extreme perspectives or angles that were not well-represented in the training data.
Future work will focus on incorporating more prior knowledge into the system to improve its robustness in these edge cases, further enhancing the practicability of the method for real-world applications in film and gaming.
Summary updated