An electrocardiogram compression sensing method and system based on attention mechanism and spatiotemporal fusion

Through the central voltage compression perception method based on attention mechanism and space-time fusion, the problem of poor signal reconstruction effect of the existing central electrical depth compression perception method at low sampling rate is solved, and efficient signal reconstruction and model generalization are achieved Improve the ability to improve.

CN118370545BActive Publication Date: 2024-11-12JIANGXI AGRICULTURAL UNIVERSITY
View PDF 13 Cites 0 Cited by

Patent Information

Application Number
CN202410805651.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2024-11-12
Estimated Expiration
2044-06-21

AI Technical Summary

Technical Problem

The existing electrocardiogram depth compression perception methods are difficult to improve model processing efficiency and generalization capabilities while maintaining signal quality, especially at low sampling rates, signal reconstruction is not effective.

Method used

Using the cardiac voltage compression perception method based on attention mechanism and space-time fusion, the weights of ECG signals in different leads are learned through the SE block, and combined with the Transformer's self-attention mechanism and multi-head mixed attention mechanism, the signal is compressed and initial reconstruction. and final reconstruction, using space-time fusion technology to capture multidimensional features of signals.

Benefits of technology

High-quality reconstruction of signals is achieved under low sampling rate, which improves the processing efficiency and generalization capabilities of the model, reduces information loss and redundancy, and improves the signal characterization and compression efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118370545B_ABST
    Figure CN118370545B_ABST
Patent Text Reader

Abstract

The present invention discloses an ECG compression sensing method and system based on attention mechanism and spatiotemporal fusion, which relates to the field of ECG signal compression technology. The method comprises: obtaining original ECG signals of multiple leads, learning weights of ECG signals of different leads through SE blocks; compressing the original ECG signals to obtain signal compression measurement values; performing initial reconstruction of the signal compression measurement values; inputting the initial reconstruction results into a spatiotemporal fusion model including a time domain branch and a spatial attention branch improved by Transformer, respectively obtaining a time domain branch reconstruction signal and a spatial attention branch reconstruction signal; performing feature fusion of the initial reconstruction results, the time domain branch reconstruction signal and the spatial attention branch reconstruction signal to obtain the final reconstructed signal. The method can achieve high-quality reconstruction of signals at low sampling rates, and can solve the problem that existing ECG deep compression sensing methods are difficult to improve model processing efficiency and generalization ability while maintaining signal quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of electrocardiogram (ECG) signal compression, and in particular to an ECG compression sensing method and system based on an attention mechanism and spatiotemporal fusion. Background Art

[0002] As an emerging form of medical health management, telemedicine has received widespread attention. As an important source of physiological information, ECG signals can provide dynamic detection of cardiac activity. They can not only capture static ECG information, but also record changes in cardiac activity of patients in different time periods, which is crucial for evaluating cardiac health and detecting cardiovascular diseases. Therefore, ECG signals have become one of the important research directions of telemedicine. Generally speaking, in order to obtain more comprehensive cardiac information and accurately diagnose arrhythmias, 12-lead ECG signals are often used in clinical diagnosis. By placing multiple electrodes on the patient, recording cardiac electrical activity, and drawing an ECG, the patient's heart health status can be analyzed. However, in telemedicine, due to the high dimensionality and complexity of ECG signals, the uninterrupted collection of ECG signals will generate a huge amount of data. Traditional storage and transmission methods are incapable of handling them in telemedicine. An efficient technology to process and transmit these multi-lead ECG signals is urgent. In order to better utilize limited network resources, improve transmission efficiency, and protect patient privacy, multi-lead ECG signal compressed sensing technology has emerged.

[0003] The traditional sampling theorem requires high-frequency sampling of signals, but in many practical applications, this high sampling rate leads to data redundancy and a large amount of storage and transmission overhead. Compressed sensing technology, as an advanced signal processing method, directly compresses the signal during sampling through the prior assumption of sparsity, and can acquire signals at a sampling frequency far lower than that specified by the Nyquist sampling theorem, thereby reducing the sampling requirements, improving the sampling efficiency of the signal, and significantly reducing the amount of data without losing key information.

[0004] However, traditional compressed sensing methods also have some disadvantages, including strong dependence on signal sparsity, sensitivity to noise and errors, and relatively high computational complexity. These limitations may affect the applicability and performance of the algorithm, especially in scenarios with high real-time requirements, large-scale data sets or complex signals.

