This project focuses on multi-class arrhythmia classification using the CPSC 2018 12-lead ECG dataset. It supports training and evaluation on both 12-lead signals and single-lead signals, with configurable model architectures and MLflow-based experiment tracking.
βββ config.py # Configuration file for paths and settings
βββ cpsc_data_prep_csv.py # Script to prepare CSVs from raw data
βββ data_processing
β βββ cpsc_signal_loader.py # Signal loading and preprocessing
β βββ data_generator.py # Data generator for model input
β βββ data_loading.py # Load and preprocess dataset
β βββ data_reduction.py # Dataset size reduction scripts
β βββ data_splitter.py # Train/Val/test splitting utilities
βββ models
β βββ checkpoints # Model checkpoints (saved weights)
β βββ final # Final trained models
β βββ misclassified_samples # Incorrect predictions for analysis
β βββ model
β β βββ cnn1d_resent_18.py # resnet model
β β βββ cnn_attentaion_bilstm_improve.py # cnn_attentaion_bilstm_model
β βββ model_paths # Model path utilities
β βββ model_plots # Training and evaluation plots
β βββ model_results # Evaluation results (metrics)
β βββ Spectrograms # Spectrogram representations of signals
βββ README.md # Project documentation
βββ requirements.txt # Python package dependencies
βββ test_cpsc.py # Testing script
βββ train_custom_log_cpsc.py # Training script with MLflow logging
βββ utils
β βββ model_selector.py # Model selection utilities
β βββ utils.py # Utility functions and global configs and input sizes paths
β βββ visualization.py # Visulization utility
βββ visualize_signal.py # ECG signal visulization script
CPSC dataset is opensource dataset avaliable here
- Colne the repository:
clone repo- Install dependencies:
pip install -r requirements.txt3.Download the datasets:
- place the datasets as per your convinent give the correspoding path in the config file and utils file
- To train a model
python3 train_custom_log_cpsc.py-
config.py: Contains model selection, MLflow enable/disable settings, number of epochs, and all other required configuration parameters.
-
utils.py: Contains file paths, input sizes, and other utility constants needed across the project.
- Models will be saved in models/checkpoints/.
- Training history will be saved in mlflow server
- To test a model
python3 test_cpsc.py- training logs ,tesing logs, model performace metrics and model are saving in mflow server
- To Visualization
python visualize_signal.py --file_path data/test_data.pkl --plot_signal --sampling_rate 250- provide reqiured args for visulization of the signal