ECG Signal Classification Using Deep Learning
This example shows how to develop and verify a deep learning model that classifies electrocardiogram (ECG) signals to detect atrial fibrillation (AFib). The example guides you through a complete workflow for building an AI system, with a focus on robustness, explainability, and verification against defined requirements.
ECGs record the electrical activity of the heart over time. Physicians use ECGs to visually assess if a patient's heartbeat is normal or irregular. Atrial fibrillation is a common type of arrhythmia in which the upper chambers of the heart (atria) beat out of coordination with the lower chambers (ventricles).
With the increasing use of wearable devices and remote monitoring, there is a growing need for automated ECG analysis tools that are not only accurate, but also robust and interpretable. This example demonstrates how to build such a system using deep learning and AI verification techniques.
The workflow is organized into several live scripts. You can run the scripts in order or run each one independently.

Define Requirements for ECG Signal Classification Using Deep Learning — Create clear, testable requirements for the model, including performance, robustness, and explainability.
Prepare Data for ECG Signal Classification — Load, preprocess, and visualize ECG data and prepare it for training a deep learning model.
Train Deep Learning Network for ECG Signal Classification — Design and train a convolutional neural network (CNN) to classify ECG signals as normal or abnormal.
Improve Adversarial Robustness of Deep Learning Network for ECG Signal Classification — Improve the robustness of the model to small input perturbations using adversarial training techniques.
Test Deep Learning Network for ECG Signal Classification — Evaluate the performance of the model and validate it against the defined requirements.
Out-of-Distribution Detection for ECG Signal Classification — Use out-of-distribution detection to identify inputs that differ significantly from the training distribution.
Uncertainty Quantification for ECG Signal Classification — Build prediction intervals, using split conformal prediction, to support risk-aware decision making.
Investigate ECG Signal Classifications Using Grad-CAM — Use Grad-CAM to visualize which parts of the ECG signal influence the predictions made by the model.
Build Deep Learning ECG Signal Classification App Using App Designer— Create an interactive app using App Designer and then package it for deployment or demonstration.