Liveness detector server launcher with precompiled binaries
Project description
Gesture-based Facial Liveness Detector
by 2060.io — Secure, customizable, open-source liveness detection with randomized facial gestures and real-time computer vision.
Project Overview
The Liveness Detector enables reliable human presence verification using randomized facial gesture challenges.
Unlike traditional face checks, this system prompts users for live gestures (blink, smile, head turn, etc.), fighting replay and spoof attacks.
- Fast: C++/MediaPipe core, controlled from Python.
- Flexible: Add gestures/locales with JSON.
- User-friendly: Minimal Python code, easy to customize.
- Extensible: For both production users and contributors.
For Python Users — Install & Use
1. Install via PyPI
✨ Now on PyPI! ✨
You can install the liveness detector with:pip install liveness-detectorNote: The package is currently distributed with Linux wheels only; Windows/macOS support is coming soon!
2. Minimal Video Usage Example (Webcam Integration)
This script captures video frames from the webcam, processes them, and displays real-time liveness feedback:
import cv2
from liveness_detector.server_launcher import GestureServerClient
def string_callback(message):
print(f"Message: {message}")
def report_alive_callback(alive):
print(f"Liveness result: {'ALIVE' if alive else 'NOT ALIVE'}")
def main():
server_client = GestureServerClient(
language='en',
socket_path='/tmp/liveness_socket',
num_gestures=2
)
server_client.set_string_callback(string_callback)
server_client.set_report_alive_callback(report_alive_callback)
if server_client.start_server():
cap = cv2.VideoCapture(0) # Start webcam
try:
while True:
ret, frame = cap.read()
if not ret:
break
processed = server_client.process_frame(frame)
if processed is not None:
cv2.imshow("Liveness Detector", processed)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
finally:
cap.release()
cv2.destroyAllWindows()
server_client.stop_server()
if __name__ == "__main__":
main()
You can further use callbacks to save images or trigger custom actions.
Custom Gestures and Translations
Add Gestures / Languages at Runtime
You can pass extra gesture directories or translation files when constructing the Python GestureServerClient:
server_client = GestureServerClient(
language='es',
socket_path='/tmp/liveness_socket',
num_gestures=2,
extra_gestures_paths=['/path/to/my_custom_gestures'],
extra_locales_paths=['/path/to/my_custom_locales'],
gestures_list=['blink', 'openCloseMouth']
)
extra_gestures_paths: List of folders with additional gesture JSONs.extra_locales_paths: List of folders with more translation JSONs.gestures_list: (Optional) List of gesture names to permit for this session.
Example custom gesture:
{
"gestureId": "blink",
"label": "Blink your eyes",
"signal_key": "eyeBlinkLeft",
"instructions": [
{"move_to_next_type": "lower", "value": 0.35, "reset": {"type": "timeout_after_ms", "value": 10000}}
]
}
Example custom locale (for Spanish):
{
"gestures": {
"blink": {"label": "Parpadea"}
},
"warning": {
"wrong_face_width_message": "El ancho de la cara no es correcto."
}
}
Features
- Challenge-Based Liveness: Random gestures defeat spoofing and replay.
- Real-Time Response: MediaPipe and C++ for instant feedback, smooth overlays.
- Pluggable Gestures and Languages: Just add JSON, no code required.
- Python-First: Drop-in camera pipelines with only a few lines.
- Extensible for Power Users: Add pipeline steps, new models, or UI feedback.
Security and Privacy
- All processing local by default.
- Open source: audit and improve as you wish.
- Randomization ensures every session is unique.
License
This project is licensed under the GNU Affero General Public License.
Contact and Support
- GitHub Issues
- Learn more: https://2060.io
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file liveness_detector-0.7.0-py3-none-manylinux2014_x86_64.whl.
File metadata
- Download URL: liveness_detector-0.7.0-py3-none-manylinux2014_x86_64.whl
- Upload date:
- Size: 22.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bb03c7ab0e70412a122a0e5cae7563ab38ee3f99ddd513fe26df0cc0ce46936
|
|
| MD5 |
e34a44e049cac89c77c167bd2cb1fe94
|
|
| BLAKE2b-256 |
0022bdd2b27c02851a1b4620b214ed228a5efee7e3e45dcc7922e9345556ffed
|
Provenance
The following attestation bundles were made for liveness_detector-0.7.0-py3-none-manylinux2014_x86_64.whl:
Publisher:
cd.yml on 2060-io/vision-liveness-detector
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
liveness_detector-0.7.0-py3-none-manylinux2014_x86_64.whl -
Subject digest:
7bb03c7ab0e70412a122a0e5cae7563ab38ee3f99ddd513fe26df0cc0ce46936 - Sigstore transparency entry: 434440216
- Sigstore integration time:
-
Permalink:
2060-io/vision-liveness-detector@58bbe3d37bfce709ef03724d7a1bad59f78156e6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/2060-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@58bbe3d37bfce709ef03724d7a1bad59f78156e6 -
Trigger Event:
push
-
Statement type: