Back to Projects

Multi-Tenant Biometric Verification & AI Liveness System

Multi-stage AI liveness detection module with face quality check, passive depth analysis, active challenge-response and face embedding matching.

Passive inference latency (CPU/frame)~150–350ms
End-to-end latency~700–800ms
InferenceSub-second (ONNX)
Spoof resistanceHigh photo/screen replay resistance

Problem Statement

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.

System Architecture

Pipeline Stages

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.

Key Engineering Learnings

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.

Tech Stack

Vision AI

Depth Anything V2InsightFaceMediaPipe FaceMesh

Runtime

ONNX RuntimePyTorchOpenCV

Backend

FastAPINode.jsMySQLJWT

Frontend

ReactWebSocketsReal-Time Streaming

Want to Work Together?

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