TRAM: Finetuning-Free Test-Time Adaptation for Generalized Face Anti-Spoofing with Only a Few Bonafide Samples
Abstract
Generalized face anti-spoofing (FAS) has attracted increas-ing attention due to the need for robustness in unseen scenarios. Do-main adaptation methods can improve performance by leveraging target-domain information. However, in FAS, collecting spoof samples is signif-icantly more expensive than acquiring a few bonafide samples, makingit impractical to gather diverse attack types and finetune models foreach deployment scenario. To address this challenge, we propose Text-guided RelAtionship Modeling (TRAM), a finetuning-free test-time do-main adaptation approach for generalized FAS using only a few bonafidesamples. Since samples within a target domain share common domainfactors, we treat genuine sample as the anchor and model its relation-ship with incoming inputs to mitigate domain bias. To learn discrimina-tive spoof cues from these relationships, we introduce a Relative Image-Pair-Text Contrastive Learning strategy that leverages fine-grained FASrelation prompts. Furthermore, to compensate for the lack of detailedspoof annotations, we design a Fine-grained Relation Prompt Learn-ing strategy that mines low-level photometric discrepancies through pre-computed measurements to generate robust prompts. Extensive exper-iments on eight FAS datasets with typical variations demonstrate thatTRAM achieves consistent improvements over state-of-the-art methodswhile using only a few bonafide samples from the target domain (as fewas five). Comprehensive ablation studies further validate the effectivenessof each component.