Face Anti-Spoofing
January 1, 2026 · View on GitHub
Minimal inference utilities for silent face anti-spoofing using MiniFASNetV1SE and MiniFASNetV2 models.
Tip
The models and functionality in this repository are integrated into UniFace — an all-in-one face analysis toolkit.
| Real | Fake | Fake |
|---|---|---|
![]() | ![]() | ![]() |
Installation
pip install -r requirements.txt
Usage
Image Inference
python main.py --source assets/image.jpg --weight weights/MiniFASNetV2.pth --output result.jpg --view
Webcam Inference
python main.py --source 0 --weight weights/MiniFASNetV2.pth --view
Options
| Argument | Default | Description |
|---|---|---|
--weight | - | Path to model weights (.pth) |
--model | v2 | Model variant (v1se or v2) |
--source | 0 | Image path or camera index |
--output | - | Path to save output (image or video) |
--view | - | Display inference results |
--confidence | 0.5 | Face detection confidence threshold |
ONNX Export
python onnx_export.py --weight weights/MiniFASNetV2.pth --model v2 --dynamic
ONNX Inference
python onnx_inference.py --model weights/MiniFASNetV2.onnx --scale 2.7
Model Weights
| Model | Parameters | Crop Scale | Download |
|---|---|---|---|
| MiniFASNetV1SE | ~0.43M | 4.0 | PyTorch | ONNX |
| MiniFASNetV2 | ~0.43M | 2.7 | PyTorch | ONNX |
Reference
Based on Silent-Face-Anti-Spoofing


