How recognito-vision/linux-facerecognition-facelivenessdetection works
Project Type and Purpose
• This is a demo repository showcasing on-premise face-based services (recognition, liveness detection, 1:N identification and a “lite” SDK) all built to run on a Linux server.
• Each demo is packaged as a Docker-ready microservice exposing both a REST API (Flask) and a web UI (Gradio). Under the hood they all invoke a common C++-based Face Engine (via OpenVINO) to perform inference.
File Structure Highlights
• Top-level demo folders:
– FaceSDK-Lite-Demo: C++ sample (CMake + main.cpp) + Python wrappers (Flask, Gradio)
– Recognition-Demo, LivenessDetection-Demo, Identification(1:N)-Demo: share identical structure
• Each demo contains:
– Dockerfile (builds container with OpenVINO, custom kernels, Python deps)
– dependency/openvino (IR models + custom VPU kernels)
– flask/app.py (REST endpoints)
– install.sh, run_demo.sh
– license.txt
• README.md ties it all together and documents Docker commands & runtime ports (8000 API, 7860 UI).
Key Architectural Components
a. Physical Host & Container Platform
– Ubuntu 20.04/22.04 server running Docker Engine
b. Microservices (one per demo)
– Docker Container
• Flask API Layer
• Gradio UI Layer
• Face Engine client library (C++ wrapper or Python binding)
• OpenVINO runtime + custom VPU kernels + IR models
• License file (mounted volume)
c. Shared Services / Artifacts
– Face Engine Core (compiled C++ .so or static lib)
– Model files (face detection, feature extractor, liveness net, attribute net)
– Face database (for 1:N identification)
– Temporary storage for input/output images (optional)
d. External Integrations
– eKYC system or CCTV ingest (HTTP/REST calls to Flask endpoints)
– Client applications consuming REST API or embedded Gradio UI
Inter-Component Relationships & Data Flow
1. User/browser → Gradio UI (port 7860)
2. Gradio → Flask REST API (localhost:8000)
3. Flask handler → Face Engine binding
4. Face Engine → OpenVINO runtime with IR models + custom kernels
5. OpenVINO → Model inference → returns results (features, liveness score, attributes)
6. For 1:N identification: Engine queries face database → nearest-neighbor search → returns candidate IDs
7. Flask → JSON response → Gradio or external client
Architectural Patterns & Design Principles
• Microservices: each demo is an isolated container/service
• Separation of concerns: UI (Gradio) / API (Flask) / Inference Engine (C++)
• Containerization: Dockerfiles ensure reproducible environment (OpenVINO, Python, C++ SDK)
• Plug-and-play: drop in new IR models or kernels under dependency/openvino
• Dual UI layer: easily swap or disable Gradio vs Flask-only via command-line flags
• Clear labels for each container/demo (Recognition, Liveness, 1:N ID, Lite)
• Sub-components inside each (Gradio UI, Flask API, C++ Engine, OpenVINO + Models)
• Notes about ports (8000, 7860) and volume mounts (license.txt, models)