1. Introduction
Arrhythmias are a significant group of cardiovascular diseases that can cause sudden cardiac death and pose a major threat to human health [
1]. The electrocardiogram (ECG) is a diagnostic tool used to non-invasively record the heart’s electrical signals. A physician typically studies and analyzes the ECG to identify the type of disease in which it was collected [
2]. However, the diagnosis requires subjective judgement by doctors with extensive clinical experience, which not only consumes a large amount of healthcare resources but also does not guarantee reliability. Therefore, researchers have begun to explore the application of efficient and accurate deep neural networks (DNNs) in the field of ECG disease diagnosis and have achieved remarkable results. Oh et al. [
3] proposed a novel automated system, which achieved a 98.10% accuracy in five MIT-BIH categories. Wang et al. [
4] proposed an arrhythmia classification algorithm based on the multi-head self-attention mechanism (ACA-MA) and achieved a 99.4% accuracy in five categories of the MIT-BIH dataset. Kim et al. [
5] adopted a residual network with a squeeze-and-excitation (SE) block and a bidirectional long short-term memory (BIL-LSTM) for arrhythmia classification and used the synthetic minority oversampling technique (SMOTE) to solve the data imbalance, and gained a 99.20%, 99.35%, and 97.05% accuracy in MITDB, AFDB, and Cinc DB, respectively. Kumar et al. [
6] built a method to extract ECG features using continuous wavelet changes and used a model with SENet and lightweight context transform (LCT) for arrhythmia classification. Zeng et al. [
7] proposed Fuzz-ClustNet, which use fuzzy clustering and deep learning for ECG signals detecting arrhythmia, and achieved a 98.66% and 95.79 accuracy in the MIT-BIH and PTB dataset. Recent studies have highlighted the severe threat posed by adversarial attacks to the security of DNNs, substantiated across various domains [
8,
9]. Adversarial examples introduce minor perturbations to the natural ECG signals, which can cause DNNs to produce erroneous results in medical diagnoses. This can potentially lead to significant medical accidents. The authors in [
10] demonstrated the deceptive nature of the electrocardiogram and introduced a novel ‘cross-subject attack’. This method uses captured victim electrocardiogram short templates to map an attacker’s electrocardiogram onto the victim’s, enabling cross-device attacks with an exceptional efficacy. Chen et al. [
11] conducted a study on adversarial attacks on DNN-based ECG classification systems. They proposed two attack methods based on ECG signal characteristics and introduced a smoothness metric to quantify human-perceived distances in ECG signals. In [
12], generative adversarial networks were used to create fake ECG signals using victim ECG templates. Han et al. [
13] proposed the Smooth Adversarial Perturbation (SAP) method, a technique specifically designed to attack ECG signal classifiers. This method applies Gaussian kernel convolution to smooth adversarial perturbations, reducing the occurrence of physiologically implausible square-wave artefacts that may arise.
The adversarial attack algorithms applied in the field of image recognition can similarly be utilized to target ECG signals. The Fast Gradient Sign Method (FGSM)
, proposed by Goodfellow et al. [
14], generates adversarial examples based on the model gradient and single-step optimization, representing a classic adversarial attack technique. Building upon the FGSM, Madry et al. [
15] proposed the Projected Gradient Descent (PGD) adversarial attack algorithm. This method involves multiple iterations; a random perturbation not exceeding the specified perturbation range is superimposed on the natural example, and this is used as the initial adversarial examples for multiple iterations. The definition of PGD is provided in Equation (1):
where
is the natural example and
is the natural example label,
denotes the initial adversarial examples and
is the new adversarial examples,
is the maximum adversarial perturbation,
is the step size of each iteration,
calculates the predicted loss of the neural network, and
limits the size of the perturbation to the inside of the circle centred on the data
, with
as the threshold. PGD can generate the strongest adversarial examples within the approximate sample space and stands as one of the widely used adversarial attack methods. Carlini et al. [
16] proposed the C&W adversarial attack algorithm, treating adversarial examples as optimizable variables. They designed a loss function to transform the generation process of adversarial examples into a solvable optimization problem. Currently, C&W is regarded as one of the most effective white-box attack algorithms based on gradient optimization.
In order to safeguard DNNs from malicious attacks using adversarial examples on ECG signals, researchers have conducted in-depth investigations. Wiedeman et al. [
17] introduced a novel ensemble method based on feature decorrelation and Fourier partitioning to enhance network features and reduce the impact of adversarial attacks. This approach aims to fortify the network against adversarial perturbations. Jeong et al. [
18] proposed Defensive Adversarial Training, which involves training the model using diversified noise data to enhance the robustness of the recognition algorithm. The results demonstrate the significant effectiveness of this method in resisting noise injection and random noise compared to traditional noise removal solutions. To enhance the robustness of ECG signal classification models against adversarial noise, Ma et al. [
19] introduced a regularization method based on the Noise-to-Signal Ratio (NSR). The approach aims to improve the robustness of DNNs against adversarial perturbations. Shao et al. [
20] proposed a defense method based on adversarial distillation training, demonstrating its efficacy in enhancing the generalization performance of DNNs against adversarial attacks in ECG classification. The above literature does not explore the effect of the model structure on the robustness of ECG signal classification. However, recent research highlights the critical roles played by the feature extraction module and classifier in adversarial robustness [
21,
22,
23]. In response, this research focuses on elucidating the influence of the model structure on the adversarial robustness of ECG signals. Our efforts are directed towards enhancing the model architecture, particularly the channel activation in the feature extraction stage and the design of the classifier, to improve the model’s robustness against adversarial examples in ECG signals. During the feature extraction phase, adversarial perturbations accumulate distortions in the channel activation magnitude, leading to a signal enhancement effect that renders the model prone to misclassification under adversarial attacks. Moreover, for natural examples of the same category, robust channels in the model generate more universally applicable patterns, whereas adversarial examples frequently activate non-robust channels, resulting in incorrect model outputs and diminishing network robustness [
24]. In the feature extraction stage, the primary distinctions in features between adversarial and natural examples originate from variations in the channel activation magnitude and frequencies induced by adversarial perturbations, thus influencing the model’s performance in adversarial robustness. During the classification stage, adversarial attacks on the feature extraction phase induce variations in feature vectors, consequently leading to misclassifications by the classifier. Lipschitz continuity imposes a constant constraint on the range of variations between the input adversarial perturbation and the output of the model, with the minimum non-negative constant satisfying this property referred to as the Lipschitz constant for the classifier [
25]. By designing a classifier with a Lipschitz constant constraint, the classification accuracy of adversarial examples can be effectively improved, particularly those with significant differences from the feature vectors of natural examples. This constraint plays a positive role in reinforcing the model’s stability and adversarial robustness.
The main contributions of this study are summarized as follows:
We proposed a novel robust model Channel Activation Suppression with Lipschitz Constraints Net (CASLCNet). In the feature extraction stage, CASLCNet employs the Channel-wise Activation Suppressing (CAS) strategy with an auxiliary classifier for the adaptive learning of the channel importance. This strategy dynamically adjusts channels to suppress non-robust channels. In the classification stage, CASLCNet utilizes a ℓ∞ distance network with the Lipschitz continuity as the classifier, effectively resisting small perturbations generated by adversarial attacks.
We employed Misclassification Aware Adversarial Training (MART), which can further improve the adversarial robustness of CASLCNet for ECG classification.
We validated the model adversarial robustness using multiple adversarial attack methods in the MIT-BIH dataset and the CPSC2018 dataset and compare it with state-of-the-art methods. The experimental results show that the method in this paper can effectively defend against malicious attacks on the model by multiple adversarial attack methods while maintaining a high accuracy, and outperforms the state-of-the-art methods in a variety of metrics.
4. Result and Discussion
4.1. Experimental Setup
The research experiments are conducted on a server equipped with an Intel(R) Xeon(R) Gold 5218 CPU (2.30 GHz) and NVIDIA A100-SXM4 GPU (40 GB memory). The operating system used is Centos 8, with Python version 3.8.3, PyTorch version 1.13.1, and CUDA version 11.6. For the MIT-BIH dataset, the batch size is set to 512, the number of training rounds is 100, the Adamax optimizer is used for training, the initial learning rate is set to 1 × 10
−3, and the ReduceLROnPlateau learning rate scheduler is used to dynamically adjust the learning rate. For CASLCNet training, the PGD attack algorithm is used to generate adversarial examples for adversarial training, the number of attacks is set to 10, the attack range is 0.1, and the attack step size is one-tenth of the attack range. For the CPSC2018 dataset, the batch size during training is set to 64, the initial learning rate is set to 1 × 10
−4, and the model is also trained using MART with the number of attacks set to 10, the attack range to 0.01, and the rest of the settings the same as for the MIT-BIH dataset.
Table 2 shows the detailed structure of the network using CASLCNet for the MIT-BIH and CPSC2018 dataset.
4.2. Channel-Wise Activation Suppression Effect
As examples, we chose the N class and Normal class from the MIT-BIH and CPSC2018 dataset. Our observation focused on the channel activation frequency and magnitude at the final layer of the model’s feature extraction. For each channel, if the activation value surpassed a threshold (20% of the maximum activation value across all 512 channels in MIT-BIH, and 70% of the maximum activation value in CPSC2018), the channel is identified as an activated channel. Subsequently, we calculated the activation frequency on each channel for both the natural examples and adversarial examples, sorting them in descending order of the natural example’s activation frequency. In the experiments, CASLCNet is trained using MART and ResNet18 is trained using the cross-entropy loss function as the contrast model.
Figure 4 and
Figure 5 illustrates the channel-wise activation frequency and magnitude of ResNet18 and CASLCNet on the test sets of both datasets. From the subfigures a, it is evident that the channel-wise activation magnitude of the adversarial examples is significantly higher than that of the natural examples. This indicates that adversarial perturbations progressively accumulate from the model’s input layer to the output layer. By looking at the subfigures c, we notice that adversarial examples activate the model channels more uniformly, frequently activating non-robust channels seldom activated by the natural examples. This has a severe impact on the model’s robustness. Subfigures b depict the activation magnitude of CASLCNet when faced with adversarial examples. It is apparent that our proposed method effectively suppresses the activation magnitude of adversarial examples, reducing the magnitude gap between adversarial and natural examples. Subfigures d represent the channel-wise activation frequency of adversarial examples. Our proposed method effectively suppresses the channel activation frequency, aligning the activation frequencies of natural examples and adversarial examples and reducing the activation on non-robust channels by adversarial examples. Consequently, this mitigates the impact of adversarial sample attacks on the network, enhancing overall robustness.
4.3. Hyperparameter Selection Experiment
In the training of the CASLCNet network, adjustments to the
parameter of the CAS loss are made to achieve optimal training outcomes. To assess the sensitivity of the CAS strategy under different
values, MART is conducted on the MIT-BIH and CPSC2018 datasets for
values of
, where
represents standard adversarial training.
Table 3 presents the corresponding
and
scores for each
value. The results indicate that the model achieves optimal performance across metrics when
is set to 2, striking a balance between the accuracy rate and robustness.
Figure 6 shows the loss function curves as well as the accuracy curves of CASLCNet in the MIT-BIH dataset and the CPSC2018 dataset when the hyperparameter
is 2.
4.4. Adversarial Robustness Verification
To assess the effectiveness of CASLCNet in defending against various malicious attacks, we conducted validation using different adversarial attack methods on the test sets of the MIT-BIH and CPSC2018 datasets. The adversarial attack methods employed included white noise, FGSM, C&W, PGD, and SAP. White noise and FGSM attacks utilized a single iteration, while MI-FGSM and C&W used 100 iterations. White noise and FGSM and MI-FGSM perturbation ranges are set to 0.1 and 0.01 in the MIT-BIH and CPSC2018 datasets, respectively, with an MI-FGSM step range of 0.01 and 0.001. When using PGD and SAP adversarial attacks, the settings are as shown in 2.2.
Table 4 provides the detailed accuracy and F1 scores under the white noise, FGSM, MI-FGSM, and C&W attack methods.
Table 5 and
Table 6 show the accuracy and F1 scores of CASLCNet when the MIT-BIH dataset and the CPSC2018 dataset are attacked by different PGD and SAP adversarial attack, respectively. Notably, the model’s accuracy and F1 scores showed minimal degradation when faced with white noise, FGSM, MI-FGSM, C&W, and SAP attacks. Even under PGD adversarial attacks, the model maintained a high level of accuracy, demonstrating the model’s ability to effectively withstand various adversarial attacks while preserving a high accuracy.
4.5. Ablation Experiment
To assess the effectiveness of each module in enhancing the adversarial robustness of the CASLCNet network, we conducted ablation experiments on both the MIT-BIH and CPSC2018 datasets. Method 1 employed ResNet18 as the baseline model, while Method 2 replaced the last feature extraction layers of Method 1 with residual modules incorporating the channel-wise activation suppression strategy. Method 3 replaced the fully connected layer of Method 1 with an
ℓ∞ distance network serving as the classifier. Method 4 represents our proposed CASLCNet. All methods utilized MART.
Table 7 shows the
and
scores under the test set of MIT-BIH and CPSC2018 datasets, where × means that the method model does not contain the module, and √ means that the model contains the module, and it can be observed that Method 4 achieves the best values in all the metrics; it shows that both modules added in this paper are effective in improving the model adversarial robustness.
4.6. Contrast Experiment
In this study, CASLCNet is trained using various methodologies, including standard adversarial training [
15], TRADES adversarial training [
33], and MART. The experimental results are presented in
Table 8.
Table 8 demonstrates that Misclassification-Aware Adversarial Training consistently achieves optimal values across metrics. To verify the effectiveness of the CASLCNet model, three classical networks, VGG19 [
34], ResNet18 and DenseNet [
35], are used in this paper and the proposed CASLCNet is trained with different loss functions, respectively, and the experimental results are shown in
Table 9 and
Table 10, respectively.
Table 9 shows the detailed results of the
and
scores of each method in the MIT-BIH dataset, and
Table 10 shows the detailed results of the
and
scores of each method in the CPSC2018 dataset.
Table 10 shows that the
and
scores of CASLCNet are higher when the model is attacked by adversarial examples when trained with the cross-entropy loss function, compared to the
and
scores of VGG19, ResNet18, and DenseNet trained with MART, which effectively shows that the CASLCNet network proposed in this paper has strong adversarial robustness without adversarial training. The
and
scores of CASLCNet under PGD adversarial attack can be improved by more than 40% compared to other methods when CASLCNet is trained using MART in the CPSC2018 dataset.
Table 9 and
Table 10 show that the proposed method can achieve the best performance in each index, and can effectively improve the
and
scores compared with the other networks, which indicates that CASLCNet can achieve the advantage in the accuracy of the natural examples, as well as the robustness. This observation substantiates the effectiveness of CASLCNet in significantly enhancing the model’s adversarial robustness.
4.7. Comparison with Existing Literature
Recent studies have indicated that SNR regularization enhances network robustness by suppressing the Signal-to-Noise Ratio (SNR) of adversarial noise signals, while Jacobian regularization mitigates the impact of adversarial noise perturbations by penalizing large gradients relative to the output. These regularization methods represent advanced approaches for defending against adversarial attacks on electrocardiographic signals.
Figure 7 and
Figure 8 show the histograms of the accuracy and F1 scores of the proposed method with the two methods, Jacob, as well as SNR, under different PGD and SAP adversarial attacks.
Table 11 shows the detailed data of the comparison between the proposed method and the existing literature, from which it can be seen that the proposed method in this paper achieves the optimal results in terms of
and
scores. In the CPSC2018 dataset, when attacked by PGD, the
and
scores of this paper’s method are more than 30% higher than other methods. In the MIT-BIH dataset, this paper’s method is also reaching the best index. The above experiments fully prove that the proposed method in this paper achieves a better balance between identifying natural examples and adversarial examples; not only can it maintain a high accuracy, but it can also effectively resist the attack of adversarial examples, which effectively indicates that the proposed method in this paper is better than the existing methods in the literature and reaches the advanced level.
This study aims to investigate the effectiveness of the proposed CASLCNet in defending against adversarial examples when applied to medical diagnostics using electrocardiographic signals. We conducted experiments focusing on Channel-wise Activation Suppression, hyperparameter selection, robustness validation, and comparisons with existing literature.
In our observations, CASLCNet demonstrated significant advantages when confronted with various adversarial attack methods on the test sets of the MIT-BIH and CPSC2018 datasets. Under white noise, FGSM, MI-FGSM, C&W, PGD, and SAP attacks, CASLCNet maintained a high accuracy and F1 scores, showcasing its robust resistance to diverse adversarial attack methods. Furthermore, we conducted an in-depth investigation into the efficacy of the Channel-wise Activation Suppression strategy within CASLCNet. By scrutinizing the channel activation frequencies and magnitude of CASLCNet in the MIT-BIH and CPSC2018 datasets, we observed a significant reduction in the activation magnitude of adversarial examples. This reduction resulted in a diminished Magnitude gap between adversarial and natural examples, indicating a pivotal role played by the Channel-wise Activation Suppression strategy in effectively enhancing the model’s robustness. In terms of model training, we used an adversarial training approach that emphasizes misclassification. This approach involves designing the loss function to address misclassifications of both natural examples and adversarial examples. The results demonstrated that CASLCNet consistently achieved a favorable performance on the MIT-BIH and CPSC2018 datasets. These experiments serve as empirical evidence of the effectiveness of proposed method in enhancing the model’s robustness. Comparisons with the existing literature demonstrated that CASLCNet consistently achieved the best results in terms of and scores, showcasing its significant advantage in adversarial attacks. This establishes CASLCNet as an advanced technology in the field of robustness research.
The proposed method in this paper achieves a significant robustness improvement in the context of arrhythmia classification, which can be applied to the automatic diagnosis of arrhythmia models, and can effectively prevent attackers from causing misdiagnosis leading to medical accidents by formulating specific adversarial examples to deceive the model, which is of great significance for improving the reliability and safety of ECG signal processing systems in practical medical applications. However, there are still some problems that need to be improved in the method of this paper. For multi-lead ECG signals, this paper’s method does not consider the influence of each lead’s signals on the robustness of the model, and there is the problem of the long computation time and large computation volume. In future work, we will investigate other applications in the field of ECG signal classification, such as identity recognition, and consider methods such as introducing a lead attention mechanism to further investigate the effect of each lead on the adversarial robustness of the model, as well as lightening the modules in CASLCNet by optimizing the adversarial training algorithms to reduce the time and computational volume.