Towards Learning Structure via Consensus for Face Segmentation and Parsing

Iacopo Masi, Joe Mathai, Wael AbdAlmageed

Introduction

Face segmentation—labeling pixels as face, hair, or occlusion—is critical for applications like virtual try-ons and face swapping. Traditional deep learning models often treat this as an independent pixel prediction problem using standard cross-entropy loss. This approach ignores the inherent spatial structure of faces and occlusions, leading to fragmented "salt-and-pepper" masks. To address this, researchers have historically relied on computationally expensive post-processing like Conditional Random Fields (CRFs). This paper introduces a novel "Structure via Consensus" loss function that enforces spatial consistency directly during training, achieving high-quality segmentation at speeds exceeding 300 FPS.

Methodology

The proposed approach combines a unique data generation strategy with a structural loss function to bake spatial awareness into the network weights.

Occlusion Factorization

Since pixel-perfect labels for occluded faces are scarce, the authors developed a method to "harvest" them using 3D face priors. By projecting a generic 3D face model onto a 2D image and comparing it with the output of a noisy segmenter, the system can isolate continuous "blobs" representing occlusions.

Overview of the occlusion factorization process using 3D priors to identify occlusion blobs.

Structure via Consensus Loss

The core innovation is a loss function that operates on connected components (blobs) rather than individual pixels. It consists of two primary terms:

  1. First-order (Average Match): Ensures the average prediction across all pixels in a blob aligns with the ground-truth label.
  2. Second-order (Consensus): Penalizes individual pixels that deviate from the blob's average prediction.

This mechanism forces the network to learn that pixels within the same object must "agree," effectively regularizing the model to produce smooth, continuous shapes without the need for post-processing.

Key Results

The model was pre-trained on large-scale datasets (CASIA WebFaces, VGG Faces, MS-Celeb-1M) and evaluated on challenging benchmarks like COFW (Caltech Occluded Faces in the Wild).

  • State-of-the-Art Performance: The method achieved an Intersection over Union (IoU) of 87.0% on COFW, significantly outperforming previous methods like Nirkin et al. (81.6%).
  • Structural Integrity: Qualitative results show a dramatic reduction in fragmented predictions. The consensus approach successfully eliminates "holes" in masks, even under heavy occlusion.
  • Efficiency: By internalizing smoothness into the model weights, the system avoids slow post-processing. The lightweight model runs in just 3.1ms, enabling real-time performance at over 300 FPS.
Qualitative comparison showing the proposed method producing smoother and more accurate masks compared to baselines.

Conclusion

By shifting from independent pixel classification to a consensus-based structural approach, this work demonstrates that spatial consistency can be achieved efficiently. The use of 3D priors as "teachers" allows for robust training on occluded data, resulting in a model that is both highly accurate and fast enough for demanding real-time applications. Future work aims to explore unsupervised blob discovery to extend this consensus logic to more general semantic segmentation tasks.

Summary updated

BibTeX
@inproceedings{masi2020towards,
  author = {Iacopo Masi and Joe Mathai and Wael AbdAlmageed},
  title = {{Towards Learning Structure via Consensus for Face Segmentation and Parsing}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2020},
  doi = {10.1109/cvpr42600.2020.00555},
}
Figure