Skip to main content
Back to Blog
Detecting Atrial Fibrillation from ECG Signals with 1D CNNs

Detecting Atrial Fibrillation from ECG Signals with 1D CNNs

By ·
Machine Learning
Healthcare
Python

Atrial fibrillation (AF) is a common arrhythmia that increases stroke risk if undetected. In this project I worked with ECG segments from the MIT-BIH dataset to classify AF patterns.

Pipeline overview

  1. Extract and preprocess ECG waveforms
  2. Engineer time-domain and frequency features for classical models
  3. Train a 1D CNN on raw or minimally processed segments
  4. Compare precision/recall across approaches

Classical vs deep learning

Random Forest and SVM baselines with hand-crafted features remain strong when data is limited and interpretability matters. 1D CNNs can learn temporal motifs directly but need careful regularization to avoid overfitting on small medical datasets.

Lessons

  • Signal quality and segment alignment dominate model choice
  • Class imbalance requires weighted loss or resampling
  • Clinical deployment would need rigorous external validation, not just test-set metrics