[0005] With the rise and development of deep learning, researchers began to change their thinking, combining deep learning with compressed sensing, and proposed a deep compressed sensing architecture, which uses neural networks to learn compact representations of data to achieve efficient compression and reconstruction of signals. Deep compressed sensing can adapt to various types of signals and has gradually become a new research hotspot.

[0006] Although these methods have greatly improved the performance of traditional compressed sensing, the reconstructed signals at low sampling rates are often unsatisfactory. If efficient reconstruction is to be achieved at low sampling rates, the ECG signals must have similar waveforms, which limits their use in practical scenarios. Therefore, it is difficult for existing ECG deep compressed sensing methods to improve model processing efficiency and generalization capabilities while maintaining signal quality. Summary of the invention

[0007] Based on this, this application proposes an ECG compressed sensing method and system based on attention mechanism and spatiotemporal fusion, aiming to achieve high-quality reconstruction of signals under low sampling rates, and to solve the problem that existing ECG deep compressed sensing methods are difficult to improve model processing efficiency and generalization ability while maintaining signal quality.

[0008] The first aspect of the present application provides an electrocardiogram compression sensing method based on attention mechanism and spatiotemporal fusion, the method comprising:

[0009] Acquire original ECG signals of multiple leads, preprocess the original ECG signals, and learn weights of ECG signals of different leads through SE blocks;

[0010] The preprocessed original ECG signal is input into the compression model to obtain the signal compression measurement value;

[0011] Performing initial reconstruction on the signal compression measurement value to obtain an initial reconstruction result;

[0012] Inputting the initial reconstruction result into a spatiotemporal fusion model, the spatiotemporal fusion model comprising a time domain branch and a spatial attention branch improved by Transformer, obtaining a time domain branch reconstruction signal according to the time domain branch, and obtaining a spatial attention branch reconstruction signal according to the spatial attention branch improved by Transformer;

[0013] The initial reconstruction result, the time domain branch reconstruction signal and the spatial attention branch reconstruction signal are feature fused to obtain a final reconstructed signal.

[0014] Compared with the prior art, the present application provides an ECG compression sensing method based on attention mechanism and spatiotemporal fusion. The method mainly includes three parts: compression, initial reconstruction and final reconstruction. First, the compression module compresses the signal. Secondly, the dimension of the signal is restored in the initial reconstruction module for subsequent signal processing. Finally, the spatiotemporal fusion module is used to reconstruct the signal details. Specifically, by using the SE block to extract the weights of the ECG signals of different leads, the effective identification and extraction of key information in the ECG signal is achieved, thereby reducing information loss and redundancy; and the self-attention mechanism of the Transformer is used to sequence model the ECG signal to capture the long dependency of the ECG signal; secondly, the spatiotemporal fusion technology is used to combine the time domain and spatial information to achieve multi-dimensional feature characterization of the ECG signal, further improving the characterization ability and compression efficiency of the signal. Therefore, the present application proposes an ECG compression sensing method based on attention mechanism and spatiotemporal fusion. The method can achieve high-quality reconstruction of the signal at a low sampling rate, and can solve the problem that the existing ECG deep compression sensing method is difficult to improve the model processing efficiency and generalization ability while maintaining the signal quality.

[0015] Therefore, the method proposed in this application can solve the problem that the existing ECG deep compressed sensing method is difficult to improve the model processing efficiency and generalization ability while maintaining signal quality.

[0016] As an optional implementation of the first aspect, the step of learning weights of electrocardiogram signals of different leads by SE blocks includes:

[0017] After feature deformation, the original ECG signal is input into the global average pooling in the SE block to obtain the initial weight value, and then the weight value is learned and corrected through two convolutional layers. Finally, different leads of the original ECG signal are multiplied by the corresponding weight value to obtain the weighted feature map.

[0018] As an optional implementation manner of the first aspect, the compression formula of the compression model is:

[0019] ,

[0020] in, represents the signal compression measurement value, and are the weight parameters of the first and second convolutional layers respectively. represents the LeakyReLU activation function, s represents the original ECG signal, and Respectively and The pooling layer of , j and k represent the size of the pooling window in the pooling layer.

[0021] As an optional implementation manner of the first aspect, the process formula of the initial reconstruction is:

[0022] ,

[0023] in, and represents the parameters of the first transposed convolution and the second transposed convolution, Represents the initial reconstruction result.

[0024] As an optional implementation manner of the first aspect, a process formula for obtaining a time domain branch reconstructed signal according to the time domain branch is:

[0025] ,

[0026] in, represents the time domain branch reconstruction signal, represents the multi-scale extended convolution fusion block, represents the deformation of the feature map, express The reverse operation of .

[0027] As an optional implementation manner of the first aspect, a process formula for obtaining a spatial attention branch reconstructed signal according to the spatial attention branch improved by the Transformer is:

[0028] ,

[0029] in, represents the reconstruction signal of the spatial attention branch, represents a Transformer with a multi-head mixed attention mechanism, It means to reassemble the ECG signal into blocks. express The inverse operation of Represents vectorization, express The reverse operation of .

[0030] As an optional implementation of the first aspect, the initial reconstruction result, the time domain branch reconstruction signal, and the spatial attention branch reconstruction signal are feature fused to obtain a final reconstructed signal. The process formula is:

[0031] ,

[0032] in, represents the fusion features of the initial reconstruction result, the time domain branch reconstruction signal, and the spatial attention branch reconstruction signal, represents the final reconstructed signal, represents the weight parameter of the last convolutional layer, Represents SE block.

[0033] A second aspect of an embodiment of the present application provides an electrocardiogram compression sensing system based on an attention mechanism and spatiotemporal fusion, the system comprising:

[0034] A signal preparation module, used for acquiring original ECG signals of multiple leads, preprocessing the original ECG signals, and learning weights of ECG signals of different leads through SE blocks;

[0035] A signal compression module is used to input the preprocessed original ECG signal into the compression model to obtain a signal compression measurement value;

[0036] An initial reconstruction module, used to perform initial reconstruction on the signal compression measurement value to obtain an initial reconstruction result;

[0037] A signal extraction module, used for inputting the initial reconstruction result into a spatiotemporal fusion model, wherein the spatiotemporal fusion model includes a time domain branch and a spatial attention branch improved by Transformer, obtaining a time domain branch reconstructed signal according to the time domain branch, and obtaining a spatial attention branch reconstructed signal according to the spatial attention branch improved by Transformer;

[0038] The deep reconstruction module is used to perform feature fusion on the initial reconstruction result, the time domain branch reconstruction signal and the spatial attention branch reconstruction signal to obtain a final reconstructed signal.

[0039] A third aspect of an embodiment of the present application provides a computer device, comprising a memory, a processor, and a processing program stored on the memory and executable on the processor, wherein the processing program, when executed by the processor, implements the above-mentioned electrocardiographic compressed sensing method based on attention mechanism and spatiotemporal fusion.

[0040] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium having a processing program stored thereon, and when the processing program is executed by a processor, the above-mentioned electrocardiographic compressed sensing method based on attention mechanism and spatiotemporal fusion is executed.

[0041] Additional aspects and advantages of the present application will be given in part in the following description, and in part will become apparent from the following description, or will be understood through the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 A flowchart of an electrocardiogram compression sensing method based on attention mechanism and spatiotemporal fusion proposed in the first embodiment of the present application;

[0043] Figure 2 This is an architecture diagram of the compression and initial reconstruction parts in the system model MSF-CSNet in an electrocardiographic compression sensing method based on an attention mechanism and spatiotemporal fusion proposed in the first embodiment of the present application;

[0044] Figure 3 This is an architecture diagram of the final reconstruction part of the system model MSF-CSNet of the electrocardiographic compressed sensing method based on the attention mechanism and spatiotemporal fusion proposed in the first embodiment of the present application;

[0045] Figure 4 This is a schematic diagram of ECG signal deformation in an ECG compression sensing method based on attention mechanism and spatiotemporal fusion proposed in the first embodiment of the present application;

[0046] Figure 5 A schematic diagram of the structure of an ECG compressed sensing system based on attention mechanism and spatiotemporal fusion proposed in the second embodiment of the present application.

[0047] The following specific implementation methods will further illustrate the present application in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION

[0048] In order to facilitate understanding of the present application, the present application will be described more fully below with reference to the relevant drawings. Several embodiments of the present application are provided in the drawings. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive.

[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0050] In order to illustrate the technical solution described in this application, a specific embodiment is provided below for illustration.

[0051] The first embodiment of the present application proposes an electrocardiogram compression sensing method based on attention mechanism and spatiotemporal fusion, such as Figure 1 FIG. 1 is a flow chart of a method according to a first embodiment. Figure 2 and Figure 3 This is the MSF-CSNet architecture diagram of the system model proposed in this application. Figure 2 This is the architecture diagram of the compression and initial reconstruction part of the system model MSF-CSNet. Figure 3 This is the architecture diagram of the final reconstruction part of the system model MSF-CSNet.

[0052] Step S01: Acquire original ECG signals of multiple leads, preprocess the original ECG signals, and learn weights of ECG signals of different leads through SE blocks.

[0053] It should be noted that before starting compression, this embodiment designs an SE block for learning the weights of ECG signals of different leads, that is, the original ECG signal is input into the global average pooling in the SE block after feature deformation to obtain the initial weight value, and then the weight value is learned and corrected through the convolution layer, and finally the different leads of the original ECG signal are multiplied by the corresponding weight value to obtain the weighted feature map. The specific process is as follows:

[0054] First, the ECG signal is deformed, such as Figure 4 As shown in the figure, in this process, the ECG signal of each lead is taken out and stacked in the dimension of the channel, and the feature map with only one channel is transformed into a feature map with three channels. Indicates that , where C represents the number of channels of the ECG signal before compression, H represents the number of leads of the ECG signal before compression, and W represents the number of sampling points of each lead of the ECG signal before compression;

[0055] Then, the SE block is used to weight the importance of different leads, enhance the ECG signal features of important leads, and suppress the ECG signal features of unimportant leads. Here, in order to improve the learning ability of the SE block, the convolutional layer is used to replace the fully connected layer in the traditional SE block. Compared with the fully connected layer, the convolutional layer has spatial invariance and retains the spatial information of the feature map, thus having better expression ability.

[0056] Finally, the dimension of the ECG signal is restored to its original dimension, that is, the ECG signal is transformed back to the dimension before the deformation operation, that is, ,in Represents a real number.

[0057] Step S02: input the preprocessed original ECG signal into the compression model to obtain a signal compression measurement value.

[0058] It should be noted that a convolutional neural network is used to compress the ECG signal. This compression model contains six layers in total, namely, convolutional layer, nonlinear transformation layer, downsampling layer, convolutional layer, nonlinear transformation layer, and downsampling layer. The convolutional layers all use 3×3 convolution kernels with a step size of 1; the nonlinear transformation layer uses the LeakyReLU function; the downsampling layer is replaced by a convolutional layer. For example, to implement a 3×3 downsampling layer, a 3×3 convolution kernel and a step size of 3 are used to replace the convolutional layer. The size of the convolution kernel of this downsampling layer is reasonably selected according to the actual situation to ensure that the dimension of the lead of the final compressed measurement value is 1. For example, when processing a 15-lead ECG signal, a 3×3 convolution kernel and a step size of 3 are used in the first downsampling layer, and a 5×5 convolution kernel and a step size of 5 are used in the second downsampling layer.

[0059] Specifically, the compression formula of the compression model can be expressed as:

[0060] ,

[0061] in, represents the signal compression measurement value, and are the weight parameters of the first and second convolutional layers respectively. represents the LeakyReLU activation function, s represents the original ECG signal, and Respectively and The pooling layer, j and k represent the size of the pooling window in the pooling layer. Here, j×k is required to be equal to the number of leads of the ECG signal. The requirement in this process is is to ensure that the signal compression measurement is a vector.

[0062] Step S03: performing initial reconstruction on the signal compression measurement value to obtain an initial reconstruction result.

[0063] It should be noted that in the initial reconstruction stage, the main task is to restore the compressed ECG signal to the same dimension as the original signal. This process is similar to the convolutional neural network structure used in the compression stage, but the structure is different. The most important difference is that the upsampling layer is used instead of the downsampling layer in the compression stage.

[0064] The purpose of upsampling is to restore the dimensions of the compressed signal to the dimensions of the original signal by expanding its dimensions for subsequent processing. The upsampling process is achieved through a transposed convolution layer. The transposed convolution layer interpolates and pads the input feature map, thereby expanding it to several times the original dimension. For example, if a transposed convolution layer with a convolution kernel size of 3x3 and a stride of 3 is applied to a compressed measurement of size h×w, the size of the output feature map will be 3h×3w, where h is the number of leads when reconstructing the ECG signal and w is the number of sampling points of each lead ECG signal during reconstruction. This process provides the basis for subsequent signal processing and feature extraction, ensuring that the model can effectively extract useful information from the original signal, allowing the model to further analyze and process it in the original dimension.

[0065] Specifically, the process formula of the initial reconstruction can be expressed as:

[0066] ,

[0067] in, and represents the parameters of the first transposed convolution and the second transposed convolution, Represents the initial reconstruction result, whose size is the same as the original signal same.

[0068] Step S04: Input the initial reconstruction result into the spatiotemporal fusion model, wherein the spatiotemporal fusion model includes a time domain branch and a spatial attention branch improved by Transformer, and obtain a time domain branch reconstructed signal according to the time domain branch, and obtain a spatial attention branch reconstructed signal according to the spatial attention branch improved by Transformer.

[0069] It should be noted that the final reconstruction is to further process the initially reconstructed ECG signal to obtain a more accurate and complete reconstructed signal. At this stage, a spatiotemporal fusion reconstruction method based on the attention mechanism is adopted. First, the network is divided into two branches, one of which is used to extract the temporal features of the ECG signal, called the time domain branch, and the other uses the Transformer to extract the spatial features of the ECG signal while learning the dependencies between ECG signals at different times, called the spatial attention branch. Finally, the features of the two branches are fused to form a spatiotemporal fusion model.

[0070] For example, in the time domain branch, the initially reconstructed ECG signal is firstly transformed into Figure 4The method in is transformed and compressed by one dimension. For example, the size of the feature map obtained by the initial reconstruction is c×h×w, where c is the number of channels of the feature map during reconstruction, h is the number of leads of the ECG signal during reconstruction, and w is the number of sampling points of each lead ECG signal during reconstruction. The feature map is first transformed into a feature map of (c×h)×1×w, and then the dimension is compressed to become a feature map of (c×h)×w. Next, a multi-scale extended convolution fusion block (MDFB block) is designed to extract the time domain features of the ECG signal, such as Figure 3 As shown in the figure, the MDFB block is first a convolution layer, and then it is divided into three branches, where convolution 3, convolution 5, and convolution 7 represent convolution layers with convolution kernels of 3×1, 5×1, and 7×1, respectively. The corresponding part of branch 1 represents the convolution with a dilation factor of 1, the corresponding part of branch 2 represents the convolution layer with a dilation factor of 2, and the corresponding part of branch 3 represents the convolution layer with a dilation factor of 3. Convolution kernels of different scales have different receptive fields, which can fuse the features of ECG signals at different time points. In addition, dilated convolution can capture dependencies over a longer time range without changing the number of parameters, thereby improving the learning ability of the model. The feature maps output by the three branches are then concatenated together, and a convolution layer is used to compress the number of channels of the feature maps. Finally, the dimension and size of the obtained feature map are restored to the same dimension and size as the input of the time domain module.

[0071] Specifically, the process formula for obtaining the time domain branch reconstructed signal according to the time domain branch is:

[0072] ,

[0073] in, represents the time domain branch reconstruction signal, represents the multi-scale extended convolution fusion block, represents the deformation of the feature map, express The reverse operation of .

[0074] In the spatial attention branch, a Transformer architecture with a multi-head mixed attention mechanism is designed, called MA-Transformer (Mixed Attention Transformer). The specific process is as follows Figure 3 shown.

[0075] First, divide the ECG data into square blocks according to the number of leads. Assuming that we want to process the ECG signal of the L lead, we divide the ECG signal into Block , and finally connect the resulting blocks together using The result is then fed into the MA-Transformer. However, before that, we need to consider that the MA-Transformer can only process data in vector form, so we need to The blocks are vectorized to obtain ,use Indicates that it can then be input into the Transformer for training. In addition, a vectorized inverse operation needs to be defined, denoted as In MA-Transformer, the input is first positionally encoded using the following formula , the encoding formula is:

[0076] ,

[0077] in, represents the position in the sequence, represents the index of the feature, Represents the dimension of the input vector, and PE represents the position encoding.

[0078] Then we introduce a learnable scaling factor Scaling to get , which is used to optimize the training process and avoid numerical instability during training. In addition, a multi-head hybrid attention mechanism (MHMA) is designed. First, the attention mechanism is flexibly divided into L heads according to the number of leads L. The calculation process of MHMA is as follows (taking the calculation of Q as an example):

[0079] ;

[0080] in, represents the weight matrix for calculating Q (query), represents Q obtained by multiplying the input by the weight, Represents the vectorized , represents the Q associated with the i-th head, It means that Q is divided according to the number of leads L. After obtaining K (key) and V (value) in the same way, the attention is calculated according to the following formula:

[0081] ,

[0082] in, represents the attention calculated by the i-th head, Indicates multiple attentions, express The transpose of represents the activation function, Represents a splicing operation, represents the hth head, Projection matrix used to compute multi-head attention.

[0083] This improvement uses each lead as an attention head. Each head contains the information of other heads and communicates with information at other locations, which can achieve more complex information interaction between different leads. In addition, this can make the model better adapt to ECG signals with different numbers of leads, flexibly adjust the calculation method of the attention mechanism, and thus optimize the extraction and processing of ECG signal features. In addition, an adaptive threshold processing is applied to the output of the encoder, and the threshold is dynamically adjusted according to the characteristics of the input data. For data with different distributions, the adaptive threshold can better capture and process data features, making the model more adaptable. After obtaining the output of MA-Transformer, after and Processing obtains the output of the spatial attention branch.

[0084] Specifically, the process formula for obtaining the spatial attention branch reconstructed signal according to the spatial attention branch improved by the Transformer is:

[0085] ,

[0086] in, represents the reconstruction signal of the spatial attention branch, represents a Transformer with a multi-head mixed attention mechanism, It means to reassemble the ECG signal into blocks. express The inverse operation of Represents vectorization, express The reverse operation of .

[0087] Step S05: feature fusion of the initial reconstruction result, the time domain branch reconstruction signal and the spatial attention branch reconstruction signal to obtain a final reconstructed signal.

[0088] The outputs of the temporal branch and the spatial attention branch are added together and residually connected with the initial reconstruction result. Finally, the final reconstructed signal is obtained by sequentially passing through the convolutional layer, SE block and convolutional layer.

[0089] Specifically, the initial reconstruction result, the time domain branch reconstruction signal and the spatial attention branch reconstruction signal are feature fused to obtain the final reconstructed signal:

[0090] ,

[0091] in, represents the fusion features of the initial reconstruction result, the time domain branch reconstruction signal, and the spatial attention branch reconstruction signal, represents the final reconstructed signal, represents the weight parameter of the last convolutional layer, Represents SE block.

[0092] In summary, the present application provides an ECG compression sensing method based on attention mechanism and spatiotemporal fusion. The method mainly includes three parts: compression, initial reconstruction and final reconstruction. First, the compression module compresses the signal. Secondly, the dimension of the signal is restored in the initial reconstruction module for subsequent signal processing. Finally, the spatiotemporal fusion module is used to reconstruct the signal details. Specifically, by using the SE block to extract the weights of the ECG signals of different leads, the effective identification and extraction of key information in the ECG signal is achieved, thereby reducing information loss and redundancy; and the self-attention mechanism of the Transformer is used to sequence model the ECG signal to capture the long dependency of the ECG signal; secondly, the spatiotemporal fusion technology is used to combine the time domain and spatial information to achieve multi-dimensional feature characterization of the ECG signal, further improving the characterization ability and compression efficiency of the signal. Therefore, the present application proposes an ECG compression sensing method based on attention mechanism and spatiotemporal fusion. The method can achieve high-quality reconstruction of the signal at a low sampling rate, and can solve the problem that the existing ECG deep compression sensing method is difficult to improve the model processing efficiency and generalization ability while maintaining the signal quality.

[0093] See also Figure 5 , which is a schematic diagram of the structure of an electrocardiographic compressed sensing system based on an attention mechanism and spatiotemporal fusion in one embodiment of the present application, and the system includes:

[0094] A signal preparation module 10 is used to obtain original ECG signals of multiple leads, pre-process the original ECG signals, and learn weights of ECG signals of different leads through SE blocks;

[0095] The signal compression module 20 is used to input the pre-processed original ECG signal into the compression model to obtain the signal compression measurement value;

[0096] An initial reconstruction module 30, used to perform initial reconstruction on the signal compression measurement value to obtain an initial reconstruction result;

[0097] A signal extraction module 40 is used to input the initial reconstruction result into a spatiotemporal fusion model, wherein the spatiotemporal fusion model includes a time domain branch and a spatial attention branch improved by Transformer, obtain a time domain branch reconstructed signal according to the time domain branch, and obtain a spatial attention branch reconstructed signal according to the spatial attention branch improved by Transformer;

[0098] The deep reconstruction module 50 is used to perform feature fusion on the initial reconstruction result, the time domain branch reconstruction signal and the spatial attention branch reconstruction signal to obtain a final reconstructed signal.

[0099] On the other hand, the present application also proposes a computer device, which includes a memory, a processor, and a processing program stored in the memory and executable on the processor, and the processing program, when executed by the processor, implements the above-mentioned ECG compressed sensing method based on attention mechanism and spatiotemporal fusion.

[0100] A computer-readable storage medium having a processing program stored thereon, wherein the processing program is executed by a processor to execute the above-mentioned electrocardiographic compressed sensing method based on an attention mechanism and spatiotemporal fusion.

[0101] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0102] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. An electrocardiogram compressed sensing method based on attention mechanism and spatiotemporal fusion, characterized in that: The method comprises: Acquire original ECG signals of multiple leads, preprocess the original ECG signals, and learn weights of ECG signals of different leads through an SE block, wherein a convolutional layer is introduced into the SE block, and the convolutional layer replaces the fully connected layer in the traditional SE block; The preprocessed original ECG signal is input into the compression model to obtain the signal compression measurement value; Performing initial reconstruction on the signal compression measurement value to obtain an initial reconstruction result; Inputting the initial reconstruction result into a spatiotemporal fusion model, the spatiotemporal fusion model comprising a time domain branch and a spatial attention branch improved by Transformer, obtaining a time domain branch reconstruction signal according to the time domain branch, and obtaining a spatial attention branch reconstruction signal according to the spatial attention branch improved by Transformer; The time domain branch includes a multi-scale extended convolution fusion block MDFB, and the MDFB is used to extract the time domain features of the electrocardiogram signal; The improved spatial attention branch of Transformer includes the Transformer architecture MA-Transformer of multi-head hybrid attention mechanism, and the specific improvement process includes: First, divide the ECG data into square blocks according to the number of leads. Assuming that we want to process the ECG signal of the L lead, we divide the ECG signal into Block , and finally connect the resulting blocks together using Representation; then the result is input into MA-Transformer, but before that, it should be considered that MA-Transformer can only process data in vector form, so it is necessary to The blocks are vectorized to obtain ,use Indicates that it can then be input into the Transformer for training. In addition, a vectorized inverse operation needs to be defined, denoted as ; In MA-Transformer, the input is first positionally encoded using the following formula , the encoding formula is: , in, represents the position in the sequence, represents the index of the feature, Represents the dimension of the input vector, PE represents the position encoding; Then we introduce a learnable scaling factor Scaling to get , which is used to optimize the training process and avoid numerical instability during the training process; in addition, a multi-head hybrid attention mechanism MHMA is designed. First, the attention mechanism is divided into L heads according to the number of leads L. The calculation process of MHMA is as follows: ; in, represents the weight matrix for calculating Q, represents Q obtained by multiplying the input by the weight, Represents the vectorized , represents the Q associated with the i-th head, It means that Q is divided according to the number of leads L; after obtaining K and V in the same way, the attention is calculated according to the following formula: , in, represents the attention calculated by the i-th head, Indicates multiple attentions, express The transpose of represents the activation function, Represents a splicing operation, represents the hth head, Projection matrix for computing multi-head attention; The initial reconstruction result, the time domain branch reconstruction signal and the spatial attention branch reconstruction signal are feature fused to obtain a final reconstructed signal.

2. The ECG compression sensing method according to claim 1, characterized in that: The step of learning the weights of ECG signals of different leads by SE blocks includes: After feature deformation, the original ECG signal is input into the global average pooling in the SE block to obtain the initial weight value, and then the weight value is learned and corrected through the convolution layer. Finally, different leads of the original ECG signal are multiplied by the corresponding weight value to obtain the weighted feature map.

3. The ECG compression sensing method according to claim 1, characterized in that: The compression formula of the compression model is: , in, represents the signal compression measurement value, and are the weight parameters of the first and second convolutional layers respectively. represents the LeakyReLU activation function, s represents the original ECG signal, and Respectively and The pooling layer of , j and k represent the size of the pooling window in the pooling layer.

4. The ECG compression sensing method according to claim 3, characterized in that: The process formula of the initial reconstruction is: , in, and represents the parameters of the first transposed convolution and the second transposed convolution, Represents the initial reconstruction result.

5. The ECG compression sensing method according to claim 4, characterized in that: The process formula of obtaining the time domain branch reconstructed signal according to the time domain branch is: , in, represents the time domain branch reconstruction signal, represents the multi-scale extended convolution fusion block, represents the deformation of the feature map, express The reverse operation of .

