Mamba: Linear-Time Sequence Modeling with Selective State Spaces
Paper
•
2312.00752
•
Published
•
149
ECG-Mamba is a deep learning model that leverages the Mamba state space architecture for classifying cardiac abnormalities from 12-lead ECG signals. The model is trained on the PTB-XL dataset from PhysioNet.
This model is designed for:
Note: This model is NOT intended for clinical diagnosis or medical decision-making.
On the test subset (500 records):
Important: These metrics are from a small-scale demonstration. For production use, train on the full PTB-XL dataset (21,837 records).
| Class | Description |
|---|---|
| NORM | Normal ECG |
| MI | Myocardial Infarction |
| STTC | ST/T Change |
| CD | Conduction Disturbance |
| HYP | Hypertrophy |
import torch
import numpy as np
from mamba_ssm import Mamba
# Load model (you'll need to save/load weights separately)
model = ECGMambaClassifier(n_classes=5)
model.load_state_dict(torch.load('model_weights.pth'))
model.eval()
# Prepare your ECG data
# ecg_signal: numpy array of shape (1000, 12)
ecg_tensor = torch.tensor(ecg_signal, dtype=torch.float32).unsqueeze(0)
# Inference
with torch.no_grad():
logits = model(ecg_tensor)
predicted_class = torch.argmax(logits, dim=1)
None applied in this implementation.
@software{ecg_mamba_2024,
title={ECG-Mamba: Cardiac Abnormality Classification using Mamba Architecture},
year={2024},
url={https://huggingface.co/your-username/ecg-mamba}
}
@article{wagner2020ptbxl,
title={PTB-XL, a large publicly available electrocardiography dataset},
author={Wagner, Patrick and Strodthoff, Nils and Bousseljot, Ralf-Dieter and Kreiseler, Dieter and Lunze, Fatima I and Samek, Wojciech and Schaeffter, Tobias},
journal={Scientific Data},
volume={7},
number={1},
pages={154},
year={2020}
}
@article{gu2023mamba,
title={Mamba: Linear-Time Sequence Modeling with Selective State Spaces},
author={Gu, Albert and Dao, Tri},
journal={arXiv preprint arXiv:2312.00752},
year={2023}
}
This model card was created as part of the ECG-Mamba project.
For questions or issues, please open an issue on the GitHub repository.