Abstract
Face Presentation Attack Detection (PAD) is an important measure to prevent spoof attacks for face biometric systems. Many works based on Convolution Neural Networks (CNNs) for face PAD formulate the problem as an image-level binary classification task without considering the context. Alternatively, Vision Transformers (ViT) using self-attention to attend the context of an image become the mainstreams in face PAD. Inspired by ViT, we propose a Video-based Transformer for face PAD (ViTransPAD) with short/long-range spatio-temporal attention which can not only focus on local details with short attention within a frame but also capture long-range dependencies over frames. Instead of using coarse image patches with single-scale as in ViT, we propose the Multi-scale Multi-Head Self-Attention (MsMHSA) architecture to accommodate multi-scale patch partitions of Q, K, V feature maps to the heads of transformer in a coarse-to-fine manner, which enables to learn a fine-grained representation to perform pixel-level discrimination for face PAD. Due to lack inductive biases of convolutions in pure transformers, we also introduce convolutions to the proposed ViTransPAD to integrate the desirable properties of CNNs by using convolution patch embedding and convolution projection. The extensive experiments show the effectiveness of our proposed ViTransPAD with a preferable accuracy-computation balance, which can serve as a new backbone for face PAD.
Introduction
Face Presentation Attack Detection (PAD) serves as the critical security layer for biometric systems, distinguishing genuine human faces from spoofing attempts such as printed photos, digital replays, or 3D masks. Traditional approaches primarily rely on Convolutional Neural Networks (CNNs), which excel at capturing local textures—like the subtle edges of a photograph—but often fail to account for the temporal context inherent in video sequences. Conversely, 3D CNNs attempt to capture motion but suffer from a limited receptive field, hindering their ability to learn long-range dependencies across an entire video.
While Vision Transformers (ViT) have emerged as a powerful alternative due to their global context modeling, they typically utilize coarse, single-scale image patches. This limitation makes them less effective at detecting fine-grained, pixel-level artifacts, such as screen moiré patterns, which are vital for PAD. Furthermore, pure transformers lack the "inductive bias" inherent in convolutions, necessitating massive datasets for effective training. To address these challenges, we introduce ViTransPAD, a video-based transformer framework designed to integrate the local precision of convolutions with the global reach of self-attention.
Methodology
ViTransPAD re-engineers the transformer architecture specifically for video-based face security through several key innovations.
Multi-scale Multi-Head Self-Attention (MsMHSA)
Unlike standard ViTs that use a fixed patch size, ViTransPAD employs a pyramid structure. The MsMHSA architecture accommodates multi-scale patch partitions (e.g., 28x28, 14x14, and 7x7) for Query (Q), Key (K), and Value (V) feature maps across different transformer heads. This coarse-to-fine approach allows the model to perform pixel-level discrimination, capturing both broad context and minute spoofing artifacts.
Hybrid Convolution-Transformer Design
To overcome the data-intensive nature of pure transformers, we incorporate Convolutional Token Embedding (CTE) and Convolutional Projection (CP). By replacing standard linear layers with convolutional ones, we inject the spatial inductive bias of CNNs into the transformer. This allows the model to understand local spatial relationships more effectively, even when trained on smaller datasets.
Unified Spatio-Temporal Attention
ViTransPAD processes space and time jointly by stacking patches from all video frames into a single sequence. This enables the self-attention mechanism to learn both short-range spatial details within a frame and long-range temporal dependencies across frames.
Experimental Setup
The proposed model was evaluated on four benchmark datasets:
- OULU-NPU: A high-resolution mobile face PAD benchmark.
- CASIA-MFSD: Includes diverse attacks like warped photos and cut masks.
- Idiap Replay-Attack: Focuses on digital replay attacks.
- MSU-MFSD: Used for cross-dataset generalization testing.
Results and Discussion
Experimental results demonstrate the "Hybrid Advantage" of ViTransPAD. By integrating convolutional layers, the model achieved an Average Classification Error Rate (ACER) of 1.19%, a significant improvement over the 7.25% achieved by a standard ViT.
Temporal Consistency and Efficiency
The study highlights that temporal context is a crucial cue for detecting fakes. Performance improved steadily as video length increased up to 4 seconds, confirming that long-range spatio-temporal attention is superior to short spatial attention. Furthermore, ViTransPAD is highly efficient, outperforming larger models while utilizing significantly fewer GFLOPs (7.88 vs. 55.5 for standard ViT), making it suitable for real-world deployment.
State-of-the-Art Performance
ViTransPAD achieved state-of-the-art results on the OULU-NPU benchmark, particularly on Protocol 1 with an ACER of 0.3%. In cross-dataset evaluations (OCIM), the model demonstrated superior generalization, notably achieving an HTER of 15.63% in the "I&C&M to O" test. Visualizations using GradCAM confirmed that the model's long-range attention focuses on liveness cues like skin texture across frames, rather than being distracted by background noise.
Conclusion
ViTransPAD offers a robust and efficient solution for face PAD by combining the strengths of CNNs and Transformers. While highly effective, the authors noted that excessive scales in MsMHSA can lead to overfitting on small datasets, with a two-scale combination (28x28 and 14x14) proving most effective. Future work will explore integrating ViTransPAD into meta-learning frameworks to enhance its ability to detect entirely unseen attack types in real-world scenarios.
Summary updated