TeG-DG: Textually Guided Domain Generalization for Face Anti-Spoofing

Lianrui Mu, Jianhong Bai, Xiaoxuan He, Jiangnan Ye, Xiaoyu Liang, Yuchen Yang, Jiedong Zhuang, Haoji Hu · DOI

Introduction

Face Anti-Spoofing (FAS) serves as a critical security layer for facial recognition systems, distinguishing between live human faces and spoofing attempts such as printed photos or video replays. Despite significant progress, existing FAS models often struggle with domain shift—where a model trained on one set of environmental conditions (e.g., studio lighting, specific camera sensors) fails when deployed in a new, unseen environment.

To address this, the TeG-DG (Textually Guided Domain Generalization) framework introduces natural language descriptions as a domain-invariant anchor. By aligning visual features with abstract text prompts, the model learns to focus on the intrinsic characteristics of "realness" or "spoofing" rather than domain-specific noise.

The Problem: Residual Style Bias

Traditional Domain Generalization (DG) methods attempt to extract features that are consistent across different training domains. However, these methods often fail to completely eliminate "residual style bias"—the subtle artifacts introduced by specific camera hardware or lighting. For instance, a "print attack" looks different through a high-end DSLR versus a low-cost mobile sensor.

The core insight of TeG-DG is that while the visual representation of an attack changes across domains, the textual concept of that attack (e.g., "a printed photo") remains constant.

Conceptual comparison between TeG-DG and previous domain generalization methods. TeG-DG incorporates text prompts to bridge the gap to unseen domains.

Methodology: Bridging Vision and Language

The TeG-DG framework consists of three innovative components designed to leverage textual information for better generalization:

  1. Text Prompter (TP): Rather than using simple binary labels, the system utilizes a library of semantically rich prompts generated by GPT-4. These prompts describe the specific nature of the capture (e.g., "a natural, unposed photo" for real faces vs. "a printed photo with blur" for spoofs), providing the model with more nuanced supervision.
  2. Hierarchical Attention Fusion (HAF): Spoofing cues are multi-scale. Moiré patterns are fine-grained textures, while masks are high-level semantic objects. HAF aggregates features from all layers of a Vision Transformer (ViT), ensuring the model captures both low-level artifacts and high-level semantic cues.
  3. Textual-Enhanced Visual Discriminator (TEVD): This module uses a Vision-Language Triplet Loss to align image features with their corresponding text embeddings. It also employs a multi-modal classifier that uses "unbiased" text features as a regularizer, preventing the visual encoder from overfitting to domain-specific artifacts.

Experimental Results

The authors evaluated TeG-DG using a Leave-One-Out (LOO) protocol across four major FAS benchmarks: OULU-NPU, CASIA-MFSD, MSU-MFSD, and Replay-Attack.

  • State-of-the-Art Performance: TeG-DG achieved a significant breakthrough in generalization. In the O&M&I to C benchmark, it reached a Half Total Error Rate (HTER) of 3.17%, compared to the previous state-of-the-art of approximately 8.67%.
  • Robustness in Data-Scarce Scenarios: The model demonstrated exceptional few-shot capabilities. With only a single training sample from the source domain, TeG-DG achieved an HTER of 6.34% on OULU, vastly outperforming zero-shot CLIP models which struggled at over 60% error.

Conclusion and Future Work

TeG-DG demonstrates that text can serve as a powerful, domain-invariant regularizer for computer vision tasks prone to domain shift. By fusing multi-scale visual features with semantic language anchors, the framework achieves unprecedented generalization in face anti-spoofing.

Future research will focus on automating prompt generation for individual samples and refining the system's stability when handling complex, overlapping textual descriptions.

Summary updated

BibTeX
@misc{mu2023teg,
  author = {Lianrui Mu and Jianhong Bai and Xiaoxuan He and Jiangnan Ye and Xiaoyu Liang and Yuchen Yang and Jiedong Zhuang and Haoji Hu},
  title = {{TeG-DG: Textually Guided Domain Generalization for Face Anti-Spoofing}},
  year = {2023},
  eprint = {2311.18420},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.18420},
}
Figure