Multi-stage AI liveness detection module with face quality check, passive depth analysis, active challenge-response and face embedding matching.
Designed and built a multi-tenant biometric verification platform for SaaS applications operating in security-sensitive environments. The system combines passive liveness detection, active challenge-response verification, and face embedding matching to defend against photo, screen replay, and video spoof attacks, without requiring specialized depth hardware.
Stage 1: Frame Quality Validation
Pre-inference gate layer: Rejects low-quality frames before inference (blur, poor lighting, invalid face size) to reduce unnecessary model execution and improve user feedback.
Stage 2: Passive Liveness (silent, background)
Depth Anything V2 (ONNX) estimates monocular depth across a configurable frame window to detect flat-surface spoof attacks. FFT and HSV-reflection based heuristics add additional screen replay detection.
Stage 3: Active Liveness (challenge-response)
MediaPipe FaceMesh validates configurable actions including blinking, head movement, and smiling using landmark-based motion analysis.
Stage 4: Face Verification
InsightFace embeddings are matched against stored user vectors using cosine similarity with configurable tenant-level confidence thresholds.
Open-source anti-spoofing models struggled under real-world conditions
Several passive liveness models performed well in controlled testing but produced unacceptable false-positive rates under varied lighting, webcam quality, and screen replay conditions. Hardware depth cameras were ruled out due to deployment cost, leading to adoption of Depth Anything V2 with additional FFT and reflection-based spoof heuristics.
Depth model quality improves with scene context beyond the face
Expanding crops beyond the face region improved depth consistency and spoof detection reliability.
Camera-distance normalization is essential
Relative depth normalization (inter-ocular-distance) produced stable active liveness metrics across varying user distances from camera.
Tenant-level configuration hot-reloading simplified operations
Passing configuration dynamically from the Node.js gateway enabled instant threshold updates without restarting inference services.
Vision AI
Runtime
Backend
Frontend
Building a security-critical platform that needs biometric verification? Whether passive liveness, active challenge-response, or multi-tenant auth - let's design the right AI security layer.
✉ Get in Touch