How wangzhuo2019/ssan works
This is a PyTorch research implementation of domain-generalized face anti-spoofing. The main workflow selects cross-dataset training and held-out testing, loads and augments face/depth-map samples, trains an SSAN model with liveness, shuffled-style contrastive, and domain-adversarial objectives, then evaluates video scores and saves checkpoints. The README also documents a separate large-scale benchmark; its directory is present, but its implementation is not sampled, so its internal wiring is not inferred.
Main entry points: solver.py Train and test · data_merge.py Protocol dataset bank · networks/__init__.py Model selection · configs/__init__.py Experiment settings
Components 20
Experiment workflow
- Experiment settings
configs/__init__.py - Train and test
solver.py
Data preparation
- Protocol dataset bank
datasets/data_merge.py - Face datasets
- CASIA-family train loader
datasets/Load_CASIA_train.py - CASIA-family eval loader
datasets/Load_CASIA_valtest.py - OULU train loader
datasets/Load_OULUNPU_train.py - OULU eval loader
datasets/Load_OULUNPU_valtest.py - Training transforms
transformers/transformer_train.py - Evaluation transforms
transformers/transformer_test.py
SSAN models
- Model selection
networks/__init__.py - SSAN-R
networks/SSAN_R.py - SSAN-M
networks/SSAN_M.py - AdaIN and GRL
networks/pub_mod.py
Learning and evaluation
- Contrastive loss
loss/__init__.py - Optimizer selection
optimizers/__init__.py - Video scoring
solver.py - FAS metrics
utils/performance.py
Benchmark
- Large-scale benchmark
Large_Scale_FAS_Benchmarks
Other components
- Researcher
Connections 21
- Researcher → Experiment settings: configures
- Researcher → Train and test: starts
- Experiment settings → Train and test: supplies settings
- Train and test → Protocol dataset bank: requests splits
- Protocol dataset bank → CASIA-family train loader: creates train set
- Protocol dataset bank → CASIA-family eval loader: creates eval set
- Protocol dataset bank → OULU train loader: creates train set
- Protocol dataset bank → OULU eval loader: creates eval set
- Protocol dataset bank → Face datasets: reads samples
- Train and test → Training transforms: selects transforms
- Train and test → Evaluation transforms: selects transforms
- Train and test → Model selection: builds model
- Model selection → SSAN-R: selects
- Model selection → SSAN-M: selects
- SSAN-R → AdaIN and GRL: uses
- SSAN-M → AdaIN and GRL: uses
- Train and test → Optimizer selection: creates optimizer
- Train and test → Contrastive loss: computes contrastive loss
- Train and test → Video scoring: runs test
- Video scoring → FAS metrics: computes metrics
- Researcher → Large-scale benchmark: uses benchmark protocol