Gong, Liang YuLi, Xue Jun2025-02-052025-02-052025-01-23Electronics, ISSN: 2079-9292 (Print); 2079-9292 (Online), MDPI AG, 14(3), 448-448. doi: 10.3390/electronics140304482079-92922079-9292http://hdl.handle.net/10292/18591Face anti-spoofing (FAS) has always been a hidden danger in network security, especially with the widespread application of facial recognition systems. However, some current FAS methods are not effective at detecting different forgery types and are prone to overfitting, which means they cannot effectively process unseen spoof types. Different loss functions significantly impact the classification effect based on the same feature extraction without considering the quality of the feature extraction. Therefore, it is necessary to find a loss function or a combination of different loss functions for spoofing detection tasks. This paper mainly aims to compare the effects of different loss functions or loss function combinations. We selected the Swin Transformer as the backbone of our training model to extract facial features to ensure the accuracy of the ablation experiment. For the application of loss functions, we adopted four classical loss functions: cross-entropy loss (CE loss), semi-hard triplet loss, L1 loss and focal loss. Finally, this work proposed combinations of Swin Transformers and different loss functions (pairs) to test through in-dataset experiments with some common FAS datasets (CelebA-Spoofing, CASIA-MFSD, Replay attack and OULU-NPU). We conclude that using a single loss function cannot produce the best results for the FAS task, and the best accuracy is obtained when applying triplet loss, cross-entropy loss and Smooth L1 loss as a loss combination.© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).https://creativecommons.org/licenses/by/4.0/40 Engineering4009 Electronics, Sensors and Digital Hardware1.1 Normal biological development and functioning0906 Electrical and Electronic Engineering4009 Electronics, sensors and digital hardwareQuantitative Study of Swin Transformer and Loss Function Combinations for Face Anti-spoofingJournal ArticleOpenAccess10.3390/electronics14030448