Vital sign estimation from facial video
Project description
vitallens-python
Estimate vital signs such as heart rate, HRV, and respiratory rate from video in Python.
vitallens is the official Python client for the VitalLens API, a service for estimating physiological vital signs like heart rate (HR), respiratory rate (RR), and heart rate variability (HRV) from facial video.
The library provides:
- High-Fidelity Accuracy: A simple interface to the VitalLens API for state-of-the-art estimation (heart rate, respiratory rate, HRV).
- Local Fallbacks: Implementations of classic rPPG algorithms (
pos,chrom,g) for local, API-free processing. - Flexible Input: Support for video files and in-memory
np.ndarray. - Real-time Streaming:
stream()context manager for low-latency live inference. - Face Detection: Integrated fast face detection and ROI management.
Using a different language? Check out our JavaScript client and iOS SDK.
Installation
pip install vitallens
Quickstart
Try it instantly (No API Key)
You can test the library immediately using classic local algorithms (like pos). This runs entirely on your machine.
from vitallens import VitalLens
# Use a local method (Pulse only, no API Key required)
vl = VitalLens(method="pos")
results = vl("path/to/video.mp4")
print("Heart Rate:", results[0]['vitals']['heart_rate']['value'])
Get High-Fidelity Accuracy (with API Key)
To get improved accuracy and advanced metrics like Respiratory Rate and HRV, use the vitallens method. You can get a free key from the API Dashboard.
from vitallens import VitalLens
# Automatically selects the best model for your plan
vl = VitalLens(method="vitallens", api_key="YOUR_API_KEY")
results = vl("path/to/video.mp4")
vitals = results[0]['vitals']
print(f"Heart Rate: {vitals['heart_rate']['value']:.1f} bpm")
print(f"Respiratory Rate: {vitals['respiratory_rate']['value']:.1f} rpm")
# HRV is available on paid plans
if 'hrv_sdnn' in vitals:
print(f"HRV (SDNN): {vitals['hrv_sdnn']['value']:.1f} ms")
Real-time Streaming
Process live frames from a webcam or stream.
import time
from vitallens import VitalLens
# Process live frames
vl = VitalLens(method="vitallens", api_key="YOUR_API_KEY")
with vl.stream() as session:
# In your capture loop (e.g., OpenCV)
session.push(frame, timestamp=time.time())
results = session.get_result(block=False)
Documentation
For full API reference, advanced configuration, proxy usage, and result schemas, visit the documentation at docs.rouast.com/python.
Troubleshooting
- Prerequisites: Requires
python>=3.10andffmpeginstalled and on your$PATH. - Windows: Microsoft Visual C++ Build Tools are required.
- ONNX Runtime: If you encounter installation issues with
onnxruntime, try installing it via conda first:conda install -c conda-forge onnxruntime.
Disclaimer
vitallens provides vital sign estimates for general wellness purposes only. It is not intended for medical use. Always consult with your doctor for any health concerns or for medically precise measurement.
See also our Terms of Service for the VitalLens API and our Privacy Policy.
License
This project is licensed under the MIT License.
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 Distribution
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 vitallens-0.6.1.tar.gz.
File metadata
- Download URL: vitallens-0.6.1.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
386ebf3a079982a85d68823be555da67bb303eb60a5c374346ae689ffb63b98e
|
|
| MD5 |
89b38512f5662ca3e7aefde0ca056086
|
|
| BLAKE2b-256 |
7e41b766b3f6bdea22cf15df2a16c8154ec28307543baccf9099382a94e6deef
|
Provenance
The following attestation bundles were made for vitallens-0.6.1.tar.gz:
Publisher:
release.yml on Rouast-Labs/vitallens-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vitallens-0.6.1.tar.gz -
Subject digest:
386ebf3a079982a85d68823be555da67bb303eb60a5c374346ae689ffb63b98e - Sigstore transparency entry: 1109332419
- Sigstore integration time:
-
Permalink:
Rouast-Labs/vitallens-python@ee2a69758b91d2980dd4d913add6986e7ea51e3b -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/Rouast-Labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ee2a69758b91d2980dd4d913add6986e7ea51e3b -
Trigger Event:
push
-
Statement type:
File details
Details for the file vitallens-0.6.1-py3-none-any.whl.
File metadata
- Download URL: vitallens-0.6.1-py3-none-any.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1acc8d6f922ac0ec3dc382a63cd4f7a3aacc9fc96ea1dc858642eb4cc1c1808d
|
|
| MD5 |
ce4a2b98f4bebb2e4f2f70e7c48fea32
|
|
| BLAKE2b-256 |
113f531c1f9c36fa7c54e2029d19ef4f9d366678b9e8b48fd09e85327598e4e6
|
Provenance
The following attestation bundles were made for vitallens-0.6.1-py3-none-any.whl:
Publisher:
release.yml on Rouast-Labs/vitallens-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vitallens-0.6.1-py3-none-any.whl -
Subject digest:
1acc8d6f922ac0ec3dc382a63cd4f7a3aacc9fc96ea1dc858642eb4cc1c1808d - Sigstore transparency entry: 1109332429
- Sigstore integration time:
-
Permalink:
Rouast-Labs/vitallens-python@ee2a69758b91d2980dd4d913add6986e7ea51e3b -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/Rouast-Labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ee2a69758b91d2980dd4d913add6986e7ea51e3b -
Trigger Event:
push
-
Statement type: