A method, device and storage medium for detecting characteristic waveform of electrocardiogram signal

By combining multi-level convolutional neural networks and Transformer encoders, the multi-head self-attention mechanism is used to extract the timing features of ECG signals, which solves the problem of low ECG signal detection efficiency and accuracy, and achieves efficient parallel computing and accurate detection.

CN115153581BActive Publication Date: 2024-09-20SUZHOU UNIV
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202210859962.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-21
Publication Date
2024-09-20
Estimated Expiration
2042-07-21

AI Technical Summary

Technical Problem

The existing ECG signal characteristic waveform detection problems are low efficiency and low accuracy, especially when dealing with signals with high variability or affected by noise. The generalization ability and robustness of traditional methods are poor, and the serialization of deep learning methods is Computation consumes expensive computing resources.

Method used

It uses a method that combines multi-level convolutional neural networks and Transformer encoders to extract spatial features through residual blocks and downsampling layers, uses a multi-head self-attention mechanism to extract temporal features, and improves detection efficiency and performance through skip layer connections and parallel computing. accuracy.

Benefits of technology

It achieves high efficiency and accuracy in ECG signal characteristic waveform detection, reduces computing resource consumption through parallel computing, and combines shallow location information and deep semantic information to improve detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115153581B
    Figure CN115153581B
Patent Text Reader

Abstract

The present invention proposes a method for detecting characteristic waveforms of ECG signals based on convolutional neural networks and Transformers. The convolutional neural network is used to extract spatial information of the signal, and the Transformer is used to capture temporal features based on the self-attention mechanism. The Transformer adopts a multi-head attention mechanism, and different self-attention modules do not interfere with each other and have no dependencies. Each module can be calculated separately and the calculation results can be integrated to obtain the final output. This method is called parallel calculation. In the actual operation process, the speed of parallel calculation is faster than that of serial calculation, making the detection of characteristic waveforms of ECG signals more efficient. In order to locate more accurately, a skip-layer connection structure is selected to splice the intermediate results of the convolutional neural network feature extractor with the corresponding decoder feature map in the channel dimension, and the shallow position information and deep semantic information are combined to make the detection of characteristic waveforms of ECG signals more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electrocardiogram signal detection, and in particular to an electrocardiogram signal characteristic waveform detection method, equipment, device and computer storage medium. Background Art

[0002] In the existing technology, the electrocardiogram (ECG) is a comprehensive reflection of the electrical activity process of myocardial cells, and contains a lot of heart-related information. In a normal cardiac cycle, the ECG signal is mainly composed of a P wave, a QRS wave, a T wave, and a U wave that may appear in some leads. Among them, the P wave represents the depolarization process of the atrium, the QRS wave represents the depolarization process of the ventricle, and the T wave corresponds to the repolarization process of the ventricle. These main waveforms simultaneously form different bands. For example, the PR segment is defined as the position from the end of the P wave to the starting position of the QRS wave, which represents the process of ECG signal conduction from the atrium to the ventricle; the ST segment is located from the end of the QRS wave to the starting position of the T wave; the QT interval is defined as the starting position of the Q wave to the end of the T wave. The schematic diagram is as follows Figure 1 As shown (reference national standard YY0782-2010 / IEC 60601-2-51:2003). Electrocardiograms are usually acquired by placing electrodes at fixed positions on the human body surface and connecting them to an electrocardiograph through lead wires. Currently, a standard twelve-lead system is commonly used in clinical practice, including bipolar limb leads (I, II, III leads), pressurized unipolar limb leads (aVR, aVL, aVF leads), and chest leads (V1, V2, V3, V4, V5, V6 leads).

[0003] Cardiovascular disease has become a major factor threatening people's life, health and safety. ECG signals have become the main tool for diagnosing heart diseases due to their non-invasive and convenient characteristics. Different heart diseases usually show different waveforms or band distortions on the ECG. Therefore, the detection of ECG signal characteristic waveforms is the key to extracting ECG signal information and assisting in the diagnosis of ECG signals. With the development of information technology and the popularization of ECG signal acquisition equipment, a large amount of ECG data has emerged. The analysis of this data is a huge challenge. Using computers to assist in the diagnosis of ECG signals has become a popular trend.

[0004] In recent years, some ECG signal waveform detection methods have been proposed, which are mainly divided into two categories: traditional methods and deep learning methods. Traditional methods are usually based on phasor transformation, mixed Gaussian function, empirical mode decomposition, wavelet transform, support vector machine and other methods. These methods are mainly based on fixed models and rules, and extract waveform-related features for detection based on empirical parameters obtained from cardiac physiology. Their accuracy depends to a large extent on the accuracy of hyperparameter selection and feature analysis. Therefore, such methods usually have poor generalization and robustness, and it is difficult to select accurate models and hyperparameters for signals with large variability or affected by noise.

[0005] The basic models of waveform detection algorithms based on deep learning usually include convolutional neural networks, recurrent neural networks, and autoencoders. Compared with traditional methods that require manual feature extraction and parameter determination, waveform detection algorithms based on neural networks have the characteristics of strong adaptability, strong robustness, and high accuracy. However, different basic network models usually have certain limitations due to their own structural characteristics. For example, convolutional neural networks usually focus on local spatial information, and recurrent neural networks mainly extract the timing information of signals. ECG signals are a sequence signal that changes over time. Combining timing information and spatial information can more comprehensively obtain ECG signal features. Therefore, algorithms that combine convolutional neural networks and recurrent neural networks are widely used. However, in recurrent neural networks, the calculation of the next neuron depends on the output of the previous neuron. Therefore, after the calculation of the previous neuron is completed, the result can only be passed to the next neuron, and then the calculation of the next neuron is performed, and so on, until the final result is obtained. This sequential method is a serial calculation, which consumes expensive computing resources. Therefore, it is of great significance to propose a waveform detection algorithm with high accuracy and efficiency. Summary of the invention

[0006] Therefore, the technical problem to be solved by the present invention is to overcome the problems of low efficiency and low accuracy in detecting characteristic waveforms of electrocardiographic signals in the prior art.

[0007] In order to solve the above technical problems, the present invention provides a method for detecting characteristic waveform of an electrocardiogram signal, comprising:

[0008] The preprocessed signal to be tested is input into a multi-level convolutional neural network module, and feature extraction is performed through a residual block and a multi-level residual block with a downsampling layer to obtain multi-level spatial features;

[0009] The last level of spatial features and the positional encoding information of the signal are added and input into multiple Transformer encoder modules to extract the temporal features and obtain the encoding features;

[0010] The encoded features are input into a decoder, and multi-level decoding features are obtained by skip-layer connection and passing through multi-level residual blocks with upsampling layers, wherein the input of each level of residual blocks with upsampling layers is the feature of the previous level output and the spatial features of the corresponding scale concatenated in the channel dimension;

[0011] After the last level of decoding features are processed by a residual block, the number of channels is reduced using a convolutional layer, and the final ECG signal feature waveform detection result is obtained by processing with a Softmax function.

[0012] Preferably, the preprocessing is to standardize the signal to be measured.

[0013] Preferably, the residual block includes two groups of submodules, the two groups of submodules include a convolution layer, a batch normalization layer and a ReLU activation layer, and the convolution kernel size of the convolution layer in the two groups of submodules is the same, and the input and output dimensions remain unchanged;

[0014] A skip layer structure is added to the second group of sub-modules so as to add the output of the first group of sub-modules and the output of the second group of sub-modules to obtain the final output of the residual block.

[0015] Preferably, the step of inputting the preprocessed signal to be tested into the multi-stage convolutional neural network module comprises:

[0016] Constructing an ECG signal characteristic waveform detection model, wherein the ECG signal characteristic waveform detection model includes an encoder and a decoder, wherein the encoder includes the multi-stage convolutional neural network module and the plurality of Transformer encoder modules;

[0017] Each piece of data is obtained from a data set of different patients for annotation, and the training set and test set are divided into the preset ratio;

[0018] The electrocardiogram signal characteristic waveform detection model is trained using the training set until the loss function converges to obtain a trained electrocardiogram signal characteristic waveform detection model.

[0019] Preferably, the adding of the last level spatial features and the position coding information of the signal and inputting them into a plurality of Transformer encoder modules to extract the temporal features to obtain the coding features comprises:

[0020] When the number of Transformer encoder modules is set to 1, the first encoding feature obtained by adding the last level of spatial features and the position encoding information of the signal is input into a multi-head self-attention module, and the output obtained is added to the first encoding feature and normalized to obtain the second encoding feature;

[0021] The second coding feature is input into a feed-forward network with a single hidden layer, and the output obtained is added to the second coding feature and then normalized to obtain the coding feature.

[0022] Preferably, the step of inputting the first coded feature obtained by adding the last level spatial feature and the positional coding information of the signal into a multi-head self-attention module comprises:

[0023] Mapping the first encoding feature h times to obtain h groups of feature vectors (Q, K, V), where Q represents the information to be queried, K represents the key of the queried information, and V represents the value of the queried information;

[0024] Inputting the h groups of feature vectors into a scaled dot product attention module to generate h scaled dot product feature maps;

[0025] The h scaled dot product feature maps are concatenated to obtain the output of the multi-head self-attention module.

[0026] Preferably, inputting the h groups of feature vectors into a scaled dot product attention module to generate h scaled dot product feature maps comprises:

[0027] Calculate the dot product of Q and K in the i-th group of feature vectors to obtain the self-attention weight of V in the i-th group;

[0028] After adjusting the self-attention weight by the scaling factor, the dot product is performed with V in the i-th group and processed by the Softmax function to obtain the i-th scaled dot product feature map:

[0029]

[0030] Among them, i represents the i-th group of eigenvectors, are the linear transformation matrices corresponding to the i-th group Q, K, and V, T is the transpose, is the scaling factor.

[0031] The present invention also provides a device for detecting characteristic waveforms of electrocardiogram signals, comprising:

[0032] The spatial feature extraction module is used to input the preprocessed signal to be tested into the multi-level convolutional neural network module, and extract the features through a residual block and a multi-level residual block with a downsampling layer to obtain multi-level spatial features;

[0033] A temporal feature extraction module is used to add the last level of spatial features and the position encoding information of the signal and input them into multiple Transformer encoder modules to extract temporal features and obtain encoding features;

[0034] A decoding feature extraction module is used to input the encoding features into a decoder, and obtain multi-level decoding features by skip-layer connection and passing through multi-level residual blocks with upsampling layers, wherein the input of each level of residual blocks with upsampling layers is the feature of the previous level output and the spatial features of the corresponding scale spliced ​​in the channel dimension;

[0035] The result detection module is used to process the last level of decoding features through a residual block, use a convolutional layer to reduce the number of channels, and obtain the final ECG signal feature waveform detection result through a Softmax function.

[0036] The present invention also provides a device for detecting characteristic waveforms of electrocardiogram signals, comprising:

[0037] The memory is used to store computer programs; the processor is used to implement the steps of the above-mentioned method for detecting characteristic waveforms of electrocardiographic signals when executing the computer program.

[0038] The present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method for detecting characteristic waveforms of electrocardiogram signals are implemented.

[0039] The above technical solution of the present invention has the following advantages compared with the prior art:

[0040] The present invention proposes a method for detecting characteristic waveforms of ECG signals based on convolutional neural networks and Transformers. The convolutional neural network is used to extract spatial information of the signal, and the Transformer is used to capture temporal features based on the self-attention mechanism. The Transformer adopts a multi-head attention mechanism, and different self-attention modules do not interfere with each other and have no dependencies. Each module can be calculated separately and the calculation results can be integrated to obtain the final output. This method is called parallel calculation. In the actual operation process, the speed of parallel calculation is faster than that of serial calculation, making the detection of characteristic waveforms of ECG signals more efficient. In order to locate more accurately, a skip-layer connection structure is selected to splice the intermediate results of the convolutional neural network feature extractor with the corresponding decoder feature map in the channel dimension, and the shallow position information and deep semantic information are combined to make the detection of characteristic waveforms of ECG signals more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below according to specific embodiments of the present invention in conjunction with the accompanying drawings, wherein:

[0042] Figure 1 This is a schematic diagram of the ECG signal in a normal cardiac cycle;

[0043] Figure 2 A flowchart of the method for detecting characteristic waveform of an electrocardiogram signal provided by the present invention;

[0044] Figure 3 It is the overall architecture diagram of the present invention;

[0045] Figure 4 Schematic diagram of the residual block structure of the present invention

[0046] Figure 5 It is a schematic diagram of the transformer structure of the present invention;

[0047] Figure 6 It is a schematic diagram of the structure of the multi-head attention mechanism of the present invention;

[0048] Figure 7 Schematic diagram of the scaling dot product structure of the present invention;

[0049] Figure 8 It is a schematic diagram of the characteristic waveform of the ECG signal;

[0050] Fig. 9 It is a label of a normal signal and a schematic diagram of the waveform detection result;

[0051] Fig.10 It is a schematic diagram of the label and waveform detection results of the noisy signal;

[0052] Fig.11 It is a label and waveform detection result diagram of first-degree atrioventricular block signal;

[0053] Fig.12 It is a label of premature ventricular signal and a schematic diagram of waveform detection results;

[0054] Fig.13 A structural block diagram of a device for detecting characteristic waveforms of electrocardiogram signals provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0055] The core of the present invention is to provide a method, device, equipment and computer storage medium for detecting characteristic waveforms of electrocardiogram signals, so as to make the detection of characteristic waveforms of electrocardiogram signals more efficient and accurate.

[0056] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0057] Please refer to Figure 2 and Figure 3 , Figure 2 This is a flow chart of the implementation of the method for detecting characteristic waveform of electrocardiogram signal provided by the present invention. Figure 3 The overall structure diagram of the present invention is as follows:

[0058] S101: input the preprocessed signal to be tested into a multi-level convolutional neural network module, perform feature extraction through a residual block and a multi-level residual block with a downsampling layer, and obtain multi-level spatial features;

[0059] The preprocessing is to perform Z-score standardization on the signal to be tested;

[0060] The multi-level convolutional neural network module includes a residual block and multiple levels of residual blocks with downsampling layers. In this embodiment, it includes two levels of residual blocks with downsampling layers constructed based on the maximum pooling layer, and the downsampling multiples are 1 / 2 and 1 / 5 respectively;

[0061] like Figure 4 As shown, the residual block includes two groups of sub-modules, the two groups of sub-modules include convolutional layers, batch normalization layers and ReLU activation layers, and the convolution kernel sizes of the convolutional layers in the two groups of sub-modules are the same, the input and output dimensions remain unchanged, and a skip layer structure is added to the second group of sub-modules to add the output of the first group of sub-modules to the output of the second group of sub-modules to obtain the final output of the residual block, thereby avoiding gradient explosion or gradient disappearance and network degradation that may be caused by network deepening.

[0062] S102: adding the last level of spatial features and the position encoding information of the signal and inputting the sum into multiple Transformer encoder modules to extract the temporal features and obtain the encoding features;

[0063] The ECG signal reflects the change of cardiac electrical activity over time, and its signal characteristic waveform is continuous and regular. The self-attention mechanism obtains weights by calculating the correlation between feature points, but ignores the position information of the signal. Therefore, it is usually necessary to add the position encoding information of the signal to the input signal of the Transformer. In order to make up for the defect of the structure ignoring the absolute position information, the present invention selects a set of scientific parameters of the same length as the input signal of the Transformer encoder as the position encoding, adds the position encoding and the input feature to the Transformer encoder module, and the network dynamically learns the position information.

[0064] The Transformer encoder consists of a multi-head self-attention module and a feed-forward network with a single hidden layer. Each sub-layer is followed by a layer normalization module, and both adopt a residual structure, such as Figure 5 As shown;

[0065] Transformer captures contextual features through the self-attention mechanism. Transformer uses a multi-head attention mechanism, which can focus on different subspace information at different positions, so that the network can capture richer feature information. When the number of Transformer encoder modules is set to 1, the first encoding feature obtained by adding the last level of spatial features and the position encoding information of the signal is input into a multi-head self-attention module, such as Figure 6 As shown:

[0066] Map the first encoding feature h times to obtain h groups of feature vectors (Q, K, V), where Represents the information to be queried. The key representing the information being queried. represents the value of the information being queried, R represents a real number, d model ×d q , d model ×d k , d model ×d v are the dimensions of Q, K, and V, which are all hyperparameters and are pre-set before training. In this embodiment, d model =128;

[0067] The h groups of feature vectors are input into the scaled dot product attention module to generate h scaled dot product feature maps, where h represents the number of sub-heads. In this embodiment, h=8. Figure 7 As shown:

[0068] Calculate the dot product of Q and K in the i-th group of feature vectors to obtain the self-attention weight of V in the i-th group;

[0069] After adjusting the self-attention weight by the scaling factor, the dot product is performed with V in the i-th group and processed by the Softmax function to obtain a smoother i-th scaled dot product feature map:

[0070]

[0071] Among them, i represents the i-th group of eigenvectors, are the linear transformation matrices corresponding to the i-th group Q, K, and V respectively (the input Q, K, and V dimensions of the multi-head self-attention mechanism are different from the calculation dimensions in the single-head attention mechanism. Through linear transformation, their dimensions are converted to the dimensions required by the single-head self-attention mechanism, which is convenient for the calculation of the single-head attention mechanism). T is the transpose (in the calculation process, in order to ensure the correct dimension of the dot product, K needs to be transposed and multiplied by Q). is the scaling factor;

[0072] The h scaled dot product feature maps are concatenated to obtain the output of the multi-head self-attention module: MutiHead(Q,K,V)=Concat(head1,…,head h )W O , W O Is the linear transformation matrix corresponding to the output result;

[0073] The output obtained by adding the first coding feature is normalized to obtain a second coding feature, the second coding feature is input into a feedforward network with a single hidden layer, the output obtained by adding the second coding feature is normalized to obtain the coding feature;

[0074] In this embodiment, the number of Transformer encoder modules is set to 6, the input of the first Transformer encoder module is the feature obtained by adding the last level of spatial features and the position encoding information of the signal, and the input of the next five Transformer encoder modules are the output of the previous Transformer encoder module of the current Transformer encoder module; in order to prevent overfitting, the discard ratio of the discard layer is set to 0.1.

[0075] S103: Input the encoded features into a decoder, and obtain multi-level decoding features by skip-layer connection and passing through multi-level residual blocks with upsampling layers, wherein the input of each level of residual blocks with upsampling layers is the feature of the previous level output and the spatial features of the corresponding scale concatenated in the channel dimension;

[0076] For the decoder part, its structure is basically the same as that of the convolutional neural network feature extractor, except that the downsampling module is replaced by an upsampling module. The upsampling module adopts a bilinear upsampling method. In this embodiment, two levels of residual blocks with upsampling layers are included, and their upsampling multiples are 5 and 2 respectively. For more accurate positioning, we use a skip-layer connection structure to splice the intermediate result of the convolutional neural network feature extractor with the corresponding decoder feature map in the channel dimension, combining shallow position information with deep semantic information;

[0077] The input of the first-level residual block with upsampling layer is the encoded features output by the last Transformer encoder module, and the input of the last two levels of residual blocks with upsampling layers are the outputs of the residual blocks with upsampling layers in the previous level.

[0078] S104: After the last level of decoding features are processed by a residual block, a convolution layer is used to reduce the number of channels, and the final ECG signal feature waveform detection result is obtained by processing with a Softmax function.

[0079] Finally, a convolution layer with a kernel of 1 is used to reduce the number of channels in the feature map, and the final output is obtained through the Softmax function. The length of the output result is the same as the input signal, and the number of channels is 4, which represent the probability that the sampling point belongs to the P wave, QRS wave, T wave and other waveforms. The parameters of each layer in the multi-level encoding module and decoder are shown in Table 1:

[0080] Table 1 Network layer parameters

[0081]

[0082]

[0083] In Table 1, c represents the number of output channels, k represents the convolution kernel size, N represents the number of channels of the convolution layer, the initial value is set to 32, and [·] represents the rounding function.

[0084] The present invention proposes a method for detecting characteristic waveforms of ECG signals based on convolutional neural networks and Transformers. The convolutional neural network is used to extract spatial information of the signal, and the Transformer is used to capture temporal features based on the self-attention mechanism. The Transformer adopts a multi-head attention mechanism, and different self-attention modules do not interfere with each other and have no dependencies. Each module can be calculated separately and the calculation results can be integrated to obtain the final output. This method is called parallel calculation. In the actual operation process, the speed of parallel calculation is faster than that of serial calculation, making the detection of characteristic waveforms of ECG signals more efficient. In order to locate more accurately, a skip-layer connection structure is selected to splice the intermediate results of the convolutional neural network feature extractor with the corresponding decoder feature map in the channel dimension, and the shallow position information and deep semantic information are combined to make the detection of characteristic waveforms of ECG signals more accurate.

[0085] Based on the above embodiments, this embodiment further describes step S101 in detail:

[0086] The preprocessed signal to be tested is input into the multi-level convolutional neural network module, including:

[0087] Constructing an ECG signal characteristic waveform detection model, wherein the ECG signal characteristic waveform detection model includes an encoder and a decoder, wherein the encoder includes the multi-level convolutional neural network module and the Transformer encoder module;

[0088] Each piece of data is obtained from a data set of different patients for annotation (the data set used in this embodiment is the China Physiological Signal Challenge (CPSC2018) data set), the ECG signal data sampling rate prepared by the present invention is 500HZ, the input length of the ECG signal is fixed to a uniform length (time length is 10 seconds, 5000 points), and the ECG signal comes from data sets of different categories, and its data distribution is shown in Table 2. ECG signal categories include normal (Normal), First-degree atrioventricular block (I-AVB), left bundle branch block (LBBB), right bundle branch block (RBBB), premature atrial contraction (PAC), premature ventricular contraction (PVC), ST-segment depression (STD) and ST-segment elevation (STE).

[0089] Table 2 Distribution of ECG signal datasets

[0090]

[0091] RBBB_PAC / PAC means that this type of ECG signal has right bundle branch block and is accompanied by atrial premature beats or ventricular premature beats;

[0092] The characteristic waveform positions of the extracted data are marked, and the three main characteristic waveforms in the ECG signal: P wave, QRS wave and T wave are marked as 1-3 respectively, and other areas are marked as 0. There is no overlapping area between these labels and they are independent of each other; P wave, QRS wave and T wave are marked as 1-3 respectively, and other areas are marked as 0 respectively. Figure 8 As shown, the rest represent other waveform regions;

[0093] Divide the labeled data set into training set and test set according to the preset ratio;

[0094] The electrocardiogram signal characteristic waveform detection model is trained using the training set until the loss function converges to obtain a trained electrocardiogram signal characteristic waveform detection model.

[0095] Most of the current waveform detection algorithms based on deep learning are based on existing ECG signal datasets. When dividing the training set and the test set, all data are usually divided as a whole, without considering the similarity of the data of the same patient. This leads to reduced detection performance when these algorithms are applied to inter-patient data. The present invention is different from most waveform detection algorithms in which multiple data come from the same patient. The present invention is trained and tested on inter-patient datasets. Therefore, when dividing the training set and the test set, it is possible to avoid the data of the same patient existing in both the training set and the test set. In addition, the present invention has excellent performance on sub-datasets of different categories and has strong generalization ability.

[0096] Based on the above embodiments, this embodiment takes the to-be-input ECG signal sig as an example to further explain in detail:

[0097] Prepare the training set:

[0098] Prepare training data (N*1*5000), which is selected from ECG signals of different categories of data sets and corresponding label data (N*1*5000) to form a training set, where N is the number of samples of training data;

[0099] The input signal is Z-score normalized, and then the normalized data is input into the network for training. The optimizer is the Adam algorithm, and the Adam parameters are set as follows: learning rate lr = 0.001, beta_1 = 0.9, beta_2 = 0.999, epsilon = 1e-08, and the loss function is Dice loss[2]. After training is completed, the model with the minimum loss is saved;

[0100] Prepare the ECG signal to be tested:

[0101] Resample the signal sig to 500HZ, and extract sig[1], sig[2], …, sig[i] with a length of 5000 data points (10 seconds). If the length does not reach 5000, fill 0 to 5000 at the end of the data to ensure that the input signal of the model is 5000 sampling points in length;

[0102] Input sig[1], sig[2], ..., sig[i] into the feature waveform detection model saved during training to obtain the corresponding outputs out[1], out[2], ..., out[i]. The length of out[i] is the same as that of sig[i], that is, 5000 data points (10 seconds). The size of each out[i] is 4*5000, where 5000 is the length of the signal and 4 represents the probability that each sampling point of the signal belongs to the P wave, QRS wave, T wave and other waveforms.

[0103] Waveform detection results, such as Fig. 9 ,10 , 11, and 12 are the labels and waveform detection results of normal signals, noisy signals, first-degree atrioventricular block signals, and premature ventricular contraction signals, respectively. The figures from top to bottom in the sub-figures are the positions of the expert-annotated labels and the positions predicted by the algorithm, respectively.

[0104] Please refer to Fig.13 , Fig.13 A structural block diagram of a device for detecting characteristic waveform of an electrocardiogram signal provided by an embodiment of the present invention; the specific device may include:

[0105] The spatial feature extraction module 100 is used to input the preprocessed signal to be tested into a multi-level convolutional neural network module, perform feature extraction through a residual block and a multi-level residual block with a downsampling layer, and obtain multi-level spatial features;

[0106] A temporal feature extraction module 200 is used to add the last level of spatial features and the position coding information of the signal and input them into multiple Transformer encoder modules to extract the temporal features and obtain the coding features;

[0107] The decoding feature extraction module 300 is used to input the encoding feature into the decoder, and obtain multi-level decoding features by skip-layer connection and passing through multi-level residual blocks with upsampling layers, wherein the input of each level of residual blocks with upsampling layers is the feature of the previous level output and the spatial feature of the corresponding scale concatenated in the channel dimension;

[0108] The result detection module 400 is used to process the last level of decoding features through a residual block, use a convolution layer to reduce the number of channels, and process it through a Softmax function to obtain the final ECG signal characteristic waveform detection result.

[0109] The ECG signal characteristic waveform detection device of the present embodiment is used to implement the aforementioned ECG signal characteristic waveform detection method. Therefore, the specific implementation method of the ECG signal characteristic waveform detection device can be seen in the embodiment part of the ECG signal characteristic waveform detection method mentioned above. For example, the spatial feature extraction module 100, the temporal feature extraction module 200, the decoding feature extraction module 300, and the result detection module 400 are respectively used to implement steps S101, S102, S103, and S104 in the aforementioned ECG signal characteristic waveform detection method. Therefore, its specific implementation method can refer to the description of the corresponding embodiments of each part, which will not be repeated here.

[0110] The present invention develops a data-driven end-to-end deep learning model that autonomously learns and extracts high-level features through a training process without the need for manual feature analysis. The present invention uses a combination of convolutional neural networks and Transformers to extract the temporal and spatial features of signals, and the self-attention mechanism of Transformers can be efficiently calculated through a parallel structure. The method is trained and tested on an inter-patient dataset, and has excellent performance on sub-datasets of different categories, showing strong generalization ability.

[0111] A specific embodiment of the present invention further provides a device for detecting characteristic waveforms of electrocardiogram signals, comprising: a memory for storing a computer program; and a processor for implementing the steps of the above-mentioned method for detecting characteristic waveforms of electrocardiogram signals when executing the computer program.

[0112] A specific embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method for detecting characteristic waveforms of electrocardiogram signals are implemented.

[0113] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0114] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0115] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0116] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0117] Obviously, the above embodiments are merely examples for the purpose of clear explanation and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the present invention.

Claims

1. A method for detecting characteristic waveform of an electrocardiogram signal, characterized in that: include: The preprocessed signal to be tested is input into a multi-level convolutional neural network module, and feature extraction is performed through a residual block and a multi-level residual block with a downsampling layer to obtain multi-level spatial features; The last level of spatial features and the positional encoding information of the signal are added and input into multiple Transformer encoder modules to extract the temporal features and obtain the encoding features; The encoded features are input into a decoder, and multi-level decoding features are obtained by skip-layer connection and passing through multi-level residual blocks with upsampling layers, wherein the input of each level of residual blocks with upsampling layers is the feature of the previous level output and the spatial features of the corresponding scale concatenated in the channel dimension; After the last level of decoding features are processed by a residual block, the number of channels is reduced using a convolutional layer, and the final ECG signal feature waveform detection result is obtained by processing with a Softmax function.

2. The method for detecting characteristic waveform of an electrocardiogram signal according to claim 1, characterized in that: The preprocessing is to standardize the signal to be measured.

3. The method for detecting characteristic waveform of an electrocardiogram signal according to claim 1, characterized in that: The residual block includes two groups of submodules, the two groups of submodules include a convolution layer, a batch normalization layer and a ReLU activation layer, and the convolution kernel size of the convolution layer in the two groups of submodules is the same, and the input and output dimensions remain unchanged; A skip layer structure is added to the second group of sub-modules so that the output of the first group of sub-modules is added to the output of the second group of sub-modules to obtain the final output of the residual block.

