Transformer-Based Face Liveness Detection
Built a CNN + Transformer model to distinguish live faces from printed photos, photos displayed on screens, and videos replayed on screens. Camera-frame sequences provide both visual features and temporal relationships. The work spans video sampling, model training, and integration into a face-analysis inference pipeline.
Presentation attacks covered
- Printed photos
- Photos displayed on screens
- Videos replayed on screens
From frame features to a video-level decision
Video sampling
Configurable sequence length and sampling interval
CNN
Extract visual features from each frame
Transformer
Model frame order with positional encoding and a CLS token
Liveness decision
Use the sequence representation for a clip-level decision
My contribution
Developed the temporal model and video training pipeline, then integrated liveness detection with YOLO detection, face embeddings and expression recognition in a shared inference flow.
Self-collected sample evaluation
Tested with self-recorded live-face footage and photo/video presentation attacks. In small development-stage demonstrations, the Transformer-based model made fewer errors than the baseline used at the time.
A qualitative observation from development demonstrations, not a benchmark accuracy measurement.
Technical record
Challenge
A single frame is often not enough to distinguish a real face from printed photos, photos displayed on screens, or videos replayed on screens. Temporal motion provides the additional signal needed for liveness detection.
Approach
Built a CNN + Transformer model: the CNN extracts frame-level features and the Transformer models temporal relationships across the video sequence.
Implementation
Implemented the video training pipeline and integrated YOLO detection, face embeddings, expression recognition, and liveness detection into one inference flow.
Tech stack
PyTorch, CNN plus Transformer, YOLO for detection.
- Developed a CNN + Transformer model that processes frame sequences rather than single images.
- Built a video training pipeline with configurable sequence length and frame-sampling interval.
- Applied a CLS token and positional encoding to model clip-level information and frame order.
- Integrated YOLO detection, face embeddings, expression recognition, and liveness detection into one pipeline.