Electrocardiosignal analysis method based on deep learning model and related product

By combining the residual network model with a multi-head attention mechanism and morphological feature verification, the problems of deep learning models in capturing long-distance dependencies and reducing false positives in ECG signal analysis are solved, thereby improving the accuracy and reliability of ECG signal analysis.

CN120708904APending Publication Date: 2025-09-26SHENYANG NEUSOFT INTELLIGENT MEDICAL TECH RES INST
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510836277.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-20
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

When processing complex, unbalanced or noisy multi-lead ECG signals, deep learning-based ECG signal analysis methods have difficulty fully capturing the long-distance dependencies or dynamic feature importance between input data, which limits the model's adaptability and correction capabilities to heterogeneous data distribution, resulting in unsatisfactory detection results.

Method used

A residual network model combined with a multi-head attention mechanism is used to enhance the feature selectivity and context modeling capabilities of different input data. When the inference results are abnormal, the morphological features of the ECG signal are used to verify the inference results to reduce false positive interference.

Benefits of technology

The accuracy and reliability of ECG signal analysis are improved, the false positive rate is reduced, and the analysis effect of ECG signals is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120708904A_ABST
    Figure CN120708904A_ABST
Patent Text Reader

Abstract

The invention discloses an electrocardiosignal analysis method based on a deep learning model and a related product. The electrocardiosignal analysis method comprises the following steps: acquiring an electrocardiosignal to be analyzed; inputting the electrocardiosignal into a trained deep learning model, and obtaining a reasoning result output by the deep learning model; wherein the deep learning model comprises a residual network combined with a multi-head attention mechanism; under the condition that the reasoning result indicates that the electrocardiosignal is abnormal, the reasoning result is verified according to the morphological characteristics of the electrocardiosignal, and an analysis result is obtained. The deep learning model used in the embodiment of the invention is combined with a multi-head attention mechanism on the basis of the residual model, so that the feature selectivity and context modeling capability of the deep learning model for different input data are enhanced, the correction capability of the deep learning model is improved, and the analysis effect of the electrocardiosignal is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of bioelectric signal processing technology, and in particular to an electrocardiogram signal analysis method based on a deep learning model and related products. Background Art

[0002] The electrocardiogram (ECG) is a direct record of the heart's electrical activity, reflecting the heart's rhythm, conduction function, and myocardial status in real time. Therefore, ECGs can be analyzed accordingly.

[0003] In related technologies, there are three main approaches to analyzing ECG signals: morphological analysis-based ECG signal analysis, machine learning-based ECG signal analysis, and deep learning-based ECG signal analysis. Among them, the deep learning-based ECG signal analysis method, when using models to process complex, unbalanced, or noisy multi-lead ECG signals, has difficulty fully capturing long-range dependencies between input data or the importance of dynamic features. This limits the model's adaptability and error correction capabilities for heterogeneous data distributions, leading to unsatisfactory detection results. Summary of the Invention

[0004] Based on the above problems, this application provides an ECG signal analysis method and related products based on a deep learning model to improve the analysis effect of ECG signals.

[0005] The embodiments of this application disclose the following technical solutions:

[0006] In a first aspect, an embodiment of the present application provides an electrocardiogram signal analysis method based on a deep learning model, the method comprising:

[0007] Obtaining the ECG signal to be analyzed;

[0008] Input the ECG signal into a trained deep learning model and obtain the inference results output by the deep learning model; the deep learning model includes a residual network combined with a multi-head attention mechanism;

[0009] When the inference result indicates that the ECG signal is abnormal, the inference result is verified according to the morphological characteristics of the ECG signal to obtain an analysis result of the ECG signal.

[0010] In a possible embodiment, the residual network layer includes a plurality of connected residual blocks, each of which includes a residual path and an identity mapping path;

[0011] The first end of the residual path and the first end of the identity mapping path are connected together and connected to the input end of the residual block, and the second end of the residual path and the second end of the identity mapping path are connected together through a residual connection and connected to the output end of the residual block; wherein, the residual path includes a first convolutional layer, a first normalization layer, a first activation function layer, a second convolutional layer, a second normalization layer, and a second activation function layer connected in sequence, and the identity mapping path includes a pooling layer and a third convolutional layer connected in sequence.

[0012] In one possible embodiment, the training method of the deep learning model is as follows:

[0013] Acquiring a complete sample electrocardiogram signal of the lead at a first sampling frequency;

[0014] filtering the sample ECG signal through a bandpass filter with a preset cutoff frequency; wherein the preset cutoff frequency is obtained based on the frequency of the sample ECG signal, the frequency range of the ST segment in the sample ECG signal, the frequency range of the P wave in the sample ECG signal, the frequency range of the T wave in the sample ECG signal, and the baseline drift frequency of the sample ECG signal;

[0015] Standardized sample ECG signal;

[0016] A deep learning model is trained according to the sample electrocardiogram signal until the model parameters of the deep learning model remain unchanged within a preset number of training cycles; wherein, during the training of the deep learning model, the parameter matrix is ​​updated to satisfy the conditions that the loss function of the i+1th training cycle is less than the loss function of the ith training cycle, the recall rate of the i+1th training cycle is greater than the recall rate of the ith training cycle, and the harmonic mean of the precision and recall rate of the i+1th training cycle is greater than the harmonic mean of the precision and recall rate of the ith training cycle, where i is an integer greater than or equal to 1.

[0017] In a possible embodiment, verifying the inference result according to the morphological characteristics of the ECG signal to obtain the analysis result of the ECG signal includes:

[0018] Determine the R wave peak of the first bipolar limb lead, the R wave peak of the second bipolar limb lead, and the R wave peak of the third bipolar limb lead in the electrocardiogram signal; obtain a heart rate value corresponding to the electrocardiogram signal based on the R wave peak of the first bipolar limb lead, the R wave peak of the second bipolar limb lead, and the R wave peak of the third bipolar limb lead;

[0019] In the case where the heart rate value is greater than the preset heart rate threshold, the result indicates that the electrocardiogram signal is abnormal.

[0020] In a possible embodiment, obtaining a heart rate value corresponding to the electrocardiogram signal according to the R wave peak of the first bipolar limb lead, the R wave peak of the second bipolar limb lead, and the R wave peak of the third bipolar limb lead includes:

[0021] Obtaining the time interval between each two adjacent R wave peaks according to the R wave peak of the first bipolar limb lead, the R wave peak of the second bipolar limb lead, and the R wave peak of the third bipolar limb lead;

[0022] According to each time interval and the number of R-wave peaks, the average time interval between two adjacent R-wave peaks is obtained;

[0023] According to the average time interval and sampling frequency, the heart rate value corresponding to the ECG signal is obtained.

[0024] In one possible embodiment, the inference result includes a probability value of the ECG signal being abnormal. When the probability value is greater than a threshold, the inference result indicates that the ECG signal is abnormal; wherein the threshold is the value in the precision-recall curve that maximizes the harmonic mean of the precision and the recall.

[0025] In a possible embodiment, standardizing a sample ECG signal includes:

[0026] Resampling the sample ECG signal at a second sampling frequency; wherein the second sampling frequency is lower than the first sampling frequency;

[0027] Sample ECG signal after normalization and resampling.

[0028] In a second aspect, an embodiment of the present application provides an electrocardiogram signal analysis system based on a deep learning model, comprising: a first acquisition module, a second acquisition module, and a verification module;

[0029] A first acquisition module is used to acquire the electrocardiogram signal to be analyzed;

[0030] The second acquisition module is used to input the ECG signal into a trained deep learning model and obtain the inference results output by the deep learning model; wherein the deep learning model includes a residual network combined with a multi-head attention mechanism;

[0031] The verification module is used to verify the inference result according to the morphological characteristics of the ECG signal when the inference result indicates that the ECG signal is abnormal, so as to obtain the analysis result of the ECG signal.

[0032] In a possible embodiment, the residual network includes a plurality of residual blocks connected together, the residual block includes a residual path and an identity mapping path; the first end of the residual path and the first end of the identity mapping path are connected together and connected to the input end of the residual block, and the second end of the residual path and the second end of the identity mapping path are connected together through a residual connection and connected to the output end of the residual block; wherein the residual path includes a first convolutional layer, a first normalization layer, a first activation function layer, a second convolutional layer, a second normalization layer and a second activation function layer connected in sequence, and the identity mapping path includes a pooling layer and a third convolutional layer connected in sequence.

[0033] In a possible embodiment, the ECG signal analysis system based on the deep learning model further includes: a model training module;

[0034] The model training module is configured to obtain a complete sample ECG signal of a lead at a first sampling frequency; filter the sample ECG signal through a bandpass filter with a preset cutoff frequency; wherein the preset cutoff frequency is obtained based on the frequency of the sample ECG signal, the frequency range of the ST segment in the sample ECG signal, the frequency range of the P wave in the sample ECG signal, the frequency range of the T wave in the sample ECG signal, and the baseline drift frequency of the sample ECG signal; standardize the sample ECG signal after filtering; train a deep learning model based on the standardized sample ECG signal until the model parameters of the deep learning model remain unchanged within a preset number of training cycles; wherein, during the deep learning model training process, the update of the parameter matrix satisfies the conditions that the loss function of the i+1th training cycle is less than the loss function of the i-th training cycle, the recall rate of the i+1th training cycle is greater than the recall rate of the i-th training cycle, and the harmonic mean of the precision and recall rate of the i+1th training cycle is greater than the harmonic mean of the precision and recall rate of the i-th training cycle, where i is an integer greater than or equal to 1.

[0035] In a possible embodiment, the verification module includes a heart rate value acquisition unit and a verification unit. The heart rate value acquisition unit is used to determine the R wave peak of the first bipolar limb lead, the R wave peak of the second bipolar limb lead, and the R wave peak of the third bipolar limb lead in the electrocardiogram signal; based on the R wave peak of the first bipolar limb lead, the R wave peak of the second bipolar limb lead, and the R wave peak of the third bipolar limb lead, a heart rate value corresponding to the electrocardiogram signal is obtained; the verification unit is used to analyze the result to indicate that the electrocardiogram signal is abnormal when the heart rate value is greater than a preset heart rate threshold.

[0036] In a possible embodiment, the heart rate value acquisition unit is specifically used to obtain the time interval between each two adjacent R wave peaks based on the R wave peak of the first bipolar limb lead, the R wave peak of the second bipolar limb lead, and the R wave peak of the third bipolar limb lead; obtain the average time interval between two adjacent R wave peaks based on each time interval and the number of R wave peaks; and obtain the heart rate value in the electrocardiogram signal based on the average time interval and the sampling frequency.

[0037] In one possible embodiment, the inference result includes a probability value of the ECG signal being abnormal. When the probability value is greater than a threshold, the inference result indicates that the ECG signal is abnormal; wherein the threshold is the value in the precision-recall curve that maximizes the harmonic mean of the precision and the recall.

[0038] In a possible embodiment, the model training unit is further configured to resample the sample ECG signal at a second sampling frequency, wherein the second sampling frequency is less than the first sampling frequency, and standardize the sample ECG signal.

[0039] In a third aspect, an embodiment of the present application provides a computer device, including:

[0040] a memory having a computer program stored thereon;

[0041] A processor is used to execute a computer program in a memory to implement the steps of the electrocardiogram signal analysis method based on a deep learning model in any embodiment of the first aspect.

[0042] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the electrocardiogram signal analysis method based on a deep learning model in any embodiment of the first aspect.

[0043] In order to improve the analysis effect of the deep learning model on the ECG signal, an ECG signal analysis method based on the deep learning model is provided in an embodiment of the present application. The deep learning model used in this method is combined with a multi-head attention mechanism on the basis of the residual model to enhance the feature selectivity and context modeling ability of the deep learning model for different input data, improve the correction ability of the deep learning model, and thus improve the analysis effect of the ECG signal. In addition, in the embodiment of the present application, when the inference result indicates that the ECG signal is abnormal, the inference result is verified according to the morphological characteristics of the ECG signal to reduce the interference of false positives (which are negative in themselves but detected as positive, and positive indicates that the ECG signal is abnormal), thereby further improving the analysis effect of the ECG signal. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0045] Figure 1 A schematic diagram of a residual network provided in an embodiment of the present application;

[0046] Figure 2 A schematic diagram of a deep learning model provided in an embodiment of the present application;

[0047] Figure 3 A schematic diagram of a residual block provided in an embodiment of the present application;

[0048] Figure 4 A schematic diagram of a sample ECG signal preprocessing method provided in an embodiment of the present application;

[0049] Figure 5 A flowchart of an electrocardiogram signal analysis method based on a deep learning model provided in an embodiment of the present application;

[0050] Figure 6 A flowchart of an inference result verification provided in an embodiment of the present application;

[0051] Figure 7 A schematic diagram of an ECG signal analysis system based on a deep learning model provided in an embodiment of the present application. DETAILED DESCRIPTION

[0052] In order to help those skilled in the art better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0053] Throughout the specification and claims of this application, the terms "first" and "second" are used to distinguish different objects rather than to describe a specific order of objects. For example, the terms "first convolutional layer" and "second convolutional layer" are used to distinguish different convolutional layers rather than to describe a specific order of convolutional layers.

[0054] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.

[0055] In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more, for example, multiple processing units means two or more processing units, etc.; multiple elements means two or more elements, etc.

[0056] In order to make the following description of the embodiments clearer, the technical terms involved in this application are first introduced.

[0057] The 12-lead electrocardiogram (12-lead ECG) is the most commonly used ECG analysis method in clinical practice. By placing multiple electrodes on the human body surface, it synchronously records the heart's electrical activity in different directions, comprehensively reflecting the heart's electrophysiological state. The 12-lead ECG includes three bipolar limb leads (Leads I, II, and III), three unipolar limb leads (aVR, aVL, and aVF), and six chest leads (V1, V2, V3, V4, V5, and V6). The electrode positions and functions of each bipolar limb lead are as follows:

[0058] Lead I: positive (left upper limb), negative (right upper limb), reflects the left-right direction potential difference;

[0059] Lead II: positive (left lower limb), negative (right upper limb), reflecting the potential difference in the inferior-superior direction;

[0060] Lead III: positive pole (left lower limb), negative pole (left upper limb), reflects the potential difference in the left lower-right upper direction.

[0061] In related technologies, the ECG signal analysis method based on deep learning uses a deep learning model that is difficult to fully capture the long-distance dependencies or dynamic feature importance between input data when processing complex, unbalanced or noisy multi-lead ECG signals, which limits the model's adaptability and correction capabilities to heterogeneous data distribution, resulting in unsatisfactory ECG signal analysis results.

[0062] To this end, an embodiment of the present application provides an ECG signal analysis method based on a machine learning model. The deep learning model used in this method introduces a multi-head attention mechanism on the basis of a residual network to enhance the feature selectivity and context modeling capabilities of the deep learning model for different input data, improve the error correction capability of the deep learning model, and thus improve the analysis effect of the ECG signal. In addition, in the embodiment of the present application, when the inference result indicates that the ECG signal is abnormal, the inference result is verified according to the morphological features corresponding to the ECG signal, reducing the interference of false positive data (which is negative in itself but analyzed as positive, where positive indicates an abnormal ECG signal), and further improving the analysis effect of the ECG signal.

[0063] To make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the embodiments of the present application are further described in detail below with reference to the accompanying drawings and specific implementation methods. Since the embodiments of the present application involve the training of a deep learning model, before using the deep learning model, the deep learning model and the training of the deep learning model are first introduced.