4. The method for detecting characteristic waveform of an electrocardiogram signal according to claim 1, characterized in that: The method of inputting the preprocessed signal to be tested into the multi-stage convolutional neural network module comprises: Constructing an ECG signal characteristic waveform detection model, wherein the ECG signal characteristic waveform detection model includes an encoder and a decoder, wherein the encoder includes the multi-stage convolutional neural network module and the plurality of Transformer encoder modules; Each piece of data is obtained from a data set of different patients for annotation, and the training set and test set are divided into the preset ratio; The electrocardiogram signal characteristic waveform detection model is trained using the training set until the loss function converges to obtain a trained electrocardiogram signal characteristic waveform detection model.

5. The method for detecting characteristic waveform of electrocardiogram signal according to claim 1, characterized in that: The last level of spatial features and the position coding information of the signal are added and input into multiple Transformer encoder modules to extract the temporal features, and the obtained coding features include: When the number of Transformer encoder modules is set to 1, the first encoding feature obtained by adding the last level of spatial features and the position encoding information of the signal is input into a multi-head self-attention module, and the output obtained is added to the first encoding feature and normalized to obtain the second encoding feature; The second coding feature is input into a feed-forward network with a single hidden layer, and the output obtained is added to the second coding feature and then normalized to obtain the coding feature.

6. The method for detecting characteristic waveform of an electrocardiogram signal according to claim 5, characterized in that: The step of inputting the first coded feature obtained by adding the last level spatial feature and the position coding information of the signal into a multi-head self-attention module comprises: Mapping the first encoding feature h times to obtain h groups of feature vectors (Q, K, V), where Q represents the information to be queried, K represents the key of the queried information, and V represents the value of the queried information; Inputting the h groups of feature vectors into a scaled dot product attention module to generate h scaled dot product feature maps; The h scaled dot product feature maps are concatenated to obtain the output of the multi-head self-attention module.

7. The method for detecting characteristic waveform of an electrocardiogram signal according to claim 6, characterized in that: The step of inputting the h groups of feature vectors into a scaled dot product attention module to generate h scaled dot product feature maps comprises: calculating the dot product of Q and K in the i-th group of feature vectors to obtain a self-attention weight of V in the i-th group; After adjusting the self-attention weight by the scaling factor, the dot product is performed with V in the i-th group and processed by the Softmax function to obtain the i-th scaled dot product feature map: Among them, i represents the i-th group of eigenvectors, W i Q , W i K , W i V are the linear transformation matrices corresponding to the i-th group Q, K, and V, T is the transpose, is the scaling factor.

8. A device for detecting characteristic waveform of an electrocardiogram signal, characterized in that: include: The spatial feature extraction module is used to input the preprocessed signal to be tested into the multi-level convolutional neural network module, and extract the features through a residual block and a multi-level residual block with a downsampling layer to obtain multi-level spatial features; A temporal feature extraction module is used to add the last level of spatial features and the position encoding information of the signal and input them into multiple Transformer encoder modules to extract temporal features and obtain encoding features; A decoding feature extraction module is used to input the encoding features into a decoder, and obtain multi-level decoding features by skip-layer connection and passing through multi-level residual blocks with upsampling layers, wherein the input of each level of residual blocks with upsampling layers is the feature of the previous level output and the spatial features of the corresponding scale concatenated in the channel dimension; The result detection module is used to process the last level of decoding features through a residual block, use a convolutional layer to reduce the number of channels, and obtain the final ECG signal feature waveform detection result through a Softmax function.

9. A device for detecting characteristic waveform of an electrocardiogram signal, characterized in that: include: Memory for storing computer programs; A processor is used to implement the steps of a method for detecting a characteristic waveform of an electrocardiogram signal as claimed in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for detecting a characteristic waveform of an electrocardiogram signal as claimed in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Electrocardiosignal analysis method, device, storage medium and processor

    CN110393519A

  • Method, device, equipment for determining position of QRS wave group, and storage medium

    CN111345817A

  • Electrocardiosignal premature beat detection method for

    CN112617850A

  • Abnormal electrocardiosignal detection method, device and equipment and medium

    CN113349791A

  • Electrocardiosignal identification and classification method based on multi-cascade deep neural network

    CN113901893A