← Projects

Five deep-learning architectures for ECG classification

A MIT-BIH comparison of CNN, BiLSTM, CBAM, MAB-Net and CAT-Net with imbalance handling and hyperparameter experiments.

Role
Research and development team member · four-person project
Organization
Kocaeli University
Period
2026
Stack
Python · PyTorch · CNN · BiLSTM · Attention · Transformer
Experimental comparison of ECG models using accuracy, macro F1, weighted F1 and AUC.

Problem

When normal heartbeats dominate a dataset, a model can achieve high accuracy while missing rare classes. Our four-person team compared five PyTorch architectures using macro F1 alongside accuracy to examine when additional model complexity actually helps.

The preprocessed MIT-BIH benchmark provides single-channel, 187-value heartbeat segments labeled N, S, V, F and Q. This is an offline classification study, not a diagnostic system deployed on a wearable device.

Representative single-channel ECG segments from the five MIT-BIH classes
Representative single-channel ECG segments from the five MIT-BIH classes

Architectures and experiments

  • 1D-CNN: Conv1D, BatchNorm, pooling and a dense classifier.
  • CNN-BiLSTM: local CNN features combined with bidirectional sequence modeling.
  • CNN-CBAM-BiLSTM: a hybrid with channel and spatial attention.
  • MAB-Net: depthwise separable convolution, SE attention and BiLSTM.
  • CAT-Net: CNN features, channel attention and a Transformer encoder.

Custom nn.Module and Dataset subclasses implement model behavior and data loading. Attention and convolution blocks are composed into larger networks. Training uses weighted CrossEntropy, dropout, early stopping and checkpoints. One-factor-at-a-time experiments vary individual hyperparameters while holding others fixed.

1D convolutions extract local waveform features before pooling and a five-class dense classifier.
Inside the compact baseline 1D convolutions extract local waveform features before pooling and a five-class dense classifier.

Results

Configuration Test accuracy Macro F1
Tuned 1D-CNN 93.89% 0.7719
Tuned CNN-BiLSTM 93.23% 0.7664
CNN-CBAM-BiLSTM 85.92% 0.6536
MAB-Net baseline 93.70% 0.7906
CAT-Net baseline 94.02% 0.7674

These are team results from the report and saved notebook outputs. MAB-Net leads on macro F1 while CAT-Net leads on accuracy. Tuned CAT-Net falls to 0.7245 macro F1, illustrating that individually promising hyperparameters do not necessarily combine well.

Combining individually selected CAT-Net hyperparameters reduced the final test scores.
Tuning does not always improve the result Combining individually selected CAT-Net hyperparameters reduced the final test scores.

Limitations and findings

Model 3 uses random_split rather than the stratified split in the other notebooks. The comparison should be repeated with identical partitions. Patient-level validation and actual on-device latency/energy measurements are also absent.

The models classify current heartbeat segments rather than forecasting future events. The key finding is that model choice needs accuracy, minority-class performance and parameter count together; additional attention complexity did not consistently improve results in these experiments.