File size: 2,736 Bytes
ea1fc9e bf0fd5d cd7f8dc 3ed7b90 8cc31ee bf0fd5d cd7f8dc bf0fd5d cd7f8dc bf0fd5d cd7f8dc 3ed7b90 3fa6ac6 bf0fd5d cb4f1ff bf0fd5d 07251e1 bf0fd5d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
---
license: mit
language:
- en
---
# VascularAge Model
## Background
Photoplethysmography (PPG) has emerged as a non-invasive method for monitoring cardiovascular health. This model estimates vascular age (AI-vascular age) from PPG signals, offering insights into an individual's cardiovascular health and associated risks.
The model was developed and evaluated using data from the UK Biobank (UKBB) cohort, where PPG signals were collected in a standardized format. For more details, please refer to our [research article](https://arxiv.org/abs/2502.12990).
## Use Case
The `VascularAge` model is designed to estimate vascular age, which can be used for:
- **Risk Stratification**: Identifying individuals at higher risk for cardiovascular events.
- **Health Monitoring**: Tracking cardiovascular health over time to support personalized interventions.
This model provides a non-invasive, scalable approach for real-time cardiovascular health assessment using PPG signals. It is specifically trained to process PPG data from the UKBB dataset, ensuring its effectiveness in research and clinical settings that use similar data.
## Data Format
To ensure compatibility, PPG signals should be preprocessed and formatted in the same way as in the UKBB dataset. The expected format for input PPG signals is a 3D array with the shape `(batch_size, num_channels, num_samples)`.
## Usage (Pytorch)
```python
import json
import torch
import numpy as np
from net1d import Net1D
# Function to normalize PPG data (Z-score along the last dimension)
def normalize_ppg(parsed_ppg: np.ndarray) -> np.ndarray:
mean_ppg = parsed_ppg.mean(axis=-1, keepdims=True) # Compute mean along the last dimension
std_ppg = parsed_ppg.std(axis=-1, keepdims=True) # Compute standard deviation along the last dimension
normalized_ppg = (parsed_ppg - mean_ppg) / (std_ppg + 1e-8) # Z-score normalization
return normalized_ppg
# Load the configuration file
with open('./config.json') as f:
cfg = json.load(f)
device = 'cuda' if torch.cuda.is_available() else 'cpu'
# Initialize the model
model = Net1D(**cfg).to(device)
# Load model weights
model.load_state_dict(torch.load('./model.pth', map_location=device))
# Prepare raw PPG data (example) and normalize it
raw_ppg_data = np.random.randn(1, 1, 100) # Example PPG data (batch size of 1, 1 channel, 100 time steps)
normalized_ppg_data = normalize_ppg(raw_ppg_data) # Normalize the PPG data
# Convert normalized PPG data to tensor
ppg_data_tensor = torch.tensor(normalized_ppg_data, dtype=torch.float32).to(device)
# Perform inference
model.eval()
with torch.no_grad():
vascular_age = model(ppg_data_tensor)
print(f"Estimated Vascular Age: {vascular_age.item()}") |