This repository contains the implementation for the paper "Learning Generic Dissimilarity Representations with Large ECG Model for CVDs Detection". The code includes pretraining scripts for tokenizers and a complete self-supervised learning process using the Mamba2 model. The generated representations can be evaluated on various downstream tasks for cardiovascular disease (CVD) detection.
Before proceeding, create a Python virtual environment to manage dependencies:
python -m venv venv
source venv/bin/activate # On Windows use venv\Scripts\activateInstall the required dependencies listed in the requirements.txt file:
pip install -r requirements.txtAll datasets should be pre-converted into HDF5 format. The organization of the data is as follows:
- Training Data: Store in the
Datasetsfolder. - Validation Data: Store in the
Validationfolder. - Log Files: Store in the
Logsfolder. - Parameter Files: Store in the
Parametersfolder.
Each dataset should be placed in a separate subfolder within the respective folders. All HDF5 files belonging to a specific dataset should be placed at the same level within its respective subfolder.
The pretraining phase consists of three scripts:
-
pretrainCrossTokenMulty.py: This script pretrains theAssocTokenizerto prevent gradient explosion during the self-supervised learning phase. -
pretrainDeviatTokenMulty.py: This script pretrains theDeviaTokenizerfor the same purpose. -
pretrainECGLMMulty.py: This script performs the complete self-supervised learning using theMamba2model.
After the pretraining and self-supervised learning phases, the generated files can be evaluated using the scripts in the ValExps folder. These scripts test the performance of the learned representations on various downstream classifiers for CVD detection.
If you find this repository useful in your research, please consider citing our paper:
@article{Haibo2024learning, title={Learning Generic Dissimilarity Representations with Large ECG Model for CVDs Detection}, author={Haibo Zheng}, journal={Journal Name}, year={2024}, }