ecg-robustness-eval
ECG-ATK-GAN: Robustness against Adversarial Attacks on ECGs using Conditional Generative Adversarial Networks — Hossain et al. (2021) (arXiv:2110.09983, 2021)
What this evaluates
Evaluates the robustness of ECG classification models against six adversarial attack types (FGSM, BIM, PGD, CW, DBB, HSJ) compared to clean data. It measures classification performance and signal generation quality on two public ECG datasets.
Datasets
- PhysioNet MIT-BIH Arrhythmia — total ?; splits: train (-1), test (-1)
- PTB Diagnostic ECG Database — total ?; splits: train (-1), test (-1)
Metrics
Accuracy (primary) — range: [0, 1]
- Proportion of correctly classified instances (clean or attacked) out of the total test set instances.
Sensitivity — range: [0, 1]
- True positive rate: proportion of actual positive instances correctly identified.
Specificity — range: [0, 1]
- True negative rate: proportion of actual negative instances correctly identified.
Structural Similarity (SSIM) — range: [0, 1]
- Perceptual similarity metric between generated and real ECG signals, ranging from 0 to 1.
Mean-Squared-Error (MSE) — range: other
- Average squared difference between generated and real signal amplitudes.
Normalized Mean Squared Error (NRMSE) — range: [0, 1]
- MSE normalized by the range or mean of the signal to provide scale-invariant error measurement.
Cross-correlation Coefficient — range: other
- Measures linear correlation between generated and real signals across time lags.
Input / output format
Input: ECG signal segments centered on R-peaks, sampled at 280 Hz, normalized to [0,1]. Inputs include both clean beats and adversarially perturbed versions (FGSM, BIM, PGD, CW, DBB, HSJ).
Output: Predicted class labels (N, S, V, F for MIT-BIH; Normal, Myocardial Infarction for PTB) and attack type classification (clean vs. specific attack).
Scoring recipe
def compute_metrics(preds, labels):
tp = sum(1 for p, l in zip(preds, labels) if p == l and l == 1)
tn = sum(1 for p, l in zip(preds, labels) if p == l and l == 0)
fp = sum(1 for p, l in zip(preds, labels) if p == 1 and l == 0)
fn = sum(1 for p, l in zip(preds, labels) if p == 0 and l == 1)
accuracy = (tp + tn) / (tp + tn + fp + fn)
sensitivity = tp / (tp + fn) if (tp + fn) > 0 else 0
specificity = tn / (tn + fp) if (tn + fp) > 0 else 0
return accuracy, sensitivity, specificity
Common pitfalls
- SMOTE oversampling is applied only to the training set, not the test set, meaning test performance reflects the original imbalanced distribution.
- HSJ attacks introduce high-frequency noise that obscures signal patterns, causing disproportionate performance drops across all models and potentially skewing average robustness scores.
- Models are trained on a combined dataset of clean and attacked signals, but evaluated separately on clean vs. attacked test splits, requiring strict separation to avoid data leakage.
Evidence (verbatim from paper)
For metrics, we use Accuracy, Sensitivity, and Specificity. We can see that for ‘No Attack’, all models achieve comparatively good results. However, for each distinct attack, the results worsen for other models compared to ours.
Citation
@misc{hossain2021ecgatk,
title={ECG-ATK-GAN: Robustness against Adversarial Attacks on ECGs using Conditional Generative Adversarial Networks},
author={Hossain et al. (2021)},
year={2021},
note={arXiv:2110.09983}
}
1---2name: ecg-robustness-eval3description: Evaluates the robustness of ECG classification models against six adversarial attack types (FGSM, BIM, PGD, CW, DBB, HSJ) compared to clean data. It measures classification performance and signal generation quality on two public ECG datasets. Use when the user wants to benchmark on PhysioNet MIT-BIH Arrhythmia, PTB Diagnostic ECG Database, or asks about evaluating this task. Reports Accuracy.4---56# ecg-robustness-eval78> ECG-ATK-GAN: Robustness against Adversarial Attacks on ECGs using Conditional Generative Adversarial Networks — Hossain et al. (2021) (arXiv:2110.09983, 2021)910## What this evaluates1112Evaluates the robustness of ECG classification models against six adversarial attack types (FGSM, BIM, PGD, CW, DBB, HSJ) compared to clean data. It measures classification performance and signal generation quality on two public ECG datasets.1314## Datasets1516- **PhysioNet MIT-BIH Arrhythmia** — total ?; splits: train (-1), test (-1)17- **PTB Diagnostic ECG Database** — total ?; splits: train (-1), test (-1)1819## Metrics2021- `Accuracy` **(primary)** — range: [0, 1]22 - Proportion of correctly classified instances (clean or attacked) out of the total test set instances.23- `Sensitivity` — range: [0, 1]24 - True positive rate: proportion of actual positive instances correctly identified.25- `Specificity` — range: [0, 1]26 - True negative rate: proportion of actual negative instances correctly identified.27- `Structural Similarity (SSIM)` — range: [0, 1]28 - Perceptual similarity metric between generated and real ECG signals, ranging from 0 to 1.29- `Mean-Squared-Error (MSE)` — range: other30 - Average squared difference between generated and real signal amplitudes.31- `Normalized Mean Squared Error (NRMSE)` — range: [0, 1]32 - MSE normalized by the range or mean of the signal to provide scale-invariant error measurement.33- `Cross-correlation Coefficient` — range: other34 - Measures linear correlation between generated and real signals across time lags.3536## Input / output format3738**Input**: ECG signal segments centered on R-peaks, sampled at 280 Hz, normalized to [0,1]. Inputs include both clean beats and adversarially perturbed versions (FGSM, BIM, PGD, CW, DBB, HSJ).3940**Output**: Predicted class labels (N, S, V, F for MIT-BIH; Normal, Myocardial Infarction for PTB) and attack type classification (clean vs. specific attack).4142## Scoring recipe4344```python45def compute_metrics(preds, labels):46 tp = sum(1 for p, l in zip(preds, labels) if p == l and l == 1)47 tn = sum(1 for p, l in zip(preds, labels) if p == l and l == 0)48 fp = sum(1 for p, l in zip(preds, labels) if p == 1 and l == 0)49 fn = sum(1 for p, l in zip(preds, labels) if p == 0 and l == 1)50 accuracy = (tp + tn) / (tp + tn + fp + fn)51 sensitivity = tp / (tp + fn) if (tp + fn) > 0 else 052 specificity = tn / (tn + fp) if (tn + fp) > 0 else 053 return accuracy, sensitivity, specificity54```5556## Common pitfalls5758- SMOTE oversampling is applied only to the training set, not the test set, meaning test performance reflects the original imbalanced distribution.59- HSJ attacks introduce high-frequency noise that obscures signal patterns, causing disproportionate performance drops across all models and potentially skewing average robustness scores.60- Models are trained on a combined dataset of clean and attacked signals, but evaluated separately on clean vs. attacked test splits, requiring strict separation to avoid data leakage.6162## Evidence (verbatim from paper)6364> For metrics, we use Accuracy, Sensitivity, and Specificity. We can see that for ‘No Attack’, all models achieve comparatively good results. However, for each distinct attack, the results worsen for other models compared to ours.6566## Citation6768```bibtex69@misc{hossain2021ecgatk,70 title={ECG-ATK-GAN: Robustness against Adversarial Attacks on ECGs using Conditional Generative Adversarial Networks},71 author={Hossain et al. (2021)},72 year={2021},73 note={arXiv:2110.09983}74}75```7677- arXiv: 2110.09983