6. The ECG compression sensing method according to claim 5, characterized in that: According to the improved spatial attention branch of Transformer, the process formula of obtaining the spatial attention branch reconstructed signal is: , in, represents the reconstruction signal of the spatial attention branch, represents a Transformer with a multi-head mixed attention mechanism, It means to reassemble the ECG signal into blocks. express The inverse operation of Represents vectorization, express The reverse operation of .

7. The ECG compression sensing method according to claim 6, characterized in that: The process formula for performing feature fusion on the initial reconstruction result, the time domain branch reconstruction signal and the spatial attention branch reconstruction signal to obtain the final reconstructed signal is: , in, represents the fusion features of the initial reconstruction result, the time domain branch reconstruction signal, and the spatial attention branch reconstruction signal, represents the final reconstructed signal, represents the weight parameter of the last convolutional layer, Represents a SE block.

8. An electrocardiogram compression sensing system based on attention mechanism and spatiotemporal fusion, characterized in that: The system comprises: A signal preparation module, used for acquiring original ECG signals of multiple leads, preprocessing the original ECG signals, and learning weights of ECG signals of different leads through an SE block, wherein a convolutional layer is introduced into the SE block, and the convolutional layer replaces the fully connected layer in the traditional SE block; A signal compression module is used to input the preprocessed original ECG signal into the compression model to obtain a signal compression measurement value; An initial reconstruction module, used to perform initial reconstruction on the signal compression measurement value to obtain an initial reconstruction result; The signal extraction module is used to input the initial reconstruction result into the spatiotemporal fusion model, wherein the spatiotemporal fusion model includes a time domain branch and a spatial attention branch improved by Transformer, and the time domain branch reconstructed signal is obtained according to the time domain branch, and the spatial attention branch reconstructed signal is obtained according to the spatial attention branch improved by Transformer; the time domain branch includes a multi-scale extended convolution fusion block MDFB, and the MDFB is used to extract the time domain features of the ECG signal; the spatial attention branch improved by Transformer includes a Transformer architecture MA-Transformer of a multi-head hybrid attention mechanism, and the specific improvement process includes: First, divide the ECG data into square blocks according to the number of leads. Assuming that we want to process the ECG signal of the L lead, we divide the ECG signal into Block , and finally connect the resulting blocks together using Representation; then the result is input into MA-Transformer, but before that, it should be considered that MA-Transformer can only process data in vector form, so it is necessary to The blocks are vectorized to obtain ,use Indicates that it can then be input into the Transformer for training. In addition, a vectorized inverse operation needs to be defined, denoted as ; In MA-Transformer, the input is first positionally encoded using the following formula , the encoding formula is: , in, represents the position in the sequence, represents the index of the feature, Represents the dimension of the input vector, PE represents the position encoding; Then we introduce a learnable scaling factor Scaling to get , which is used to optimize the training process and avoid numerical instability during the training process; in addition, a multi-head hybrid attention mechanism MHMA is designed. First, the attention mechanism is divided into L heads according to the number of leads L. The calculation process of MHMA is as follows: ; in, represents the weight matrix for calculating Q, represents Q obtained by multiplying the input by the weight, Represents the vectorized , represents the Q associated with the i-th head, It means that Q is divided according to the number of leads L; after obtaining K and V in the same way, the attention is calculated according to the following formula: , in, represents the attention calculated by the i-th head, Indicates multiple attentions, express The transpose of represents the activation function, Represents a splicing operation, represents the hth head, Projection matrix for computing multi-head attention; The deep reconstruction module is used to perform feature fusion on the initial reconstruction result, the time domain branch reconstruction signal and the spatial attention branch reconstruction signal to obtain a final reconstructed signal.

9. A computer device, characterized in that: The computer device includes a memory, a processor, and a processing program stored in the memory and executable on the processor. When the processing program is executed by the processor, the electrocardiographic compression sensing method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a processing program, and when the processing program is executed by a processor, the ECG compression sensing method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Electrocardiosignal processing method and system for atrial fibrillation recognition

    CN115363599A

  • Electrocardiosignal depth compressed sensing method

    CN115399780A

  • Noninvasive myocardial transmembrane potential reconstruction and abnormal point positioning method

    CN115530841A

  • Multi-label electrocardiosignal classification method based on improved attention mechanism

    CN116226763A

  • Lightweight convolutional neural network and Transform fusion-based arrhythmia detection method

    CN116369933A