FEW-SHOT ELECTROCARDIOGRAM (ECG) SIGNAL CLASSIFICATION METHOD BASED ON IMPROVED SIAMESE NETWORK

A few-shot electrocardiogram (ECG) signal classification method based on an improved Siamese network is provided. The method constructs a CMP module as a sub-network of a Siamese network, and combines extracted local and global features to better analyze peak information such as position, amplitude, and offset, making a transformed feature vector more robust. In this way, the method improves the accuracy and stability of few-shot ECG signal classification.

CROSS-REFERENCE TO THE RELATED APPLICATIONS

This application is based upon and claims priority to Chinese Patent Application No. 202311498055.5, filed on Nov. 13, 2023, the entire contents of which are incorporated herein by reference.

TECHNICAL FIELD

The present disclosure relates to the technical field of electrocardiogram (ECG) signal classification, and in particular to a few-shot ECG signal classification method based on an improved Siamese network.

BACKGROUND

In recent years, deep learning (DL)-based algorithm models have achieved unprecedented success in big data (BD) processing in the field of artificial intelligence (AI). However, due to the rarity and large individual differences of certain types of arrhythmias the acquired data is limited, which limits the generalization ability and accuracy of existing models. Few-shot learning is mainly used for neural network classifiers, which only requires a small number of samples for learning and training, and can achieve efficient recognition and classification of electrocardiogram (ECG) signals.

SUMMARY

In order to overcome the above-mentioned shortcomings in the prior art, the present disclosure provides a few-shot electrocardiogram (ECG) signal classification method based on an improved Siamese network, which can improve the classification accuracy.

In order to solve the technical problem, the present disclosure adopts the following technical solution.

The few-shot ECG signal classification method based on an improved Siamese network includes the following steps:

yi−1 denotes a class label corresponding to the (i−1)-th original ECG signal xi−1; and there are M sample pairs in the sample pair set P,

Further, the step a) includes: acquiring the n original ECG signals from a University of California Riverside (UCR) dataset.

Further, the step b) includes: denoising, by a first median filter and a second median filter in sequence, the i-th original ECG signal xi to acquire the i-th clean ECG signal x′i.

Preferably, the first median filter has a width of 300 ms, and the second median filter has a width of 600 ms.

Preferably, in the step e-2), the convolutional layer of the first CMP module includes a 3×3 convolution kernel, and the convolutional layer of the second CMP module includes a 3×3 convolution kernel.

Further, the step f) includes: calculating the loss function

m denotes a hyperparameter, α denotes a hyperparameter; and L2 denotes a cross entropy loss function.

The present disclosure has the following beneficial effects. The present disclosure constructs the CMP module as a sub-network of the Siamese network, and combines the extracted local and global features to better analyze peak information such as position, amplitude, and offset, making the transformed feature vector more robust. In this way, the present disclosure improves the accuracy and stability of few-shot ECG signal classification.

Table 1 Average accuracy comparison results of models in the present disclosure

Table 2 Average precision, average recall, and average F1 score comparison results of different models in the present disclosure

DETAILED DESCRIPTION OF THE EMBODIMENTS

The present disclosure is further described with reference to FIG. 1 and FIG. 2.

The few-shot ECG signal classification method based on an improved Siamese network includes the following steps:

yi−1 denotes a class label corresponding to the (i−1)-th original ECG signal x1-1; and there are M sample pairs in the sample pair set P,

The present disclosure provides a brand new CMP module to establish the Siamese network for few-shot ECG signal classification, which improves classification accuracy.

In an embodiment of the present disclosure, in the step a), the n original ECG signals are acquired from a University of California Riverside (UCR) dataset.

In an embodiment of the present disclosure, in the step b), the i-th original ECG signal xi is denoised by a first median filter and a second median filter in sequence to acquire the i-th clean ECG signal x′i. In the embodiment, preferably, the first median filter has a width of 300 ms, and the second median filter has a width of 600 ms.

In an embodiment of the present disclosure, Lmax=187.

In an embodiment of the present application, the step e) is as follows.

In the embodiment, in the step e-2), the convolutional layer of the first CMP module includes a 3×3 convolution kernel, and the convolutional layer of the second CMP module includes a 3×3 convolution kernel.

In the step f), the loss function L is calculated by L=L1+αL2, where L1 is designed to adjust the loss function of the Siamese network.

where m denotes a hyperparameter; α denotes a hyperparameter; and L2 denotes a cross entropy loss function. Further, α=5, m=5. The total loss L takes into account both sample distance and feature classification.

The step j) is as follows.

Taking the publicly available MIT-BIH dataset as an example, the implementation of the present disclosure is explained in detail below.

The model proposed by the present disclosure is compared with mainstream classification task models (ED, dynamic time warping (DTW), long short-term memory-fully connected network (LSTM-FCN)) and a Siamese convolutional neural network (SCNN) model, and the final accuracy is the average of 20 tasks. Accuracy, precision, recall, and F1 score are used as evaluation indicators.

The training is performed based on UCR ECG200 and ECG5000 datasets, the validation is performed based on UCR TwoLeadECG and ECGFiveDays datasets, and the model testing is performed based on the MIT-BIH dataset. FIG. 3 shows a comparison of the relationship between the average accuracy and K for different models. It can be seen from the figure that as K increases, ED almost monotonically increases, and the precision, recall, and F1 score also increase. DTW does not follow such a smooth behavior and offers poorer performance than ED at a smaller K value. However, DTW outperforms ED at a value close to 50 and may perform better at a larger value. Unlike ED and DTW, FCN-LSTM exhibits an extremely irregular behavior during training, with a significant fluctuation in accuracy in certain areas, which can be attributed to the randomness of neural network optimization and the lack of labeled data for training. The comparison between the model of the present disclosure and the SCNN model shows that the accuracy does not increase sharply from K=1 to K=50, but tends to stabilize around 0.93, and the recall, precision, and F1 score also tend to stabilize around 0.93.

FIGS. 4A-4B show a confusion matrix of the CMP model in 3-way 10-shot on the MIT-BIH dataset. It can be seen from the figure that the model of the present disclosure has better comprehensive performance and lower misdiagnosis rate during the evaluation process. FIGS. 5A-5F show changes in true and predict labels of 6 randomly selected signals during 3-way 10-shot (N, S and V are represented by 0, 1 and 2, respectively). Table 1 shows comparison results of accuracy acquired by different models under different K values on the MIT-BIH dataset, while Table 2 shows comparison results of average precision, average recall, and average F1 score of different models on the MIT-BIH dataset. In summary, from the perspective of model performance, the model of the present disclosure can effectively distinguish between acceptable and unacceptable ECG signals in practical environments.

Finally, it should be noted that the above descriptions are only preferred embodiments of the present disclosure, and are not intended to limit the present disclosure. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art may still modify the technical solutions described in the foregoing embodiments, or equivalently substitute some technical features thereof. Any modification, equivalent substitution, improvement, etc. within the spirit and principles of the present disclosure shall fall within the scope of protection of the present disclosure.