[0064] Among them, the deep learning model in the embodiment of the present application includes a residual network ResNet combined with a multi-head attention mechanism MultiHeadAttention, which fully captures the long-distance dependency relationship or dynamic feature importance between input data, improves the adaptability and correction ability of the deep learning model to heterogeneous data distribution, and thereby improves the accuracy of the deep learning model.

[0065] In one possible implementation, the residual network ResNet includes multiple connected residual blocks ResBlock, and the output of the residual network ResNet, that is, the features extracted by the residual network ResNet, is processed through random inactivation Dropout to provide diverse input representations for the multi-head attention mechanism MultiHead Attention.

[0066] For example, Figure 1 As shown, the residual network ResNet includes the first residual block ResBlock1, the second residual block ResBlock2, the third residual block ResBlock3, the fourth residual block ResBlock4 and the fifth residual block ResBlock5. The output of the fifth residual block ResBlock5 is subjected to random inactivation Dropout to obtain the query vector Q, key vector K and value vector V used for multi-head attention mechanism calculation.

[0067] In an embodiment of the present application, the output of the residual network ResNet, that is, the features extracted by the residual network ResNet, is processed by random inactivation Dropout to provide diversified input representations for the multi-head attention mechanism MultiHead Attention, which can increase the robustness of the model and prevent overfitting.

[0068] In addition, the deep learning model in the embodiment of the present application may also include a convolution layer Conv, a batch normalization BatchNorm, an activation function LeakyReLU, a pooling layer GlobalMaxPool, a linear layer Linear and an activation function SoftMax.

[0069] like Figure 2 As shown, in the deep learning model, the first end of the convolution layer Conv serves as the input end of the deep learning model, the second end of the convolution layer Conv is connected to the first end of the batch normalization BatchNorm, the second end of the batch normalization BatchNorm is connected to the first end of the activation function LeakyReLU, the second end of the activation function LeakyReLU is connected to the first end of the first residual block ResBlock1, the second end of the first residual block ResBlock1 is connected to the first end of the second residual block ResBlock2, the second end of the second residual block ResBlock2 is connected to the first end of the third residual block ResBloc3, the second end of the third residual block ResBloc3 is connected to the first end of the fourth residual block ResBloc4, the second end of the fourth residual block ResBloc4 is connected to the first end of the fifth residual block ResBloc5, the second end of the fifth residual block ResBloc5 is connected to the first end of the random dropout, the second end of the random dropout is connected to the first end of the multi-head attention mechanism MultiHead Attention, and the multi-head attention mechanism MultiHead The second end of Attention is connected to the first end of the pooling layer GlobalMaxPool, the second end of the pooling layer GlobalMaxPool is connected to the first end of the linear layer Linear, the second end of the linear layer Linear is connected to the first end of the activation function SoftMax, and the second end of the activation function SoftMax serves as the output end of the deep learning model.

[0070] It should be noted that the convolutional layer Conv, batch normalization BatchNorm, activation function LeakyReLU, pooling layer GlobalMaxPool, linear layer Linear and activation function SoftMax used in the deep learning model in the embodiment of the present application are mature technical means in this field, and their specific structure and function will not be repeated here.

[0071] Furthermore, if Figure 3As shown, the residual block ResBlock may include a residual path and an identity mapping path; the first end of the residual path and the first end of the identity mapping path are connected together and connected to the input end of the residual block ResBlock, and the second end of the residual path and the second end of the identity mapping path are connected together through a residual connection and connected to the output end of the residual block ResBlock; wherein, the residual path includes a first convolutional layer Conv1, a first normalization layer BatchNorm1, a first activation function layer LeakyReLU1, a second convolutional layer Conv2, a second normalization layer BatchNorm2 and a second activation function layer LeakyReLU2 connected in sequence, and the identity mapping path includes a pooling layer AvgPool and a third convolutional layer Conv2 connected in sequence.

[0072] In an embodiment of the present application, introducing the pooling layer AvgPool and the third convolutional layer Conv3 in the identity mapping path of the residual block ResBlock can reduce the risk that the deep learning model performs well on training data but performs significantly worse on unknown new data (test data); introducing Conv1 and Conv2 in the residual path allows the deep learning model to automatically learn multi-level, abstract feature representations from electrocardiogram signals.

[0073] Based on the deep learning model constructed in the aforementioned embodiment, the training method of the deep learning model will be introduced below.

[0074] It should be understood that training a deep learning model requires a large number of sample ECG signals. The source of the sample ECG signals is not specifically limited in the embodiments of the present application. For example, sample ECG signals can be obtained from the research resource for complex physiologic signals (PhysioNet) website or from the PTB-XL dataset.

[0075] After obtaining the sample ECG signals, first, the sample ECG signals are preprocessed; secondly, the preprocessed sample ECG signals are retained in a 1:1 ratio of negative to positive; then, the retained sample ECG signals are packaged into a dataset of (N, 12, 1000) dimensions, where N represents the total number of sample ECG signals, 12 represents a 12-lead ECG signal, and 1000 represents the length of a 10s ECG signal; finally, according to the dataset partitioning method commonly used in deep learning models, the dataset is randomly divided into 7:2:1, which are the training set, test set, and tuning set, respectively.

