Introduction
Face swapping is the task of transferring a source identity onto a target video or image while maintaining the target's original motion, expression, and environmental lighting. While the concept is straightforward, achieving high-fidelity results is a delicate balancing act. Existing techniques often struggle with identity leakage, where the target's facial structure inadvertently bleeds into the final output, or they fail to maintain temporal consistency, leading to distracting flickering in video sequences.
DynamicFace introduces a novel diffusion-based framework designed to overcome these hurdles. By decomposing facial attributes into four "composable" 3D priors—shape, expression, lighting, and background—it effectively disentangles identity from motion. This approach results in state-of-the-art face swapping that preserves the source identity with high precision while ensuring smooth, flicker-free video.
Methodology: Disentanglement via 3D Facial Priors
The "aha moment" of DynamicFace lies in its use of 3D Morphable Models (3DMM). Rather than using 3DMM to generate the final image, the authors use it to create cleaner, non-identity-polluted control signals for a diffusion model. This decomposition involves four distinct conditions:
- Shape-Aware Pose: The model renders a 2D normal map using the source identity's bone structure but the target's pose. This tells the diffusion model exactly where the face should be without being confused by the target's original features.
- Expression-Related Landmarks: 2D landmarks are converted into semantic segmentation masks (e.g., for eyes and mouth). This captures the target's motion and expressions without carrying over identity-specific details.
- Identity-Erased Illumination: To capture the environment's lighting without the target's face, the system uses a UV texture map that is intentionally blurred. This allows the model to perceive environmental lighting without seeing the target's specific skin texture.
- Background-Preservation: A smart inpainting mask accounts for differences in face shape between the source and target, ensuring the background remains intact even when the new face shape differs significantly.
Dual-Path Identity Injection
To ensure the swapped face looks authentic, DynamicFace employs a dual-path architecture for identity injection. The Face Former uses a face recognition model to extract high-level identity embeddings. Simultaneously, ReferenceNet, a parallel UNet, "borrows" detailed textures and skin features from the source image to ensure the final result has realistic skin grain and features.
FusionTVO: Eliminating Video Flicker
Maintaining temporal consistency in video is notoriously difficult. DynamicFace introduces FusionTVO (Fusion Total Variation Optimizer) as a plug-and-play inference module. It uses position-weighted latent fusion for overlapping video segments and applies a Total Variation (TV) constraint to smooth out transitions between frames. This ensures the video remains consistent from frame to frame, effectively eliminating the flickering common in previous methods.
Key Results and Performance
DynamicFace was benchmarked against industry heavyweights like SimSwap, FaceShifter, and FaceAdapter using the FaceForensics++ (FF++) dataset.
- Identity Preservation: The model achieved an exceptional ID Retrieval score of 99.20% on FF++, significantly outperforming its competitors.
- Motion Accuracy: It maintained lower error rates for mouth and eye positions, indicating superior preservation of the target's original performance.
- Visual Quality: Qualitative evaluations show better handling of gaze direction and more realistic integration of the swapped face into the original background and hair.
Conclusion
DynamicFace demonstrates that 3D facial priors, when used as guidance for diffusion models, can solve the long-standing issues of identity leakage and temporal instability in face swapping. By focusing on disentangled control signals, the framework achieves a level of realism and consistency that moves the field closer to seamless video facial manipulation. Future work will focus on optimizing the architecture for efficiency and exploring stylized face swapping.
Summary updated