Rethinking Vision Transformer and Masked Autoencoder in Multimodal Face Anti-Spoofing
- Publication
- International Journal of Computer Vision 2024Journal
- First submitted to arXiv
- arXiv:2302.05744
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{faceantispoofingm2a2e2023,
title = {{Rethinking Vision Transformer and Masked Autoencoder in Multimodal Face Anti-Spoofing}},
author = {Zitong Yu and Rizhao Cai and Yawen Cui and Xin Liu and Yongjian Hu and Alex Kot},
year = {2023},
eprint = {2302.05744},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2302.05744}
}
As we’ve reviewed various papers, we know that face recognition is a system that’s often compromised.
Face recognition can be accurate and convenient, yet the camera still leaves us with an old question: is the face on screen a person, or a photograph?
Defining the Problem
Over the past decade, from LBP to CNN, from single-modality RGB to multimodal fusion (such as RGB, IR, Depth), we have built a comprehensive system to detect spoofed faces. However, whether using handcrafted features or deep learning models, they still fail when faced with “new types of attacks” or “unseen scenarios,” mainly due to issues with generalization.
To address this problem, multimodal approaches have emerged as one solution.
After all, in high-risk scenarios (such as facial payments or vault access control), relying solely on an RGB image is too limited. IR, depth information, and even thermal imaging can provide additional live detection cues from different dimensions.
But then the problem arises.
With the advent of Vision Transformer (ViT), everyone wants to apply it to Face Anti-Spoofing (FAS). The reason is simple:
- ViT’s long-range modeling capability and cross-modality scalability seem to complement the blind spots of CNN.
As a result, some people directly fine-tune it, while others add modules to enhance its cross-modality capabilities, and the results seem promising.
But, do we really understand its essence?
- Is ViT really suited for such multimodal tasks?
- Why does the pretraining, which performed remarkably on ImageNet, seem to struggle here?
- If we did not use ImageNet and trained our own ViT, how could we keep it from overfitting?
- Does ViT capture the subtle differences between modalities?
The authors’ question is not just about optimizing a model training strategy, but they went back to the fundamentals and asked a more basic question:
Do we truly know how to use ViT to solve FAS?
Solving the Problem
After understanding the essence of the issue, the authors proposed solutions for three key aspects of ViT in multimodal FAS: input data format, fine-tuning strategy, and pretraining method.
Let’s look at each one.
Input Data
ViT is good at modeling global relationships, but its local inductive bias is weaker than a CNN's. The subtle local details may need a little help.
In FAS tasks, the key factors that distinguish real from fake faces often lie in subtle edge textures or high-frequency details. This is where CNN’s ability to capture “small details” becomes especially important.
Therefore, the authors revisited three classic local feature descriptors to fill ViT’s blind spots:
-
LBP (Local Binary Pattern)
Neighbor-to-center intensity comparisons form binary codes. Under ideal conditions, monotonic grayscale transforms preserving pixel ordering leave the code unchanged, but arbitrary shadows, exposure changes, and noise need not.
The formula is as follows:
-
HOG (Histogram of Oriented Gradients)
This method captures the edge direction distribution and expresses image structure through gradient histograms, offering tolerance to geometric and lighting variations.
-
PLGF (Pattern of Local Gravitational Force)
This lesser-known method is inspired by the law of universal gravitation. It strengthens edge and contour information by using local gravitational force distribution, making it especially effective against noise and lighting variations. The formula is as follows:
are directional filter masks, and denotes convolution. Division and squaring are elementwise: the numerator is not ordinary multiplication, so cannot simply be canceled. Implementations also need to handle zero-intensity pixels.
The specific pattern is shown below:
We can see the visual effects of these three features: from the dot matrix texture of LBP, the direction distribution of HOG, to the contour reconstruction of PLGF, each providing a different perspective to reinforce the original modality data.
The authors also tried to combine these features (e.g., GRAY + HOG + PLGF) and use them as three-channel inputs for ViT. Feeding handcrafted cues into a learned ViT representation proved particularly useful for IR in these tests.
Model Architecture
Let’s take a closer look at the core model architecture of this paper.
The backbone is a pretrained ViT, and the overall structure is intentionally designed to be highly frozen and lightly fine-tuned:
- Only the final classification head and the additional module AMA (Adaptive Multimodal Adapter) are involved in training, while the rest of the ViT structure is preserved in its original form.
The role of AMA is to act as an adapter, allowing the ViT, which traditionally processes a single modality, to understand multimodal inputs (such as RGB, IR, and Depth).
The structural design can be divided into four stages, as shown in the internal diagram of the AMA module above:
-
Channel Compression
Each modality’s input token undergoes a 1×1 convolution, reducing the original channel dimension to a hidden dimension . This step aims to condense the information and prepare a unified format for subsequent modality fusion.
-
Local Modality Fusion
Restore aligned patch tokens to 2D feature maps and concatenate channels into a four-dimensional tensor . A 3×3 convolution maps channels to shared channels, combining local spatial and cross-modal information.
-
Dynamic Modality Weights
GAP and a 1×1 convolution applied to the concatenated features before fusion produce Sigmoid weights. Each weight scales the same fused -channel map to form the modality branches. These are not softmax probabilities and need not sum to one.
-
Channel Recovery
Flatten the modality maps back to tokens, restore dimension with a 1×1 projection and GELU, and concatenate with class tokens passed through a channel bottleneck. AMA is inserted into the Transformer blocks’ attention/FFN paths; further backbone computation follows, rather than sending all adapter tokens directly to the classifier.
This design has several advantages:
- High Parameter Efficiency: Only a few parameters are fine-tuned, reducing the risk of overfitting.
- Refined Modality Fusion: Unlike traditional direct concatenation, it introduces dynamic weighting and convolutional fusion.
- Configurable modality combinations: With one modality, AMA reduces to ConvAdapter. The study fine-tunes for different downstream input combinations.
In other words, AMA is a low-intrusive, high-scalability modality fusion module, specifically tailored for the structural features of ViT. It allows a frozen ViT to process high-dimensional, multimodal spoof cues without retraining the lower layers.
Pretraining Method
Finally, the authors propose a new ViT pretraining framework: Modality-Asymmetric Masked AutoEncoder (M²A²E), the name in this paper's title. It uses aligned RGB/IR/Depth images from CeFA without live/spoof labels. Its encoder still starts from ImageNet weights before this self-supervised stage; it is not trained from scratch.
In ordinary MAE, we mask some patches and ask the model to reconstruct them. A multimodal version that provides visible patches from every modality can also let the model depend heavily on one source instead of learning cross-modal relationships. Reconstructing pixels alone does not necessarily teach the live/spoof cues we need. That is why the authors change the masking and reconstruction task.
- The patches of all modalities are masked, which causes the model to rely too heavily on one modality.
- The model's goal is simply to restore the image, which doesn't necessarily help with tasks like live detection that require "cross-modality semantics."
So, M²A²E changes the logic of masking and reconstruction:
- At each step, only one modality is randomly selected as the input.
- Mask 40% of that modality’s patches. Only visible tokens enter the encoder; separate, unshared modality decoders receive visible features and mask tokens and reconstruct with MSE.
- The model is then required to reconstruct:
- The masked patches of the selected modality (this part is traditional MAE).
- The complete image of the other modalities (this is the key innovation).
This design asks the model to "use one modality to predict the appearance of the other modalities," which is called cross-modality reconstruction. The authors aim for two benefits:
- Stronger ability to model semantic relationships between modalities.
- The ability to capture spoof cues such as "color distortion" and "depth missing."
Discussion
Experimental Results
In the WMCA experiments, the authors designed two scenarios:
- One where the model has already seen the attack types (seen protocol)
- Another where it has never encountered new attack types (unseen protocol).
The table above shows the benefits brought by AMA and M²A²E under these two scenarios, which can be interpreted in three ways:
-
AMA as an "Enhancer"
Against direct ViT fine-tuning, AMA lowers ACER in most modality and protocol settings. Single-modality cases use ConvAdapter; Depth's unseen mean worsens slightly from 10.42% to 10.49%.
-
M²A²E as a "Generalizer"
Additional M²A²E pretraining improves mean unseen ACER for IR, Depth, RGB+IR, IR+Depth, and all three modalities. RGB (9.42% to 11.50%) and RGB+Depth (5.78% to 5.82%) do not improve. Seen ACER also worsens in every multimodal combination, so the gain depends on the modality and protocol.
-
RGB+IR+Depth as the Strongest Combination
Three-modal AMA+M²A²E obtains 3.86% mean unseen ACER versus four-modal MC-CNN's 6.55%. In the seen protocol, however, MC-CNN has 1.04% versus 1.39% for AMA+M²A²E. Glasses attacks still have 17.99% ACER in the three-modal unseen protocol. These are results under the table's specific settings.
Are Local Descriptors Useful?
The authors test descriptor inputs for IR, with RGB and Depth also shown in Figure 4 under both direct fine-tuning and ConvAdapter:
- Single descriptors: LBP, HOG, PLGF
- Combined inputs: HOG+PLGF, LBP+HOG+PLGF, GRAY+HOG+PLGF
Key takeaways include:
- LBP is weak for RGB and IR: its ACER exceeds the raw input with both fine-tuning approaches. HOG is worst for Depth, so LBP is not the weakest in every modality.
- PLGF helps IR with direct fine-tuning: its ACER is below the raw input's there, but not with ConvAdapter.
- GRAY+HOG+PLGF performs best for IR with both direct fine-tuning and ConvAdapter. The final method uses this composition for IR and keeps raw RGB and Depth.
The results support local descriptors for this IR dataset and training setup. They do not independently isolate every sensor, lighting, and noise factor or prove that illumination sensitivity is the sole cause of IR performance differences.
Is AMA Just About More Parameters?
The authors tested five different adapter structures to find the most suitable design for ViT-FAS:
- Vanilla adapter: Primarily fully connected layers (FC)
- ConvAdapter (single-modality): Replacing FC with 2D convolution
- Multimodal ConvAdapter (compressed version): Fusion of features from different modalities followed by 2D convolution
- Multimodal ConvAdapter (full-dimension): Output dimensions retain the product of all modalities (D₀ × K)
- Adaptive Multimodal Adapter (AMA)
Key observations include:
- Replacing FC with Conv lowers ACER in all four groups shown, supporting local features in these ViT settings.
- Simplified Multimodal ConvAdapter outperforms the single-modality version in the table, showing that modality fusion within ViT is feasible.
- The full-dimensional version does not deliver a corresponding gain. Overfitting is the authors’ explanation.
- AMA is the most balanced among these methods, retaining modality differences while effectively weighting different feature sources.
Within the compared designs and datasets, local convolution and adaptive weighting of shared low-dimensional features are useful choices. This supports AMA here, without establishing that all multimodal ViTs require convolution or that AMA is the universal best solution.
Conclusion
We often see Transformer models applied to new tasks, but what sets this paper apart is that it doesn’t rush to stack more layers; instead, it goes back to a more fundamental question:
“If ViT is to be used for Multimodal FAS, what traits should it possess?”
The authors broke down this question into three aspects: input detail design, pretraining logic, and fine-tuning method. This approach is particularly valuable for FAS tasks with limited data and rapidly evolving attack patterns.