On Face Segmentation, Face Swapping, and Face Perception

Yuval Nirkin, Iacopo Masi, Anh Tuan Tran, Tal Hassner, Gérard G. Medioni

TL;DR

This paper presents a robust, high-speed pipeline for face swapping in unconstrained images, leveraging a standard Fully Convolutional Network (FCN) for precise face segmentation. By conducting the first large-scale quantitative evaluation of face swapping, the authors demonstrate that a person's perceived identity is heavily dependent on external context (like hair and head shape), providing machine-vision evidence for long-standing theories in human perception.

What Problem Does This Paper Address?

Face swapping—transferring a face from a source image to a target—is often viewed as a novelty for memes. However, it has serious applications in privacy preservation, digital forensics, and data augmentation.

Existing methods faced three major hurdles:

  1. Constraint Sensitivity: Many systems only worked if the source and target had similar poses or expressions.
  2. Segmentation Bottlenecks: Accurate face segmentation (separating the face from hair, hands, or glasses) was often slow or required complex, custom architectures.
  3. Lack of Rigor: The field lacked quantitative benchmarks. Success was usually measured by "looking good" rather than how the swap affected automated recognition systems.

Methods

The authors propose a multi-stage pipeline that treats source and target images symmetrically:

  1. 3D Face Fitting: The system detects 2D landmarks and fits a 3D Morphable Face Model (3DMM). They tested both a generic 3D shape and a regressed, subject-specific shape to account for expressions and viewpoints.
  2. Face Segmentation: Instead of a custom architecture, they used a standard FCN-8s-VGG. The breakthrough here was the training data. They developed a semi-supervised routine using motion cues in videos to generate labels quickly and augmented the data with synthetic occlusions (like hands and sunglasses) to make the model robust.
  3. Warping and Blending: The source face is warped onto the target's 3D proxy. The FCN-generated mask ensures that only the face is transferred, preserving target occlusions (like a hand in front of the face). Finally, Poisson blending is used to smooth the transition.
The face swapping pipeline: from landmark detection and 3D fitting to segmentation and final blending.

Datasets

  • IARPA Janus CS2: Used to collect 1,275 videos for training the segmentation network via semi-supervised labeling.
  • COFW (Caltech Occluded Faces in the Wild): Used to evaluate segmentation accuracy, particularly under heavy occlusion.
  • LFW (Labeled Faces in the Wild): The primary benchmark for the quantitative swapping tests, involving thousands of face pairs.
  • Egohands: Used to provide realistic "hand" images for synthetic occlusion augmentation.

Key Insights and Ideas

  • Data Over Architecture: A "vanilla" FCN can outperform specialized face segmentation models if it is trained on a sufficiently diverse and augmented dataset.
  • The "Clinton-Gore" Effect for Machines: The authors quantitatively confirmed a human perceptual phenomenon: when you swap a face onto a different person's head (inter-subject), the face becomes much harder for machines to recognize. This proves that "identity" in computer vision is not just in the features of the face, but also in the surrounding context (hair, skin tone, head shape).
  • Identity Preservation: By performing "intra-subject" swaps (swapping a person's face onto a different photo of themselves), they proved their method doesn't introduce artifacts that destroy identity. The recognition accuracy remained nearly identical to the original photos.
Inter-subject swapping results demonstrating how the method handles diverse poses, genders, and occlusions.

Key Results

  • Speed: The system achieves 1.3 FPS on a Titan X GPU, making it significantly faster than many previous deep-learning-based style transfer approaches.
  • Segmentation Accuracy: On the COFW dataset, the method achieved a 94.1% average face recall, outperforming previous state-of-the-art methods while being the fastest (48.6 FPS for the segmentation component alone).
  • Recognition Impact: In inter-subject tests on LFW, better blending and 3D fitting actually decreased recognition accuracy (dropping from ~98% baseline to ~86%). This sounds counter-intuitive, but it means the swap was so seamless that the machine was successfully "tricked" by the new context.

Limitations and Future Work

The authors identify a few common failure modes:

  • Landmark Errors: If the initial 2D landmark detection fails, the 3D fit is misaligned, leading to "ghosting" or distorted features.
  • Resolution Mismatch: Swapping a high-resolution face onto a low-resolution target (or vice versa) creates a visible blurriness that breaks the illusion.
  • Extreme Hues: While Poisson blending handles most cases, extremely different skin tones or lighting conditions can still result in unnatural-looking transitions.
Common failure cases, including landmark localization errors and resolution mismatches.

Future work could involve integrating more sophisticated lighting estimation to better match the source face to the target environment.

Summary updated

BibTeX
@inproceedings{nirkin2018face,
  author = {Yuval Nirkin and Iacopo Masi and Anh Tuan Tran and Tal Hassner and Gérard G. Medioni},
  title = {{On Face Segmentation, Face Swapping, and Face Perception}},
  booktitle = {FG},
  year = {2018},
  doi = {10.1109/fg.2018.00024},
}
Figure