Abstract
Face swapping has seen significant progress, yet most existing methods struggle to preserve the source identity's unique facial contours, often resulting in a "mask-like" effect on the target's head shape. We present FlowFace, a novel two-stage framework designed for high-fidelity face swapping. FlowFace explicitly addresses facial shape through a semantic flow-guided reshaping network ($F^{res}$) and achieves precise feature transfer via a transformer-based face swapping network ($F^{swa}$). By utilizing dense semantic flow and a cross-attention fusion module, FlowFace ensures the swapped result adopts the source's identity-defining contours while maintaining the target's expressions and lighting. Experimental results demonstrate that FlowFace outperforms state-of-the-art methods in both identity preservation and shape consistency.
Introduction
Identity in face swapping is defined not just by internal features like the eyes, nose, and mouth, but also by the overall facial contour and head shape. Conventional methods often overlook these external features, focusing instead on blending source features into the target's original skull structure. This limitation often leads to a loss of realism, as the resulting face lacks the characteristic jawline or forehead shape of the source individual.
FlowFace addresses this gap by introducing an explicit reshaping stage. The framework first warps the target face to match the source's contour using a dense semantic flow. Subsequently, a swapping network integrates the source's fine-grained features into this reshaped target, ensuring a more holistic and accurate identity transfer.
Methods
The FlowFace architecture consists of two primary components: the Face Reshaping Network ($F^{res}$) and the Face Swapping Network ($F^{swa}$).
Face Reshaping Network ($F^{res}$)
The goal of $F^{res}$ is to modify the target image $I_t$ to match the facial contour of the source $I_s$. This is achieved through:
- Shape Representation: 3D Morphable Model (3DMM) coefficients are extracted and projected into 2D landmarks to provide a structural guide.
- Semantic Flow Estimation: A generator $G^{res}$ estimates a pixel-wise dense semantic flow $V_t$. This flow represents the displacement required to transform the target's shape into the source's shape.
- Explicit Warping: The target image and its segmentation mask are warped using $V_t$, producing a reshaped target face $I_t^{res}$ that serves as the foundation for the next stage.
Face Swapping Network ($F^{swa}$)
Once the target is reshaped, $F^{swa}$ performs the feature transfer:
- MAE-based Encoding: To capture rich topological and semantic details often lost in compressed identity embeddings, the network uses a pre-trained Masked Autoencoder (MAE).
- Cross-Attention Fusion Module (CAFM): Instead of global modulation techniques like AdaIN, FlowFace employs a transformer-based cross-attention mechanism. This allows the model to adaptively attend to specific patches of the source face, ensuring that features like the nose or eyes are mapped to their corresponding regions on the reshaped target.
- Decoding: A convolutional decoder $D_f$ synthesizes the final high-resolution swapped image $I_o$.
Experiments and Results
The model was trained on a comprehensive dataset of 350,000 images from CelebA-HQ, FFHQ, and VGGFace2. Evaluation was conducted on the FaceForensics++ (FF++) dataset, comparing FlowFace against several state-of-the-art (SOTA) methods, including HifiFace, SimSwap, and FaceShifter.
FlowFace demonstrated superior performance across multiple quantitative metrics:
- Identity Accuracy (ID Acc): FlowFace achieved an average ID Acc of 98.83%, significantly outperforming SimSwap (94.43%) and HifiFace (94.62%).
- Shape Consistency: The framework recorded the lowest shape error (1.17), confirming the effectiveness of the semantic flow-guided warping stage.
- Qualitative Analysis: Visual comparisons show that FlowFace better preserves unique source traits such as jawline structure, beard textures, and eye color, while maintaining the target's expression and lighting more naturally than its competitors.
Discussion and Conclusion
A key insight from this work is that facial shape is a critical component of identity. Ablation studies showed that adding the reshaping stage alone improved the identity accuracy of existing models like SimSwap. Furthermore, the use of MAE-based embeddings and patch-wise cross-attention fusion proves more effective than traditional global identity embeddings for retaining fine-grained personalized details.
While FlowFace excels in identity and shape preservation, it faces a slight challenge with pose error (2.66), likely due to the sensitivity of head pose estimators to changes in facial contours. Future research will focus on making the warping process more pose-invariant and exploring joint optimization of the reshaping and swapping networks to further minimize artifacts at extreme angles.
Summary updated