[0076] For example, the dataset partitioning methods commonly used in deep learning models can be any one of simple random partitioning, stratified sampling partitioning, time series partitioning, K-fold cross validation, grouping partitioning, domain adaptive partitioning, and semi-supervised partitioning.

[0077] In one possible implementation, Figure 4 As shown, the preprocessing of the sample ECG signal in the embodiment of the present application includes the following steps 1 to 4:

[0078] Step 1: Perform quality control on the sample ECG signals acquired at the first sampling frequency.

[0079] For example, taking the first sampling frequency as 500Hz and the sample ECG signal as a 10-second ECG signal as an example, the embodiment of the present application can use a continuous zero-value screening method to detect whether the sample ECG signal has a lead missing; if the value of 1000 consecutive sampling points of a certain lead is 0, the lead is determined to be missing and a prompt is given; further, a null value detection method is used to detect whether the sample ECG signal has data missing; if the sample ECG signal has a single sampling point null value, it is supplemented by interpolation; if the sample ECG signal has a large number of null values, it is determined to be abnormal data and a prompt is given.

[0080] Step 2: Filter the sample ECG signal through a bandpass filter with a preset cutoff frequency.

[0081] For example, in the embodiment of the present application, a 5th-order Butterworth bandpass filter may be used to digitally filter the sample ECG signal.

[0082] Furthermore, considering that the primary frequency distribution of the sample ECG signal is between 0-45 Hz, the ST segment frequency range is 0.7-2 Hz, the P wave and T wave frequency range is 0.7-10 Hz, and the baseline drift frequency is between 0.05-1 Hz, the filter's preset lower cutoff frequency limit can be set to 0.85 Hz, and its preset upper cutoff frequency limit can be set to 45 Hz. It should be understood that the preset lower cutoff frequency limit and the preset upper cutoff frequency limit in this embodiment are merely exemplary.

[0083] Step three: resample the filtered sample ECG signal at a second sampling frequency.

[0084] For example, through repeated experiments, it is found that a sample ECG signal with a sampling frequency of 100 Hz does not affect the analysis accuracy of the ECG signal. Therefore, the present application implements the use of the scipy.signal.resample function to resample the sample ECG signal and reduce the sampling frequency to 100 Hz.

[0085] After resampling, the data size is 1 / 5 of the original, which can greatly improve the training and inference speed of the model and save hardware costs.

[0086] Step 4: Standardize the sample ECG signal.

[0087] For example, considering that the sample ECG signals in the data set come from different sources, it is necessary to convert the sample ECG signals of different dimensions or distributions into a normal distribution with a mean of u and a standard deviation of σ. The calculation method is shown in the following formula (1):

[0088]

[0089] Where x represents the sample ECG signal, u represents the mean, and σ represents the standard deviation.

[0090] At this point, a standard sample ECG signal, that is, a 10-second ECG signal, can be obtained.

[0091] In the embodiment of the present application, the quality control screening method of the sample ECG signal and the Butterworth bandpass filtering method can reduce the impact of the missing sample ECG signal and baseline drift; the sampling frequency of the sample ECG signal is reduced to 100 Hz, which can improve the model training and inference speed; in addition, the Z-Score normalization method is used to eliminate the impact of dimension, improve the consistency of sample ECG signals from different sources, and improve the quality of the sample ECG signal.

[0092] After preprocessing the sample ECG signals, the deep learning model is trained using the training set. It should be understood that the training method of the deep learning model is a mature technical means in this field and will not be described in detail here.

[0093] For example, during the deep learning model training process, the batch size is set to 128; the loss function is CrossEntropyLoss, and the optimizer is Adam; a dynamic learning rate adjustment mechanism is used, with an initial learning rate of 0.001, a learning rate adjustment step of 20, and an adjustment coefficient of 0.5; and the epoch is 400.

[0094] In combination with the application scenarios in the embodiments of the present application, with the main purpose of preventing missed detection, we can focus on improving the recall rate index (the proportion of correctly predicted true positive examples). When training the deep learning model, the update condition of the parameter matrix must meet the following formula (2):

[0095]

[0096] Among them, Loss is the loss function, i represents the i-th epoch, Recall is the recall rate value, and F1_Score is the harmonic mean of precision and recall.

[0097] If the model parameters of the deep learning model are not updated within a preset number of epochs, the training of the deep learning model can be stopped. It should be understood that the specific value of the preset number is not specifically limited in the embodiments of this application. In the actual training process of the deep learning model, the number of epochs can be adjusted accordingly according to needs.

[0098] At this point, the deep learning model training in the embodiment of the present application is completed.

[0099] Below, the embodiment of the present application will introduce the process and method of analyzing ECG signals based on the deep learning model trained in the above embodiment.

[0100] See also Figure 5 , which is a flowchart of an electrocardiogram signal analysis method based on a deep learning model provided in an embodiment of the present application.

[0101] like Figure 5 As shown in FIG, the ECG signal analysis method based on deep learning includes the following steps:

[0102] Step S510: Acquire the electrocardiogram signal to be analyzed.

[0103] The electrocardiogram signal to be analyzed may be a complete 12-lead electrocardiogram signal.

[0104] Step S520: Input the ECG signal into the trained deep learning model and obtain the inference result output by the deep learning model; wherein the deep learning model includes a residual network combined with a multi-head attention mechanism layer.

