Artifact detection for physiological signals (ABP and ECG)
Project description
OkekeClean
OkekeClean provides pre-trained artifact detection models for arterial blood pressure (ABP) and electrocardiogram (ECG) waveforms. The package ships inference code for the released models and downloads checkpoint weights from Hugging Face on first use.
Installation
pip install okekeclean
Or with uv:
uv add okekeclean
Quick Start
ABP
import pandas as pd
import torch
from okekeclean import ABPParams, detect_artifacts, load_model
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = load_model("okekeclean-abp-ensemble", device=device)
waveform = pd.Series(
[80.0, 83.2, 90.5, 102.1, 110.4, 105.0, 96.3, 88.7] * 500,
index=pd.Timestamp("2025-01-01")
+ pd.to_timedelta(range(4000), unit="s") / 125,
)
artifact_flags = detect_artifacts(
waveform=waveform,
modality="ABP",
model=model,
params=ABPParams(),
device=device,
)
ECG
import numpy as np
import pandas as pd
import torch
from okekeclean import ECGParams, detect_artifacts, load_model
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = load_model("okekeclean-ecg-efficientnet_b0", device=device)
samples = 5000
time = np.arange(samples) / 500.0
waveform = pd.Series(
0.9 * np.sin(2 * np.pi * 1.2 * time) + 0.05 * np.random.randn(samples),
index=pd.Timestamp("2025-01-01") + pd.to_timedelta(time, unit="s"),
)
artifact_probs = detect_artifacts(
waveform=waveform,
modality="ECG",
model=model,
params=ECGParams(),
device=device,
return_type="probability",
)
See quickstart_abp.py
and quickstart_ecg.py
for runnable examples with synthetic inputs.
Released Models
| Model | Signal | Architecture | Threshold | Test performance |
|---|---|---|---|---|
okekeclean-abp-ensemble |
ABP | ResNet-18 (full FT) + EfficientNet-B0 (shallow FT) | 0.184 |
AU-ROC 0.958, sensitivity 0.952, specificity 0.730, accuracy 0.795 |
okekeclean-abp-resnet18 |
ABP | ResNet-18 (full FT) | 0.17785164713859558 |
AU-ROC 0.951, sensitivity 0.915, specificity 0.824, accuracy 0.851 |
okekeclean-abp-efficientnet_b0 |
ABP | EfficientNet-B0 (shallow FT) | 0.04994076117873192 |
AU-ROC 0.945, sensitivity 0.799, specificity 0.939, accuracy 0.898 |
okekeclean-ecg-efficientnet_b0 |
ECG | EfficientNet-B0 (full FT) | 0.20802117884159088 |
AU-ROC 0.970, sensitivity 0.858, specificity 0.950, accuracy 0.922 |
Input Requirements
- ABP:
pd.Serieswith aDatetimeIndex, sampled at 125 Hz, units in mmHg. - ECG:
pd.Serieswith aDatetimeIndex, sampled at 500 Hz, units in mV. ECG segments are resampled to 500 Hz internally if needed.
Model Weights
- ABP weights: https://huggingface.co/moberg-analytics/okekeclean-abp
- ECG weights: https://huggingface.co/moberg-analytics/okekeclean-ecg
Papers
License
GNU Affero General Public License v3. See LICENSE.
Citation
@misc{okekeclean,
title = {OkekeClean},
author = {Tony Kabilan Okeke},
year = {2026},
howpublished = {\url{https://github.com/moberg-analytics/oss-models}}
}
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 okekeclean-1.0.1.tar.gz.
File metadata
- Download URL: okekeclean-1.0.1.tar.gz
- Upload date:
- Size: 20.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
491b2200ab3ac7888c4db09c00316bf6da6a17563119e7797be46d8daea013c5
|
|
| MD5 |
f0150d391045e1a03b4125e03371c539
|
|
| BLAKE2b-256 |
559e23c4482ab771ce0430a95f95cf971acae435bf5065244ce57332e48b9938
|
File details
Details for the file okekeclean-1.0.1-py3-none-any.whl.
File metadata
- Download URL: okekeclean-1.0.1-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c4359e2f361a5aec0d60158d86681d5232f34430d8776c83a18d2b057f408c0
|
|
| MD5 |
2dc2b1ba09509a73b6f6b4e706c7fd13
|
|
| BLAKE2b-256 |
c2a01ac8867f06aac6fae3a5e6b3d3a6745f59864d7f7bc21bcd971b0f5d6229
|