ECG signal segmentation method based on MU-Net
By adopting a MU-Net-based method in ECG signal analysis, combining Mamba and U-Net architectures to extract the spatiotemporal characteristics of ECG signals, the problems of insufficient accuracy and poor robustness of QRS wave group and R peak detection in the prior art are solved, and high-precision ECG signal segmentation and R peak recognition are achieved.
Patent Information
- Application Number
- CN202510060595.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-05-13
AI Technical Summary
The existing ECG signal analysis methods have problems of insufficient accuracy and poor robustness in accurately detecting QRS wave groups and R peaks, which are difficult to meet the needs of practical applications.
The MU-Net-based ECG signal segmentation method is adopted, combined with Mamba and U-Net architectures, the local shallow features of the ECG signal are gradually extracted through convolution blocks, and the global deep features are extracted using the Mamba module, and the jump connection is used to enhance feature reuse to achieve accurate detection of QRS wave groups and R peaks.
The accuracy of the ECG signal segmentation task is improved, the accurate identification and positioning of R peaks is achieved, the ability to mine key spatiotemporal characteristics of QRS wave groups from ECG signals is enhanced, and the accuracy and stability of detection is improved.
Smart Images

Figure CN119970059A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of ECG signal segmentation, and in particular to an ECG signal segmentation method based on MU-Net. Background Art
[0002] In the diagnosis of cardiovascular diseases, the electrocardiogram (ECG) is a very important biological signal. The ECG signal is an important bioelectric signal that reflects the electrical activity of the heart. Its waveform characteristics are of great significance for the diagnosis, prevention and treatment of heart disease. Its basic waveforms include P wave, QRS complex and T wave, among which P wave represents the depolarization of the atrium, QRS complex represents the depolarization of the ventricle, and T wave represents the repolarization of the ventricle. The changes in these waveforms can reflect the electrophysiological activity of the heart and provide a scientific basis for the diagnosis and treatment of heart diseases.
[0003] The QRS complex is one of the most significant waveform features in the ECG signal, which records the change of the potential of the left and right ventricles over time during the depolarization process. As a key part of the QRS complex, the R peak is highly recognizable, and its position and height are crucial to the assessment of the health status of the heart. Therefore, accurately detecting the QRS wave and R peak in the ECG signal is a key step in realizing the automatic diagnosis and prevention of heart disease and the analysis of heart rate variability.
[0004] Among the different waveforms of ECG signals, the QRS complex is the most typical waveform with unique morphological characteristics and low similarity with other waveforms. Most existing ECG signal analysis methods segment heartbeats according to the position of the R peak in the QRS band. However, the R peak position information is not directly given in the original ECG signal. Therefore, before analyzing the ECG signal, it is necessary to accurately identify the QRS complex and the R peak position. The existing QRS complex and R peak detection methods can be mainly divided into traditional threshold methods and deep learning (DL) methods. The processing process of the traditional threshold method mainly includes denoising the ECG signal, enhancing the QRS complex, and identifying the R peak position by threshold determination. However, the traditional threshold method requires specific steps to suppress the interference of T waves and P waves, depending on the selection of multiple thresholds. In addition, these methods require "error detection" and "missing detection" mechanisms to accurately locate the R peak. In addition, in complex scenarios (e.g., different patients, different equipment, high noise, etc.), these mechanisms lead to poor adaptability and difficulty in implementing ECG signal processing algorithms, resulting in low accuracy.
[0005] Although deep learning methods have made progress in detection accuracy, real-time, applicability, standardization and repeatability, the following problems still exist: dependence on large-scale data sets and high computing resources, complexity and time consumption of model training, and unstable detection performance in certain special ECG or noisy environments.
[0006] Therefore, due to the complexity of ECG signal waveform and the presence of various types of noise, such as baseline drift, power frequency interference, etc., the detection of QRS complex and R peak faces many challenges. Although the existing ECG R peak detection algorithm has improved the detection accuracy to a certain extent, it still has problems such as insufficient accuracy and poor robustness, which makes it difficult to meet the needs of practical applications. Summary of the invention
[0007] In view of the shortcomings of the prior art, the present invention provides an ECG signal segmentation method based on MU-Net. The present invention combines Mamba and U-Net architectures to accurately extract the spatiotemporal feature information of the ECG signal from the ECG signal, accurately detect the QRS complex and R peak, gradually extract the local shallow features of the ECG signal through the convolution block, and use the Mamba module to extract the global deep features, and use jump connections to enhance feature reuse.
[0008] The technical solution of the present invention is: an ECG signal segmentation method based on MU-Net, comprising the following steps:
[0009] S1), collect ECG signals and perform preprocessing;
[0010] S2), constructing a MU-Net signal segmentation model based on Mamba and U-Net; and using the training set to train the MU-Net signal segmentation model;
[0011] S3) Use the MU-Net signal segmentation model to downsample and upsample the ECG signal, and use jump connections to fuse the features between different levels extracted by the downsampling and upsampling operations; and obtain the classification probability by fusing the features to achieve QRS complex detection and R peak positioning.
[0012] Preferably, in step S2), the MU-Net signal segmentation model includes an encoder and a decoder, and the encoder and the decoder are jump-connected through a residual path block, and the residual path block is used to nonlinearly change the low-level features transmitted from the encoder and fuse them with the high-level features in the decoder.
[0013] Preferably, in step S2), the encoder and decoder both use 6 network layers; wherein, the first 3 network layers of the encoder use 1D convolution blocks; the last 3 network layers of the encoder use Mamba blocks; the 6th to 4th network layers of the decoder use Mamba blocks; the 3rd to 1st network layers of the decoder use convolution blocks, and the input of each layer of the decoder is a fusion of the output features of the previous layer and the corresponding jump connection output features.
[0014] Preferably, in step S2), the residual path block is composed of superposition of CNNs of different sizes.
[0015] Preferably, in step S2), the 1D convolution block of the encoder consists of a 1D convolution layer Conv1d, a batch normalization layer BN, a pooling layer and a ReLU activation layer, the 1D convolution layer Conv1d is used to extract time domain features from ECG signals and capture local patterns; the batch normalization layer BN improves the training speed and stability of the model by normalizing the input data; the ReLU activation layer introduces nonlinear features to enhance the expressive power of the model.
[0016] Preferably, in step S2), the 1D convolution block of the decoder is composed of a 1D convolution layer Conv1d, a batch normalization layer BN, a linear interpolation layer and an activation layer. The linear interpolation layer can increase the dimension of the feature, and the functions of the other layers are consistent with those of the corresponding layers of the decoder.
[0017] Preferably, in step S2), the Mamba block includes a linear projection layer, a state space model layer SSM, and a multilayer perceptron MLP; in the Mamba block, the input data transmits feature information through two paths, one of which is linearly transformed through the linear projection layer, and then converted to a new space through a 1D convolution layer Conv1d and a nonlinear activation function Swith; then it is sent to the state space model layer SSM for state update; the other path transmits features through a skip path, the input data extracts features through a residual connection, and then is fused with the features output by the state space model layer SSM; finally, the fused features generate an output sequence through a linear projection layer.
[0018] Preferably, in step S2), the decoder decodes the spatial and temporal features of the ECG signal through a convolution block, a Mamba block and a residual path block; and completes QRS complex detection through a sigmoid function to generate the probability of a QRS complex at each point.
[0019] Preferably, in step S2), the MU-Net signal segmentation model is trained using the training set, specifically:
[0020] S21), initializing model threshold T1, QRS complex duration threshold T2, RR interval threshold T3;
[0021] S22), using the training set to train the MU-Net signal segmentation model, and comparing the R-peak position predicted by the MU-Net signal segmentation model with the R-peak position of the actual mark; calculating the number of correctly marked heartbeats;
[0022] S23), adjust the values of thresholds T1, T2, and T3 between 0-1 with a step size of 0.1. After each adjustment, repeat step S22), and record the number of correctly marked heartbeats; when the number of correctly marked heartbeats reaches the maximum value, stop adjusting; and record the values of thresholds T1, T2, and T3 at this time as the optimal thresholds.
[0023] Preferably, in step S3), the ECG signal is downsampled by the encoder to extract shallow features and deep features of the ECG signal.
[0024] Preferably, in step S3), the decoder extracts long-range dependency information through an upsampling operation, and determines key features from the long-range dependency information.
[0025] Preferably, in step S3), the R peak positioning is specifically as follows:
[0026] S31), inputting the ECG signal into the MU-Net signal segmentation model, the MU-Net signal segmentation model gradually extracts features and restores the spatial information of the signal through an encoder and a decoder;
[0027] S32), based on the model threshold T1, determine whether the output of the MU-Net signal segmentation model is 1 or 0;
[0028] Some parts of the QRS complex have a value of 1, and others have a value of 0;
[0029] S33), the R peak is the point with the largest amplitude in the QRS complex, the position of the QRS complex is extracted from the output of the mask, the original position of the signal is located, and the maximum amplitude point of the R peak is found;
[0030] S34), determining the width of the effective R peak based on the QRS complex duration threshold T2, and then determining the R peak;
[0031] S35), based on the RR interval threshold T3, determine the set of R peaks.
[0032] The beneficial effects of the present invention are:
[0033] 1. By combining Mamba and U-Net architecture, the present invention can effectively extract key spatiotemporal features reflecting the QRS complex from ECG signals, while paying attention to local details and global structures, thereby improving the accuracy of ECG signal segmentation tasks and achieving accurate identification and positioning of the R peak.
[0034] 2. The present invention significantly enhances the ability to mine key spatiotemporal features that depict the QRS complex from ECG signals. Mamba can process long-range dependent information and has low computational complexity. Combined with the precise segmentation characteristics of U-Net, it can deeply analyze ECG signals and accurately capture and extract those subtle changes that reflect cardiac electrophysiological activity, especially the key information in the QRS complex.
[0035] 3. The present invention not only achieves high-precision segmentation of ECG signals, but also greatly improves the accuracy and stability of R-peak recognition; and the MU-Net network of the present invention adopts a U-shaped network structure and a jump connection mechanism, which can effectively capture feature information at different levels, thereby improving the accuracy of ECG signal segmentation and detail retention capabilities;
[0036] 4. The MU-Net of the present invention adopts Mamba design to significantly reduce network parameters, so that the network can maintain high performance while significantly reducing computing costs and storage requirements. It can be embedded in smart wearable devices to achieve ECG signal segmentation on edge devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a schematic diagram of the process of the present invention;
[0038] Figure 2 It is a structural framework diagram of the MU-Net signal segmentation model of the present invention;
[0039] Figure 3 It is a structural framework diagram of the 1D convolution block of the present invention;
[0040] Figure 4 It is a structural block diagram of the Mamba block of the present invention. DETAILED DESCRIPTION
[0041] The specific implementation of the present invention will be further described below in conjunction with the accompanying drawings:
[0042] like Figure 1 As shown, this embodiment provides an ECG signal segmentation method based on MU-Net, comprising the following steps:
[0043] S1), collect ECG signals and perform preprocessing;
[0044] In this embodiment, an electrocardiogram device is used to collect ECG signals, wherein the collected ECG signals include normal and arrhythmia ECG signals, and the data sampling frequency is 360 Hz. Then, the collected ECG signals are preprocessed, specifically:
[0045] In this embodiment, the collected ECG signal is filtered to remove noise and interference and improve signal quality; then, standardization processing is performed, such as amplitude normalization; finally, the label is expanded to construct a data set D.
[0046] In this embodiment, the filtering process is specifically as follows:
[0047] S111), using db8 wavelet basis to decompose the ECG signal into nine components D1-D8 and A9 with different frequencies;
[0048] S112), set D1, D2, D8 and A9 components to 0; retain signal components with frequencies higher than 1.40625 Hz and lower than 45 Hz;
[0049] S113), performing inverse wavelet transform on the selected signal components to obtain a denoised ECG signal.
[0050] In this embodiment, the extended label is specifically: the duration of the QRS complex of the ECG signal is 0.06 to 0.1 seconds in most cases. A QRS complex is set to be composed of 30 sampling points, the original label is the center point (i.e., R peak), 14 sampling points are in the front, 15 sampling points are in the back, marked as 1, and other non-QRS complex sampling points are marked as 0.
[0051] The total sampling points of the ECG signal in this embodiment are 650,000 1D sequences, which are divided into 130 segments on average, each segment has 5,000 sample points. Each segment is used as the input of the model, and the output is a set of 5,000 × 1 probability values, each value representing the probability of a sampling point in the QRS complex.
[0052] S2), constructing a MU-Net signal segmentation model based on Mamba and U-Net; and using the training set to train the MU-Net signal segmentation model;
[0053] In this embodiment, Figure 2 As shown, the MU-Net signal segmentation model includes an encoder and a decoder, and the encoder and the decoder are jump-connected through a residual path block. The residual path block is used to nonlinearly change the low-level features transmitted from the encoder and fuse them with the high-level features in the decoder.
[0054] In this embodiment, the encoder and decoder both use 6 network layers; the first 3 network layers of the encoder use 1D convolution blocks; the last 3 network layers of the encoder use Mamba blocks; the 6th to 4th network layers of the decoder use Mamba blocks; the 3rd to 1st network layers of the decoder use convolution blocks, and the input of each layer of the decoder is a fusion of the output features of the previous layer and the corresponding jump connection output features.
[0055] Among them, the ECG signal X is used as the input of the 1D convolution block of the first network layer of the encoder, and the 1D convolution block of the first network layer outputs the feature Then the feature They are respectively used as the input of the 1D convolution block of the first network layer and the first residual path block; they are processed by multiple 1D convolution blocks and Mamba blocks in sequence.
[0056] In this embodiment, the Mamba block of the sixth layer of the decoder is based on the output characteristics of the Mamba block of the sixth network layer of the encoder. and the output features of the sixth residual path block The fusion of is taken as input; then the Mamba block of the 5th layer of the decoder uses the output features of the Mamba block of the 6th layer of the decoder and the output features of the 5th residual path block As input, and so on, it is finally processed by the 1D convolution block of the first layer of the decoder and output.
[0057] The decoder decodes the spatial and temporal features of the ECG signal through convolution blocks, Mamba blocks and residual path blocks; and completes QRS wave group detection through a sigmoid function to generate the probability of the QRS wave group at each point.
[0058] In this embodiment, the residual path block is composed of 3×1 and 1×1 CNN superposition.
[0059] In this embodiment, Figure 3 As shown, the 1D convolution block of the encoder consists of a 1D convolution layer Conv1d, a batch normalization layer BN, a pooling layer and a ReLU activation layer. The 1D convolution layer Conv1d is used to extract time domain features from ECG signals and capture local patterns; the batch normalization layer BN improves the training speed and stability of the model by normalizing the input data; the ReLU activation layer introduces nonlinear features to enhance the expressiveness of the model. The 1D convolution block of the decoder consists of a 1D convolution layer Conv1d, a batch normalization layer BN, a linear interpolation layer and an activation layer. The linear interpolation layer can increase the dimension of the features, and the functions of the other layers are consistent with those of the corresponding layers of the decoder.
[0060] In this embodiment, Figure 4As shown, the Mamba block includes a linear projection layer, a state space model layer SSM, and a multilayer perceptron MLP; in the Mamba block, the input data transmits feature information through two paths, one of which is linearly transformed through the linear projection layer, and then converted to a new space through a 1D convolution layer Conv1d and a nonlinear activation function Swith; then it is sent to the state space model layer SSM for state update; the other path is to transmit features through a skip path, the input data extracts features through a residual connection, and then is fused with the features output by the state space model layer SSM; finally, the fused features generate an output sequence through a linear projection layer.
[0061] As a preferred embodiment of this embodiment, this embodiment uses a training set to train a MU-Net signal segmentation model, specifically:
[0062] S21), initializing model threshold T1, QRS complex duration threshold T2, RR interval threshold T3;
[0063] S22), using the training set to train the MU-Net signal segmentation model, and comparing the R-peak position predicted by the MU-Net signal segmentation model with the R-peak position of the actual mark; calculating the number of correctly marked heartbeats;
[0064] S23), adjust the values of thresholds T1, T2, and T3 between 0-1 with a step size of 0.1. After each adjustment, repeat step S22), and record the number of correctly marked heartbeats; when the number of correctly marked heartbeats reaches the maximum value, stop adjusting; and record the values of thresholds T1, T2, and T3 at this time as the optimal thresholds.
[0065] In the training phase, this embodiment uses a cross entropy loss function to optimize model parameters so that the model can accurately identify and locate the QRS complex and R peak. In the evaluation phase, indicators such as accuracy, recall, and F1 score are used to measure the performance of the model.
[0066] S3) Use the MU-Net signal segmentation model to downsample and upsample the ECG signal, and use jump connections to fuse the features between different levels extracted by the downsampling and upsampling operations; and obtain the classification probability by fusing the features to achieve QRS complex detection and R peak positioning. The specific process is shown as follows S31) Encoder downsampling operation:
[0067] S311), the one-dimensional ECG signal is used as the input of the convolutional block of the first layer of the encoder;
[0068] S312), the convolution block of the first layer of the encoder first performs a convolution operation (the convolution kernel is 5×1), then performs batch normalization, and finally passes through a maximum pooling layer (the pooling kernel is 2) and an activation function Relu, and outputs the feature f ec1 ;
[0069] S313), the convolutional block of the second layer of the encoder converts f ec1 As input, it first performs a convolution operation (the convolution kernel is k2×1), then performs batch normalization, and finally passes through a maximum pooling layer (the pooling kernel is 2) and an activation function Relu, and outputs the feature f ec2 ;
[0070] S314), the convolutional block of the third layer of the encoder converts f ec2 As input, it first performs a convolution operation (the convolution kernel is k3×1), then performs batch normalization, and finally passes through a maximum pooling layer (the pooling kernel is 2) and an activation function Relu, and outputs the feature f ec3 ;
[0071] S315), the Mamba block of the fourth layer of the encoder will f ec3 As input, feature information is transmitted through two paths, one path passes through the linear projection layer to f ec3 It is linearly transformed, then passes through a 1D convolution layer Convld and an activation function Swith; then it is sent to the state space model layer SSM for state update; another line converts f ec3 The features are extracted through a residual connection and then fused with the features output by SSM; finally, the fused features are passed through a linear projection layer to generate the output sequence f em1 ;
[0072] S316), the Mamba block of the fifth layer of the encoder will f em1 As input, the same operation process as the Mamba block in the fourth layer of the encoder is performed, and the output is f em2 ;
[0073] S317), the Mamba block of the sixth layer of the encoder will f em2 As input, the same operation process as the Mamba block in the fourth layer of the encoder is performed, and the output is f em3 ;
[0074] S32), MU-Net residual connection
[0075] 1) Feature f ec1 As the input of the first residual path block, the output feature f r1;
[0076] 2) Feature f ec2 As the input of the second residual path block, the output feature f r2 ;
[0077] 3) Feature f ec3 As the input of the third residual path block, the output feature f r3 ;
[0078] 4) Feature f ec4 As the input of the fourth residual path block, the output feature f r4 ;
[0079] 5) Feature f ec5 As the input of the fifth residual path block, the output feature f r5 .
[0080] S33), decoder upsampling operation
[0081] S331), feature f ec6 As the input of the Mamba block in the sixth layer of the decoder, the output feature f dm1 ;
[0082] S332), feature f r5 and feature f dm1 Add the features f by element r5dm1 , f r5dm1 As the input of the Mamba block in the fifth layer of the decoder, the output feature f dm2 ;
[0083] S333), feature f r4 and feature f dm2 Add the features f by element r4dm2 , f r4dm2 As the input of the Mamba block in the fourth layer of the decoder, the output feature f dm3 ;
[0084] S334), feature f r3 and feature f dm3 Add the features f by element r3dm3 , f r3dm3 As the input of the convolutional block of the third layer of the decoder, it is upsampled by linear interpolation before passing through the activation function, and the output feature f dc1 ;
[0085] S335), feature f r2 and feature f dc1 Add the features f by element r2dc1 , f r2dc1As the input of the convolutional block of the second layer of the decoder, it is upsampled by linear interpolation before passing through the activation function, and the output feature f dc2 ;
[0086] S336), feature f r1 and feature f dc2 Add the features f by element r1dc2 , f r1dc2 As the input of the convolutional block of the first layer of the decoder, the probability value of each ECG point is output;
[0087] In this embodiment, the ECG signal is downsampled by the encoder. The encoder of this embodiment extracts the shallow features f of the ECG signal through three layers of 1D convolution blocks. ec1 、f ec2 and f ec3 Then, the deep features f are extracted through 3 layers of Mamba blocks. em1 、f em2 and f em3 .
[0088] The skip connection connects the output features f of different stages of the encoder ec1 、f ec2 、f ec3 、f em1 、f em2 and f em3 The corresponding stage models are passed to the decoder respectively;
[0089] During the upsampling operation, the decoder extracts the long-range dependency information f through three Mamba blocks. dm1 、f dm2 and f dm3 , and then obtain the key features f through two 1D convolution blocks respectively dc1 、f dc2 , and finally the probability value of each ECG point is output through the decoder convolution block 3.
[0090] In this embodiment, the R peak positioning specifically includes the following steps:
[0091] 1) Each input segment is an ECG signal of 1000x 1. The MU-Net signal segmentation model gradually extracts features and restores the spatial information of the signal through the encoder and decoder;
[0092] 2) The MU-Net signal segmentation model outputs a mask of the same length as the input signal. Each value of the mask indicates whether the position is part of the QRS complex, where some values of the QRS complex are 1 and the other parts are 0;
[0093] 3) QRS complex extraction: perform thresholding on the output mask, the part greater than 0.5 is 1, the part less than 0.5 is 0, and the continuous 1 area is extracted to represent the QRS complex;
[0094] 4) Positioning of R peak: R peak is the point with the largest amplitude in the QRS complex. The position of the QRS complex is extracted from the output of the mask, located at the original position of the signal, and the maximum amplitude point of the R peak is found;
[0095] 5) Determine the width of the effective R peak based on the QRS complex duration threshold value T2=60ms, and then determine the R peak;
[0096] 6) Based on the RR interval threshold T3 = 200 ms, determine the set of R peaks.
[0097] This embodiment is verified on the MITDB data set, and the method of this embodiment can perform excellently in the task of locating the QRS complex and R peak of ECG signals, with an overall accuracy rate of 99.98%.
[0098] The above embodiments and descriptions are only for illustrating the principles and best embodiments of the present invention. Without departing from the spirit and scope of the present invention, the present invention may be subject to various changes and improvements, all of which fall within the scope of the present invention to be protected.
Claims
1. A method for segmenting ECG signals based on MU-Net, characterized in that: The steps include: S1), collect ECG signals and perform preprocessing; S2), constructing a MU-Net signal segmentation model based on Mamba and U-Net; and using the training set to train the MU-Net signal segmentation model; S3), using the MU-Net signal segmentation model to downsample and upsample the ECG signal, and using skip connections to fuse features between different levels extracted by the downsampling and upsampling operations; And by fusing features, the classification probability is obtained to achieve QRS complex detection and R peak positioning.
2. The ECG signal segmentation method based on MU-Net according to claim 1, characterized in that: In step S2), the MU-Net signal segmentation model includes an encoder and a decoder, and the encoder and the decoder are jump-connected through a residual path block. The residual path block is used to nonlinearly change the low-level features transmitted from the encoder and fuse them with the high-level features in the decoder.
3. The ECG signal segmentation method based on MU-Net according to claim 2, characterized in that: In step S2), the encoder and decoder both use 6 network layers; wherein, the first 3 network layers of the encoder use 1D convolution blocks; the last 3 network layers of the encoder use Mamba blocks; the 6th to 4th network layers of the decoder use Mamba blocks; the 3rd to 1st network layers of the decoder use convolution blocks, and the input of each layer of the decoder is a fusion of the output features of the previous layer and the corresponding jump connection output features.
4. The ECG signal segmentation method based on MU-Net according to claim 3, characterized in that: In step S2), the decoder decodes the spatial and temporal features of the ECG signal through a convolution block, a Mamba block and a residual path block; The QRS complex detection is completed through the sigmoid function to generate the probability of the QRS complex at each point.
5. The ECG signal segmentation method based on MU-Net according to claim 3, characterized in that: In step S2), the residual path block is composed of CNNs of different sizes superimposed.
6. The ECG signal segmentation method based on MU-Net according to claim 3, characterized in that: In step S2), the 1D convolution block of the encoder consists of a 1D convolution layer Conv1d, a batch normalization layer BN, a pooling layer and a ReLU activation layer; The 1D convolution block of the decoder consists of a 1D convolution layer Conv1d, a batch normalization layer BN, a linear interpolation layer and an activation layer.
7. The ECG signal segmentation method based on MU-Net according to claim 3, characterized in that: In step S2), the Mamba block includes a linear projection layer, a state space model layer SSM, and a multilayer perceptron MLP; in the Mamba block, the input data transmits feature information through two paths, one of which is linearly transformed through the linear projection layer, and then converted to a new space through a 1D convolution layer Conv1d and a nonlinear activation function Swith; then it is sent to the state space model layer SSM for state update; the other path is to transmit features through a skip path, the input data extracts features through a residual connection, and then is fused with the features output by the state space model layer SSM; finally, the fused features are used to generate an output sequence through a linear projection layer.
8. The ECG signal segmentation method based on MU-Net according to claim 3, characterized in that: In step S2), the MU-Net signal segmentation model is trained using the training set, specifically: S21), initializing model threshold T1, QRS complex duration threshold T2, RR interval threshold T3; S22), using the training set to train the MU-Net signal segmentation model, and comparing the R-peak position predicted by the MU-Net signal segmentation model with the R-peak position of the actual mark; calculating the number of correctly marked heartbeats; S23), adjust the values of thresholds T1, T2, and T3 between 0-1 with a step size of 0.
1. After each adjustment, repeat step S22), and record the number of correctly marked heartbeats; when the number of correctly marked heartbeats reaches the maximum value, stop adjusting; and record the values of thresholds T1, T2, and T3 at this time as the optimal thresholds.
9. The ECG signal segmentation method based on MU-Net according to claim 1, characterized in that: In step S3), the encoder performs a downsampling operation on the ECG signal, extracts shallow features of the ECG signal through 3 layers of 1D convolution blocks, and then extracts deep features through 3 layers of Mamba blocks; During the upsampling operation, the decoder extracts long-range dependency information through three Mamba blocks and then determines key features through three 1D convolution blocks.
10. The ECG signal segmentation method based on MU-Net according to claim 1, characterized in that: In step S3), the R peak positioning is specifically as follows: S31), inputting the ECG signal into the MU-Net signal segmentation model, the MU-Net signal segmentation model gradually extracts features and restores the spatial information of the signal through an encoder and a decoder; S32), based on the model threshold T1, determine whether the output of the MU-Net signal segmentation model is 1 or 0; wherein some values of the QRS complex are 1 and other values are 0; S33), the R peak is the point with the largest amplitude in the QRS complex, the position of the QRS complex is extracted from the output of the mask, the original position of the signal is located, and the maximum amplitude point of the R peak is found; S34), determining the width of the effective R peak based on the QRS complex duration threshold T2, and then determining the R peak; S35), based on the RR interval threshold T3, determine the set of R peaks.