[0105] It should be understood that the deep learning model has been introduced in detail above and will not be repeated here. The deep learning model used in the embodiments of the present application combines a multi-head attention mechanism on the basis of a residual network to fully capture the long-distance dependencies or dynamic feature importance between input data, improve the adaptability and error correction capabilities of the deep learning model for heterogeneous data distribution, and thus improve the accuracy of the deep learning model.

[0106] It should be noted that in the embodiments of this application, the main purpose of deep model training is to prevent missed detections and focus on improving the recall rate. The reasoning results of the deep learning model may have a slightly higher proportion of false positive results. Therefore, the following step S300 is required to identify false positive results, thereby increasing the accuracy of identifying ECG signal abnormalities.

[0107] Step S530: When the inference result indicates that the ECG signal is abnormal, the inference result is verified according to the morphological characteristics of the ECG signal to obtain an analysis result of the ECG signal.

[0108] In the embodiment of the present application, the morphological characteristics of the electrocardiogram signal may refer to the shape, amplitude, time interval and relationship between the waves of the electrocardiogram waveform.

[0109] The following describes how to determine if an ECG signal is abnormal and how to verify the inference results.

[0110] In one possible implementation, the tuning set data is loaded into the trained deep learning model, and the trained deep learning model is used to infer it. The probability (y_pred_prob) that the deep learning model predicts that each data item is a positive class and the true label (y_true) of each data item are recorded. The precision_recall_curve function traverses all possible thresholds based on the input (y_pred_prob, y_true) and calculates the corresponding precision (precision) and recall (recall), thereby generating a precision-recall curve. The harmonic mean F1-Score of the precision and recall rates is calculated, and the threshold threshold that maximizes the harmonic mean F1-Score of the precision and recall rates is found. This threshold threshold is also the optimal threshold. The calculation method of the harmonic mean F1-Score of the precision and recall rates is shown in the following formula (3):

[0111]

[0112] It should be understood that when the probability of the ECG signal being abnormal output by the deep learning model reasoning is greater than the optimal threshold, the reasoning result indicates that the ECG signal is abnormal.

[0113] In a possible embodiment, the inference result output by the deep learning model is verified by using the morphological features of the electrocardiogram signal, specifically as follows: Steps S5310 to S5330:

[0114] Step S5310: Determine the R-wave peak of the first bipolar limb lead, the R-wave peak of the second bipolar limb lead, and the R-wave peak of the third bipolar limb lead in the electrocardiogram signal.

[0115] It should be understood that the first bipolar limb lead, the second bipolar limb lead, and the third bipolar limb lead in the embodiment of the present application correspond to lead I, lead II, and lead III, respectively.

[0116] In one possible implementation, the position of the R wave peak can be captured by traversing lead I, lead II, and lead III using the wfdb.processing.gqrs_detect function.

[0117] Step S5320: Obtain a heart rate value corresponding to the electrocardiogram signal according to the R wave peak of the first bipolar limb lead, the R wave peak of the second bipolar limb lead, and the R wave peak of the third bipolar limb lead.

[0118] According to the following formula (4), the time interval between two adjacent R wave peaks, namely the RR interval, is obtained. Formula (4) is as follows:

[0119] RR_interval (i) =R_index (i+1) -R_index (i) (4)

[0120] Wherein, RR_interval(i) is the i-th RR interval, R_index(i) is the i-th R wave peak position, and R_index(i+1) is the i+1-th R wave peak position.

[0121] The average RR interval was calculated according to the following formula (5):

[0122]

[0123] in, is the mean RR interval.

[0124] According to the mean RR interval The heart rate value corresponding to the ECG signal is calculated as shown in the following formula (6):

[0125]

[0126] Among them, Rate is the calculated heart rate value, and Fs is the sampling frequency after resampling.

[0127] Step S5330: When the heart rate value is greater than the preset heart rate threshold, the analysis result shows that the electrocardiogram signal is abnormal.

[0128] For example, according to the ECG diagnostic manual, a heart rate greater than 100 beats / minute is considered an ECG signal abnormality. For positive results with a heart rate less than 100 beats / minute, the corresponding analysis result is corrected to negative data, thereby further improving the accuracy of ECG signal analysis.

[0129] To more intuitively observe the effect of the secondary verification, the test set data and the tuning set data were respectively input into the trained deep learning model. For the test set data, the inference results output by the deep learning model were directly used as the analysis results. For the tuning set data, the positive inference results output by the deep learning model were verified, and the verification results were used as the analysis results. The corresponding evaluation indicators, namely the accuracy rate (ACC), the harmonic mean of the precision and recall rate (F1-Score), the precision rate (Precision), and the recall rate (Recall), are shown in Table 1 below:

[0130] Table 1

[0131]

[0132] Through the above Table 1, further verifying the positive inference results output by the deep learning model can improve the accuracy of analyzing ECG signals.

