Temporal Face Liveness Detection INT8 is a lightweight multimodal model designed to distinguish between a live face and a spoofed presentation.
The model processes a sequence of 10 RGB face frames together with 8 sensor features per frame. It uses a pretrained MobileNetV3-Small backbone for visual feature extraction, CBAM (Convolutional Block Attention Module) for visual attention, a feature projection network for image and sensor fusion, and an LSTMCell to model temporal information across the 10-frame sequence.
The trained PyTorch model is exported to ONNX and then converted to TensorFlow Lite INT8 for lightweight inference.
The published model is:
liveness_model_int8.tflite
The INT8 TFLite model is approximately 1.58 MB (1,655,200 bytes).
The LSTM is manually unrolled with LSTMCell rather than using a higher-level sequence module. This makes the computation graph more suitable for the ONNX and TensorFlow Lite conversion pipeline.
Usage
The INT8 TFLite model expects two inputs.
Image input
text
1Shape: [1, 10, 3, 224, 224]
2Data type: int8
Sensor input
text
1Shape: [1, 10, 8]
2Data type: int8
Output
text
1Shape: [1, 1]
2Data type: int8
Quantization parameters
The current INT8 model uses the following quantization parameters:
text
1Image input
2scale = 0.01865844801068306
3zero point = -14
45Sensor input
6scale = 0.014108065515756607
7zero point = -119
89Output
10scale = 0.04745396226644516
11zero point = 34
To convert a floating-point value to the model's quantized representation:
The current inference application dequantizes the model output, applies a sigmoid function, and uses 0.5 as the decision threshold:
text
1score > 0.5 → Real Face
2score <= 0.5 → Fake Face
TFLite example
python
1import tensorflow as tf
23interpreter = tf.lite.Interpreter(4 model_path="liveness_model_int8.tflite",5 num_threads=4,6)78interpreter.allocate_tensors()910inputs = interpreter.get_input_details()11outputs = interpreter.get_output_details()1213print("Inputs:")14for item in inputs:15print(item["name"])16print("Shape:", item["shape"])17print("Dtype:", item["dtype"])18print("Quantization:", item["quantization"])1920print("Outputs:")21for item in outputs:22print(item["name"])23print("Shape:", item["shape"])24print("Dtype:", item["dtype"])25print("Quantization:", item["quantization"])
To perform inference, the input frames must be resized to 224 × 224, converted to RGB, normalized using ImageNet statistics, arranged in the layout expected by the model, and quantized using the model's input scale and zero point.
Important usage requirement
The model is temporal. A single unrelated image is not equivalent to the intended input.
The expected input is a fixed sequence of 10 consecutive frames.
The sensor input is also part of the model interface. If meaningful sensor measurements are unavailable, an application may provide zero-filled sensor values, but this should not be interpreted as equivalent to using real sensor information.
Known failure cases
Performance may degrade under:
Poor lighting
Motion blur
Very low-quality camera input
Large pose changes
Faces that are too small
Partially visible faces
Unseen spoofing techniques
Incorrect image normalization
Incorrect quantization
Incorrect tensor layout
Incorrect frame ordering
Missing or unrealistic sensor information
The model should not be treated as a complete identity-verification system.
System
This model is a component of a larger face-liveness detection pipeline rather than a complete identity-recognition system.
A typical deployment can use the following pipeline:
The downstream application is responsible for deciding how the liveness result should be used. For example, it may be one signal in an authentication, KYC, attendance, access-control, or verification workflow.
Implementation Requirements
Training
The model was trained using PyTorch and related machine-learning libraries.
The training configuration includes:
text
1Optimizer: Adam
2Initial learning rate: 1e-4
3Batch size: 4 by default
4Maximum epochs: 20 by default
5Early stopping patience: 5 epochs
6Loss: BCEWithLogitsLoss
7Learning-rate scheduler: ReduceLROnPlateau
The training pipeline evaluates:
Accuracy
Precision
F1-score
ROC-AUC
Training loss
Validation loss
The best checkpoint is selected according to validation loss.
The training code can use CUDA when a compatible GPU is available and otherwise falls back to CPU.
Inference
The final model is intended for CPU-based TensorFlow Lite inference.
The deployment application uses a TFLite interpreter with multiple threads and XNNPack support when available.
Actual inference latency depends on:
CPU architecture
Number of threads
TFLite runtime
Camera preprocessing
Face detection
Memory bandwidth
Device thermal conditions
No formal energy-consumption measurement is reported for this model.
Model Characteristics
Model initialization
The visual feature extractor is initialized from a pretrained:
The temporal sequence is manually unrolled for 10 time steps during export.
The INT8 conversion uses a representative dataset for activation calibration and requests built-in INT8 TensorFlow Lite operations with INT8 input and output tensors.
Quantization
The final published model is fully INT8 quantized for lightweight inference.
The effective number of 10-frame clips is different from the number of image files because the dataset loader creates temporal clips from consecutive frames.
Demographic groups
The project does not provide demographic annotations for the training data.
Therefore, demographic performance has not been formally measured.
The model should not be assumed to have equivalent performance across:
Age groups
Genders
Skin tones
Geographic populations
Camera types
Environmental conditions
Evaluation data
The project uses a separate test directory for model evaluation.
The repository does not provide a documented subject-level split methodology. Therefore, users should evaluate the model carefully for possible similarity between samples, sessions, subjects, or acquisition conditions in their own datasets.
Evaluation Results
Summary
The training and analysis pipelines calculate:
Accuracy
Precision
F1-score
ROC-AUC
Training loss
Validation loss
Confusion matrices
The project also evaluates multiple model formats, including PyTorch, ONNX, FP32 TFLite, and INT8 TFLite.
This model card does not claim specific final INT8 accuracy, precision, recall, F1, ROC-AUC, APCER, BPCER, or ACER values because a single authoritative, versioned benchmark table for the exact published INT8 file is not included with this model release.
For a research-grade or production release, these metrics should be regenerated using the exact published model and a fixed evaluation split, then recorded here.
Subgroup evaluation results
No formal subgroup analysis is currently documented.
The model has not been comprehensively evaluated across:
Age groups
Gender groups
Skin tones
Camera manufacturers
Camera resolutions
Lighting conditions
Pose ranges
Presentation attack types
These remain important areas for future evaluation.
Fairness
A formal fairness analysis was not performed for this release.
No demographic fairness metrics were reported.
For security-sensitive deployments, false acceptance and false rejection behavior should be evaluated across relevant populations and operating conditions.
Usage Limitations
This model should be considered a research and development model for face liveness detection.
It should not be used as the sole security control for high-risk authentication.
Performance may be affected by:
Unseen spoofing methods
Printed or displayed media with characteristics different from the training data
Poor lighting
Motion blur
Camera quality
Face alignment
Extreme poses
Incorrect frame ordering
Incorrect preprocessing
Incorrect INT8 quantization
Missing or inaccurate sensor information
Hardware-specific differences
The model is not an identity-recognition model and does not determine who a person is.
Security considerations
Liveness detection should be treated as one signal in a broader security system.
A production deployment should consider additional controls such as:
Identity verification
Rate limiting
Replay resistance
Secure communication
Monitoring
Appropriate rejection handling
Abuse prevention
Ethics
Face liveness detection can help reduce presentation attacks, but biometric systems can introduce privacy, security, and fairness risks.
Potential risks include:
False rejection of legitimate users
False acceptance of spoofing attempts
Unequal performance across populations
Misuse in surveillance or other unintended contexts
Collection or retention of facial imagery
Over-reliance on automated security decisions
This model does not perform identity recognition. It estimates whether the provided facial input appears to be live.
Applications using this model should minimize the collection and retention of biometric data, clearly communicate how camera and sensor data are used, and evaluate the model on representative deployment data before using it in security-sensitive workflows.
Reproducibility and Source Code
The complete source code, training pipeline, conversion scripts, inference scripts, and web application are available in the project repository:
The repository contains the model architecture, dataset loader, training code, conversion scripts, inference scripts, Flask application, and exported model formats.
Published Hugging Face artifact
This Hugging Face model release contains:
liveness_model_int8.tflite
The INT8 TFLite file is the primary artifact intended for users who want to perform lightweight inference without needing the complete training and conversion environment.
The PyTorch, ONNX, FP16 TFLite, FP32 TFLite, training, and conversion files remain available in the GitHub repository.
Citation
If you use this model or the associated project in research or another project, please cite the GitHub repository:
text
1Vinay B R.
2Temporal Face Liveness Detection.
3GitHub: https://github.com/VinayBR03/Face-Liveness-Detection