Face Anti-Spoofing

January 1, 2026 · View on GitHub

Downloads GitHub Repo stars

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.
PyPI Version GitHub Stars License

RealFakeFake
RealFakeFake

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

ArgumentDefaultDescription
--weight-Path to model weights (.pth)
--modelv2Model variant (v1se or v2)
--source0Image path or camera index
--output-Path to save output (image or video)
--view-Display inference results
--confidence0.5Face 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

ModelParametersCrop ScaleDownload
MiniFASNetV1SE~0.43M4.0PyTorch | ONNX
MiniFASNetV2~0.43M2.7PyTorch | ONNX

Reference

Based on Silent-Face-Anti-Spoofing