[0133] It should be understood that the specific type of ECG signal abnormality is not specifically limited in the embodiments of the present application. For example, the ECG signal abnormality may be supraventricular tachycardia (SVTA). SVTA is a common ECG signal abnormality, i.e., arrhythmia, originating from the atria or above the atrioventricular node, and manifested as an abnormally increased heart rate (usually exceeding 100 beats per minute). Although most supraventricular tachycardias are not fatal, if they are not treated in time or are accompanied by other serious heart diseases, they may cause certain harm to health. Through the method described in the embodiments of the present application, the ECG signal to be analyzed outputs an inference result about supraventricular tachycardia through a deep learning model; when the inference result indicates supraventricular tachycardia, the inference result is verified by the morphological features of the ECG signal to reduce the probability of false positives (the inference result indicates a positive, but the ECG signal is actually negative), thereby improving the analysis effect of supraventricular tachycardia.

[0134] In addition, Figure 7 As shown, the embodiment of the present application further provides an electrocardiogram signal analysis system based on a deep learning model, comprising: a first acquisition module 710, a second acquisition module 720 and a verification module 730;

[0135] A first acquisition module 710 is used to acquire an electrocardiogram signal to be analyzed;

[0136] A second acquisition module 720 is configured to input the ECG signal into a trained deep learning model and obtain an inference result output by the deep learning model; wherein the deep learning model includes a residual network combined with a multi-head attention mechanism layer;

[0137] The verification module 730 is used to verify the reasoning result according to the morphological characteristics of the ECG signal to obtain the analysis result of the ECG signal when the reasoning result indicates that the ECG signal is abnormal.

[0138] In order to improve the analysis effect of the deep learning model on the ECG signal, the deep learning model used in the embodiment of the present application is combined with a multi-head attention mechanism on the basis of the residual model to enhance the feature selectivity and context modeling ability of the deep learning model for different input data, improve the correction ability of the deep learning model, and thus improve the analysis effect of the ECG signal. In addition, in the embodiment of the present application, when the inference result indicates that the ECG signal is abnormal, the inference result is verified according to the morphological characteristics of the ECG signal to reduce the interference of false positives (which are negative in themselves but detected as positive, and positive indicates that the ECG signal is abnormal), thereby further improving the analysis effect of the ECG signal.

[0139] In a possible embodiment, the residual network includes a plurality of residual blocks connected together, the residual block includes a residual path and an identity mapping path; the first end of the residual path and the first end of the identity mapping path are connected together and connected to the input end of the residual block, and the second end of the residual path and the second end of the identity mapping path are connected together through a residual connection and connected to the output end of the residual block; wherein the residual path includes a first convolutional layer, a first normalization layer, a first activation function layer, a second convolutional layer, a second normalization layer and a second activation function layer connected in sequence, and the identity mapping path includes a pooling layer and a third convolutional layer connected in sequence.

[0140] In a possible embodiment, the ECG signal analysis system based on the deep learning model further includes: a model training module;

[0141] The model training module is configured to obtain a complete sample ECG signal of a lead at a first sampling frequency; filter the sample ECG signal through a bandpass filter with a preset cutoff frequency; wherein the preset cutoff frequency is obtained based on the frequency of the sample ECG signal, the frequency range of the ST segment in the sample ECG signal, the frequency range of the P wave in the sample ECG signal, the frequency range of the T wave in the sample ECG signal, and the baseline drift frequency of the sample ECG signal; standardize the sample ECG signal after filtering; train a deep learning model based on the standardized sample ECG signal until the model parameters of the deep learning model remain unchanged within a preset number of training cycles; wherein, during the deep learning model training process, the update of the parameter matrix satisfies the conditions that the loss function of the i+1th training cycle is less than the loss function of the i-th training cycle, the recall rate of the i+1th training cycle is greater than the recall rate of the i-th training cycle, and the harmonic mean of the precision and recall rate of the i+1th training cycle is greater than the harmonic mean of the precision and recall rate of the i-th training cycle, where i is an integer greater than or equal to 1.

[0142] In a possible embodiment, the verification module includes a heart rate value acquisition unit and a verification unit. The heart rate value acquisition unit is used to determine the R wave peak of the first bipolar limb lead, the R wave peak of the second bipolar limb lead, and the R wave peak of the third bipolar limb lead in the electrocardiogram signal; based on the R wave peak of the first bipolar limb lead, the R wave peak of the second bipolar limb lead, and the R wave peak of the third bipolar limb lead, a heart rate value corresponding to the electrocardiogram signal is obtained; the verification unit is used to analyze the result to indicate that the electrocardiogram signal is abnormal when the heart rate value is greater than a preset heart rate threshold.

[0143] In a possible embodiment, the heart rate value acquisition unit is specifically used to obtain the time interval between each two adjacent R wave peaks based on the R wave peak of the first bipolar limb lead, the R wave peak of the second bipolar limb lead, and the R wave peak of the third bipolar limb lead; obtain the average time interval between two adjacent R wave peaks based on each time interval and the number of R wave peaks; and obtain the heart rate value in the electrocardiogram signal to be detected based on the average time interval and the sampling frequency.

[0144] In one possible embodiment, the inference result includes a probability value of the ECG signal being abnormal. When the probability value is greater than a threshold, the inference result indicates that the ECG signal is abnormal; wherein the threshold is the value in the precision-recall curve that maximizes the harmonic mean of the precision and the recall.

[0145] In a possible embodiment, the model training unit is further configured to downsample the filtered sample ECG signal at a second sampling frequency, wherein the second sampling frequency is less than the first sampling frequency; and standardize the downsampled sample ECG signal.

[0146] In addition, an embodiment of the present application provides a computing device, including:

[0147] at least one memory for storing a program;

[0148] At least one processor is used to execute the program stored in the memory; wherein, when the program stored in the memory is executed, the processor is used to execute the electrocardiogram signal analysis method based on machine learning as in the aforementioned embodiment.

[0149] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components indicated as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.

[0150] The above is merely one specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A method for analyzing electrocardiogram signals based on a deep learning model, characterized in that: The method comprises: Obtaining the ECG signal to be analyzed; Inputting the ECG signal into a trained deep learning model and obtaining an inference result output by the deep learning model; wherein the deep learning model includes a residual network combined with a multi-head attention mechanism; In the case where the inference result indicates that the electrocardiogram signal is abnormal, the inference result is verified according to the morphological characteristics of the electrocardiogram signal to obtain an analysis result of the electrocardiogram signal.

2. The method according to claim 1, characterized in that The residual network includes a plurality of connected residual blocks, and any of the residual blocks includes a residual path and an identity mapping path; The first end of the residual path and the first end of the identity mapping path are connected together and connected to the input end of the residual block, and the second end of the residual path and the second end of the identity mapping path are connected together through a residual connection and connected to the output end of the residual block; wherein, the residual path includes a first convolutional layer, a first normalization layer, a first activation function layer, a second convolutional layer, a second normalization layer and a second activation function layer connected in sequence, and the identity mapping path includes a pooling layer and a third convolutional layer connected in sequence.

3. The method according to claim 1, characterized in that The training method of the deep learning model is as follows: Acquiring a complete sample electrocardiogram signal of the lead at a first sampling frequency; Filtering the sample ECG signal through a bandpass filter with a preset cutoff frequency; wherein the preset cutoff frequency is obtained based on the frequency of the sample ECG signal, the frequency range of the ST segment in the sample ECG signal, the frequency range of the P wave in the sample ECG signal, the frequency range of the T wave in the sample ECG signal, and the baseline drift frequency of the sample ECG signal; normalizing the sample ECG signal; The deep learning model is trained according to the sample electrocardiogram signal until the model parameters of the deep learning model remain unchanged within a preset number of training cycles; wherein, during the training of the deep learning model, the update of the parameter matrix satisfies the following conditions: the loss function of the i+1th training cycle is less than the loss function of the ith training cycle, the recall rate of the i+1th training cycle is greater than the recall rate of the ith training cycle, and the harmonic mean of the precision and recall rate of the i+1th training cycle is greater than the harmonic mean of the precision and recall rate of the ith training cycle, where i is an integer greater than or equal to 1.

4. The method according to any one of claims 1 to 3, characterized in that Verifying the inference result according to the morphological features of the electrocardiogram signal to obtain the analysis result of the electrocardiogram signal includes: Determining an R-wave peak of a first bipolar limb lead, an R-wave peak of a second bipolar limb lead, and an R-wave peak of a third bipolar limb lead in the electrocardiogram signal; Obtaining a heart rate value corresponding to the electrocardiogram signal according to the R wave peak of the first bipolar limb lead, the R wave peak of the second bipolar limb lead, and the R wave peak of the third bipolar limb lead; When the heart rate value is greater than a preset heart rate threshold, the analysis result indicates that the electrocardiogram signal is abnormal.

5. The method according to claim 4, characterized in that Obtaining a heart rate value corresponding to the electrocardiogram signal according to the R wave peak of the first bipolar limb lead, the R wave peak of the second bipolar limb lead, and the R wave peak of the third bipolar limb lead includes: Obtaining a time interval between every two adjacent R wave peaks according to the R wave peak of the first bipolar limb lead, the R wave peak of the second bipolar limb lead, and the R wave peak of the third bipolar limb lead; Obtaining an average time interval between two adjacent R-wave peaks according to each of the time intervals and the number of the R-wave peaks; A heart rate value corresponding to the electrocardiogram signal is obtained according to the average time interval and the sampling frequency.

6. The method according to claim 1, wherein The inference result includes a probability value of the electrocardiogram signal being abnormal. When the probability value is greater than a threshold, the inference result indicates that the electrocardiogram signal is abnormal; wherein the threshold is a value in the precision-recall curve that maximizes the harmonic mean of the precision and the recall.

7. The method according to claim 3, characterized in that The step of normalizing the sample electrocardiogram signal comprises: Resampling the sample ECG signal at a second sampling frequency; wherein the second sampling frequency is lower than the first sampling frequency; The sample ECG signal is normalized and weighed.

8. An electrocardiogram signal analysis system based on a deep learning model, characterized in that: include: A first acquisition module, a second acquisition module and a verification module; The first acquisition module is used to acquire the electrocardiogram signal to be analyzed; The second acquisition module is used to input the ECG signal into a trained deep learning model and obtain the inference result output by the deep learning model; wherein the deep learning model includes a residual network combined with a multi-head attention mechanism; The verification module is used to verify the reasoning result according to the morphological characteristics of the electrocardiogram signal to obtain the analysis result of the electrocardiogram signal when the reasoning result indicates that the electrocardiogram signal is abnormal.

9. A computer device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the electrocardiogram signal analysis method based on a deep learning model according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the electrocardiogram signal analysis method based on a deep learning model described in any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • A multi-parameter fusion and intelligent perception electrocardio health evaluation method and system

    CN122511601A