Physiological signal fragment analysis method based on adaptive bidirectional selection state space
Through the physiological signal fragment analysis method of adaptive bidirectional selection state space, combined with the deep residual shrinking network and multi-scale efficient aggregation block, the problems of low electrical signal processing efficiency and high computing resource consumption in the existing technology center are solved, and high accuracy is achieved degree of obstructive sleep apnea detection.
Patent Information
- Application Number
- CN202411422101.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2025-01-14
AI Technical Summary
The existing obstructive sleep apnea detection methods rely on electrocardiogram signals, and traditional machine learning is inefficient. Deep learning models such as CNN and Transformer are insufficient in dealing with long-term and environmental noise, and the computing resource consumption is high, making it difficult to find resources. Application in restricted environments.
Using a physiological signal fragment analysis method based on adaptive bidirectional selection state space, a multi-scale feature extraction module, a context encoder module and a classification module are used to combine the deep residual shrinking network, a multi-scale efficient aggregation block and an adaptive bidirectional selection state space model. , optimize network models to improve detection accuracy.
It improves the detection accuracy of obstructive sleep apnea events, reduces the computational complexity, is suitable for resource-constrained environments, and effectively deals with noise, improving classification accuracy.
Smart Images

Figure CN119302668A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of medical physiological signal processing, and relates to a physiological signal segment analysis method based on an adaptive bidirectional selection state space. Background Art
[0002] Obstructive sleep apnea (OSA) is a common sleep disorder caused by upper airway obstruction, which may lead to oxygen deficiency and increase the risk of cardiovascular disease. Timely detection of OSA is essential for health. Existing classification methods are mainly based on electrocardiogram (ECG) signals and are divided into two categories: machine learning and deep learning. Traditional machine learning relies on manual feature selection, but it is inefficient and difficult to process large-scale data. Deep learning, especially convolutional neural networks (CNNs), can automatically extract features for obstructive sleep apnea detection, but CNNs are insufficient in processing long-term dependencies or global context information. To make up for this deficiency, researchers combined recurrent neural networks (RNNs), but RNNs often face problems such as gradient vanishing or gradient exploding, which makes model training difficult and affects model performance. The Transformer model has been applied to obstructive sleep apnea detection with its powerful long-range dependency modeling capabilities. However, the Transformer and CNN models usually have high requirements for computing resources in practical applications, which limits their feasibility in resource-constrained environments. In addition, environmental noise and slight changes in ECG features are still a problem in improving the accuracy of obstructive sleep apnea classification. Summary of the invention
[0003] The purpose of the present invention is to provide a physiological signal segment analysis method based on an adaptive bidirectional selection state space, which optimizes the network model through Mamba parallel selection scanning operation, thereby improving the accuracy of analyzing whether a sleep apnea event occurs in a physiological signal segment.
[0004] The technical solution adopted by the present invention is a physiological signal segment analysis method based on an adaptive bidirectional selection state space, which specifically includes the following steps:
[0005] Step 1: preprocess the original ECG signal X in the data set and divide the preprocessed data set into training set I train and test set I test ;
[0006] Step 2, constructing a physiological signal segment analysis model based on an adaptive bidirectional selection state space, the model comprising a multi-scale feature extraction module, a context encoder module, and a classification module;
[0007] Step 3: Use the training set I processed in step 1 train Train the model constructed in step 2;
[0008] Step 4: Test set I processed in step 1 test The trained model in step 3 is sent to the final output of the classification test result.
[0009] The present invention is also characterized in that:
[0010] The specific process of step 2 is:
[0011] Step 2.1, design a multi-scale feature extraction module, which includes a deep residual shrinkage network, a multi-scale efficient aggregation block module and multi-layer convolution; perform adaptive noise reduction through the deep residual shrinkage network; then use the multi-scale efficient aggregation block to complete lightweight multi-scale semantic information modeling; finally, filter the temporal information in the multi-scale features by stacking multiple layers of convolution;
[0012] Step 2.2, design a context encoder module, which includes scalable position coding, an adaptive bidirectional selection state space model and an adaptive gating mechanism, wherein the adaptive bidirectional selection state space model includes a frequency domain enhancement module and an adaptive bidirectional Mamba module; dynamically add position information through scalable position coding, and then use the adaptive bidirectional selection state space model to extract time domain and frequency domain features, and finally adaptively fuse the frequency domain and time domain features through the gating mechanism.
[0013] Step 2.3, classify the sleep apnea events by using the classification module to fuse the features obtained in step 2 with the time-frequency information.
[0014] The specific process of step 2.1 is:
[0015] Step 2.1.1, design a soft threshold as a shrinkage layer in the residual module. The shrinkage layer first performs global average pooling on the feature sequence and takes the absolute value. Then, the threshold is automatically learned through a neural network composed of a fully connected layer, batch normalization, ReLU and Sigmoid activation function to achieve soft threshold processing of the feature sequence and filter out noise in the feature. The soft threshold is shown in formula (1):
[0016]
[0017] In formula (1), z∈R 2×900 is the input characteristic, z o ∈R C×N is the output feature, C is the number of channels after the operation of formula (1), N is the sequence length after the operation of formula (1), τ represents the threshold, which is a positive number;
[0018] Step 2.1.2: The denoised feature z in step 2.1.1 is oInput to the lightweight multi-scale efficient aggregation module for feature extraction, and the feature z is transformed into o Divide along the channel dimension to get z lo ∈R C / 2×N and z ro ∈R C / 2×N , then z ro Input a lightweight convolution module to get the feature z' o ; Step 2.1.3, use 1D CBAM to calculate z' obtained in step 2.1.2 o After fusion and preliminary screening, the 1D CBAM module converts 2D convolution into 1D convolution based on 2D CBAM. Finally, channel attention and time attention are used to effectively filter the time information in the one-dimensional multi-scale feature data to obtain z″′ o , the calculation formula is shown in (2) and (3):
[0019] z″ o =z' o*σ (f 1×1 (f 1×1 (Avgpool(z' o )))) (2)
[0020] z″′ o =z″ o *σ(f 1×7 ([MP(z″ o );AP(z″ o )])) (3)
[0021] In formula (2) and (3), f 1×1 represents 1D convolution with a convolution kernel of 1, σ is the Sigmoid activation function, MP is the maximum pooling, AP is the average pooling, and [;] is the channel cascade operation.
[0022] The specific process of step 2.2 is:
[0023] Step 2.2.1: extract the feature z″′ from step 2.1 o The feature dynamic position information obtained by inputting it into the scalable position encoding module marked as F ensures the order of the time series. The scalable position encoding formula is shown in (4):
[0024] T=DWConv(F)×F (4)
[0025] In formula (4), DWConv is the deep convolution, F is the time series feature after feature extraction, and T represents the feature after dynamic position encoding;
[0026] Step 2.2.2: Input the dynamic position coding feature T obtained in step 2.2.1 into the frequency domain enhancement module, perform linear mapping on the feature sequence T through cascaded deep convolution to obtain the corresponding feature M, then transform M into the frequency domain using Fourier transform, and then use 1D convolution to extract the frequency domain features. Finally, use inverse Fourier transform to convert the enhanced frequency domain features back to the time domain, as shown in formula (5):
[0027] M l =iFFT(f 1×3 (ReLU(f 1×3 (FFT(M))))) (5)
[0028] In formula (5), FFT is fast Fourier transform, iFFT is inverse Fourier transform, ReLU is the activation function that brings nonlinear features to the model, and f 1×3 represents a 1D convolution with a convolution kernel of 3, M l It is the output result after the frequency domain enhancement module;
[0029] Step 2.2.3, input the dynamic position encoding feature T obtained in step 2.2.1 into the adaptive bidirectional Mamba module. First, update T to T l-1 , indicating that this is the characteristic state of the previous layer before entering the current processing layer. l-1 Transpose the dimension, as shown in formula (6), and normalize it through the root mean square normalization (RMSNorm) layer to obtain T″ l-1 , as shown in formula (7); then, the sequence T″ l-1 Through the linear mapping layer, it is mapped to x and g, and the number of sequence channel dimensions is E, as shown in formulas (8) and (9); then, cascaded depth convolution is used to obtain x c , as shown in formula (10), at this time, for x c For each direction, we first use the SiLU activation function to transform x c Convert to x' o , as shown in formula (11), and then x' is transformed into o Mapping to B o and C o , as shown in formulas (12) and (13); Δ o A parameter representing the time scale, Δ o Used to discretize continuous signals and obtain and As shown in formulas (15) and (16), Δ o The formula is shown in (14); then, using the state space model, formula (17) to obtain y o The method is used to obtain y'forward and y' backward ; Finally, the forward feature y' forward and the backward feature y' backward Splice along the channel, use SeNet to filter useful information, and finally get the output feature sequence T l , as shown in formula (18).
[0030] T' l-1 =Reshape(T l-1 ) (6)
[0031] In formula (6), T' l-1 T l-1 The result after transposition is given by T l-1 ∈R C×D Change to T' l-1 ∈R D×C , C represents the number of channels, D represents T' l-1 The sequence length at this time;
[0032] T″ l-1 =Norm(T' l-1 ) (7)
[0033] In formula (7), Norm is the representation of the normalization performed by the RMS normalization layer, T″ l-1 ∈R D×C , C represents the number of channels, D represents T″ l-1 The length of the sequence at this time;
[0034] x=Linear x (T″ l-1 ) (8)
[0035] g=Linear g (T″ l-1 ) (9)
[0036] In formulas (8) and (9), Linear x Indicates T″ l-1 Perform a linear mapping to get x, Linear g Indicates T″ l-1 Perform a linear mapping to obtain g, x∈R D×E , g∈R D×E , E represents the number of channels at this time, and D represents the sequence length of x and g:
[0037] x c =CDWConv(x) (10)
[0038] In formula (10), CDWConv represents the cascaded depth convolution of x to obtain x c , xc ∈R D×E , E represents the number of channels, D represents x c The length of the sequence;
[0039] x' o =SiLU(x c ) (11)
[0040] In formula (11), SiLU represents the activation function, for x c After the activation function, we get x' o , x' o ∈R D×E , E represents the number of channels, D represents x' o The length of the sequence;
[0041]
[0042] In formula (12) and (13), Indicates x' o Perform a linear mapping to get B o , Indicates x' o Perform a linear mapping to get C o , B o ∈R D×N , C o ∈R D×N , N represents the number of channels at this time, D represents B o and C o The length of the sequence;
[0043]
[0044]
[0045] In formulas (14) to (16), Δ o A parameter representing the time scale, used to discretize continuous signals. log(1+exp()) represents the Softplus function, which is a smooth ReLU activation function used to ensure Δ o The non-negativity of Indicates x' o Perform a linear mapping, represents the learnable parameters set for Δ; Represents the learnable parameter A of the setting o . Δ o ∈R D×E , E represents Δ o The number of channels, D represents Δ o Sequence length, and They are Δ oThe result after discretization of continuous signal;
[0046]
[0047] In formula (17), and They are Δ o The result after discretizing the continuous signal, C o is the result obtained by formula (13), SSM is the state space model, x' o is the result obtained by formula (11), y o ∈R D×E , E represents y o The number of channels, D represents y o Sequence length;
[0048] T l =Reshape(f 1×1 (SENet(Concat(y' forward ;y' backward )))) (18)
[0049] In formula (18), formula (17) obtains y o The method is used to obtain y' forward and y' backward , Concat performs channel concatenation, SENet is channel attention, f 1×1 It is a 1D convolution with a kernel of 1; Reshape means dimension transposition; T l is the output result of this module, T l ∈R C×D , C represents T l The number of channels, D represents T l Sequence length;
[0050] Step 2.2.4, the frequency domain information M obtained in step 2.2.2 l and the time domain information T obtained in step 2.2.3 l After fusion, the fused feature out is obtained, as shown in formula (19).
[0051] out=T l ×(1-λ)+M l ×λ (19)
[0052] In formula (19), λ is the proportion of hyperparameter control domain information.
[0053] The specific process of step 3 is:
[0054] Use the dataset I processed in step 1 trainThe model is trained, and the results of the training network are constrained using the cross entropy loss function formula (20), and then the parameters are updated through reverse propagation through 100 trainings. Here, 1 time refers to training the preprocessed signal fragments once, and finally obtaining the trained network model. The process is shown in formula (21):
[0055]
[0056] In formulas (20) and (21), k is the index variable that traverses all samples, indicating the cumulative sum of all samples, N is the number of samples, and y i represents the label of sample i, p i Indicates the probability that sample i is predicted as a positive class. y is the incoming label, which is the index value of a certain category. is the predicted value of the physiological signal segment classification, and Loss is the loss function used to evaluate the difference between the model's prediction results and the actual labels. The cross entropy loss function is used here.
[0057] The beneficial effects of the present invention are as follows:
[0058] 1. A physiological signal segment analysis network based on adaptive bidirectional selection state space is designed, and a lightweight multi-scale efficient aggregation (LMSEA) module is proposed. This module uses the deep residual shrinkage network (DRSNs) module to adaptively remove noise. The multi-scale strategy based on lightweight partial convolution (PConv) aims to reduce the number of parameters and expand the receptive field of the model, and the convolutional attention mechanism module (CBAM) is responsible for capturing effective temporal features.
[0059] 2. In order to solve the problems of high computational cost of Transformer and limitations of Mamba, this paper designs a linear complexity adaptive bidirectional selection state space model (ABSM). And adopts a gating mechanism to dynamically fuse the time domain information extracted by linear complexity adaptive bidirectional Mamba (ABi-Mamba) with the frequency domain information extracted by frequency domain enhancement module (FEM).
[0060] 3. The present invention can improve the accuracy of physiological signal segment classification. On the public Apnea-ECG dataset, the accuracy of each segment detection is improved to 91.98%. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 It is a schematic diagram of the preprocessing process of the physiological signal segment analysis method based on the adaptive bidirectional selection state space of the present invention;
[0062] Figure 2It is a schematic diagram of the overall structure of a physiological signal segment analysis model based on an adaptive two-way selection state space constructed in the physiological signal segment analysis method based on an adaptive two-way selection state space of the present invention;
[0063] Figure 3 It is a structural diagram of a Lightweight Multi-scale Efficient Aggregation (LMSEA) module constructed in the physiological signal segment analysis method based on the adaptive bidirectional selection state space of the present invention;
[0064] Figure 4 It is a structural diagram of an adaptive bidirectional selective state space model (ABSM) constructed in the physiological signal segment analysis method based on the adaptive bidirectional selective state space of the present invention;
[0065] Figure 5 It is a schematic diagram of the comparison of floating point operations (FLOPs) and accuracy of the model constructed in the physiological signal segment analysis method based on adaptive bidirectional selection state space of the present invention and the existing method on the Apnea-ECG data set;
[0066] Figure 6 It is a schematic diagram of visualization of the model constructed in the physiological signal segment analysis method based on the adaptive bidirectional selection state space of the present invention on the test set of the Apnea-ECG data set through the t-SNE technology. DETAILED DESCRIPTION
[0067] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0068] Example 1
[0069] The present invention is based on a physiological signal segment analysis method of adaptive bidirectional selection state space, and adaptively extracts time series data from rich time domain features through a lightweight multi-scale efficient aggregation module. Then, according to the characteristics of the electrocardiogram signal, a context encoder is designed, and an adaptive bidirectional Mamba is designed to complete long-distance modeling, which is combined with a frequency domain enhancement module to complete time-frequency fusion to perform physiological signal analysis, so as to improve the accuracy of analyzing whether sleep apnea events occur in physiological signal segments.
[0070] Example 2
[0071] The specific steps are as follows:
[0072] Step 1: Input the original ECG signal X in the public dataset Apnea-ECG and divide it into training set I after corresponding preprocessing operations train and test set I test Using training set I train For training, test set I test Conduct a test.
[0073] Step 1.1, signal preprocessing: ECG signal X is segmented, filtered, R-peaks detection and RR interval (RRI) and R-peak amplitude (RA) extraction, linear interpolation and channel splicing are performed.
[0074] The overall process is as follows Figure 1 The details of the processing method are as follows:
[0075] Fragmentation: According to the annotations provided by the dataset, each individual signal is divided into 1-minute sub-segments. For example, in the Apnea-ECG dataset, the sampling rate is 100 Hz, so each signal has 100×60=6000 sampling points and a corresponding label. In addition, considering that the classification of sleep apnea syndrome depends on continuous time information, this method concatenates the 2 minutes before and after the current segment to form a 5-minute sub-segment, while the label remains unchanged at the current 1 minute.
[0076] Filtering: The input original ECG signal X-band is preprocessed by applying a 2nd-order Butterworth Band Pass Filter (BPPF) with a high-pass frequency of 5 Hz and a low-pass frequency of 35 Hz to suppress high-frequency and low-frequency noise and retain the original signal.
[0077] R-peaks detection and RR interval (RRI) and R peak amplitude (RA) extraction: Hamilton algorithm is used to detect the position of the R peak, obtain the RR interval (RRI) and R peak amplitude (RA), and median filter is used to remove some noise in the RR interval.
[0078] Linear interpolation: Since the RR interval and R peak amplitude have different data dimensions after extraction, in order to maintain the consistency of the dimensions, RRI and RA are interpolated to a sequence of length 900. At this time, the RRI sequence is defined as The RA sequence is defined as Among them, 1 represents the number of channels and 900 represents the length of the sequence after interpolation.
[0079] Channel concatenation (Concat): In order to make full use of the extracted RR interval and R peak amplitude, they are concatenated on the channel to obtain a time series Then input the network model.
[0080] Step 1.2: Divide the signal z preprocessed in step 1.1 into training set I train and test set I test ,In order to verify its applicability and robustness to the physiological signal fragment ,analysis task, the proportion division was performed based on independent individuals.
[0081] Step 2: Construct a physiological signal segment analysis model based on an adaptive bidirectional selection state space (e.g. Figure 2 As shown in the figure, it is mainly composed of a multi-scale feature extraction module (MultiScale Feature Extraction, MFE), a context encoder module (Context encoder) and a classification module (Classifier).
[0082] Step 2.1, design a multi-scale feature extraction module (MFE) (such as Figure 2 As shown in Figure 1, it is mainly composed of a deep residual shrinkage network (DRSNs), a multi-scale efficient aggregation block (LMSEA) module, and multi-layer convolution. First, adaptive denoising is performed through a deep residual shrinkage network (DRSNs); then, by using a multi-scale efficient aggregation block (LMSEA) model (as shown in Figure 1), the deep residual shrinkage network (DRSNs) is used to perform adaptive denoising; then, by using a multi-scale efficient aggregation block (LMSEA) model (as shown in Figure 1), the deep residual shrinkage network (DRSNs) is used to perform adaptive denoising. Figure 3 As shown in the figure, lightweight multi-scale semantic information modeling is completed; finally, stacking multiple layers of convolution is responsible for reducing the sequence length and reducing the amount of computation.
[0083] Step 2.1.1, first, perform adaptive noise reduction through the deep residual shrinkage network (DRSNs). The deep residual shrinkage network is an improvement on the traditional deep residual network. The core is to design a soft threshold as a shrinkage layer in the residual module. The shrinkage layer first performs global average pooling (GAP) on the feature sequence and takes the absolute value. Then, the threshold is automatically learned through a neural network composed of a fully connected layer (FullyConnected Layer), batch normalization (Batch Normalization), ReLU and Sigmoid activation function to achieve soft threshold processing of the feature sequence and filter out noise in the features. The soft threshold is shown in formula (1):
[0084]
[0085] In formula (1): z∈R 2×900 is the input characteristic, z o ∈R C×Nis the output feature, C is the number of channels after the operation of formula (1), and N is the sequence length after the operation of formula (1). τ represents the threshold, which is a positive number. Unlike the ReLU activation function, which directly sets negative features to zero, the soft threshold sets features close to zero to zero, thereby retaining useful negative features.
[0086] Step 2.1.2: The denoised feature z in step 2.1.1 is o Input to the lightweight multi-scale efficient aggregation module (LMESA) (such as Figure 3 The feature z is extracted by serial multi-scale modules. o Divide along the channel dimension to get z lo ∈R C / 2×N and z ro ∈R C / 2×N Then z ro Input a lightweight convolution module, which consists of partial convolution (PConv), batch normalization (BN), and ReLU activation function to extract temporal features. This design effectively reduces the number of parameters. Figure 3 In the above figure, module 'PBL' is the abbreviation of these three components. Among them, the partial convolution (PConv) performs ordinary convolution with kernel 3 on the first 1 / 4 channels, and directly maps the last 3 / 4 channels. Then, the receptive field of the partial convolution (PConv) with kernel 3 is gradually expanded from 3 to 5 and 7 through a serial architecture, and the feature z' is obtained. o .
[0087] Step 2.1.3, z' obtained in step 2.1.2 o Fusion and preliminary screening are performed, and 1D CBAM (one-dimensional convolutional attention mechanism module) is used. The 1D CBAM module converts 2D convolution into 1D convolution based on 2D CBAM (two-dimensional convolutional attention mechanism module), and removes the maximum pooling convolution operation of channel attention in the original CBAM, which reduces the computational complexity while ensuring the accuracy of the model. Finally, channel attention and time attention are used to effectively filter the time information in the one-dimensional multi-scale feature data. Get z″′ o , the calculation formula is shown in (2) and (3):
[0088] z″ o =z' o *σ(f 1×1 (f 1×1 (Avgpool(z' o )))) (2)
[0089] Z″′ o =Z″′o *σ(f 1×7 ([MP(z″ o );AP(z″ o )])) (3)
[0090] In formula (2) and (3), f 1×1 represents 1D convolution with a convolution kernel of 1, σ is the Sigmoid activation function, MP is the maximum pooling, AP is the average pooling, and [;] is the channel cascade operation.
[0091] Step 2.2, design the context encoding module (such as Figure 4 As shown in Figure 2, it can achieve long-distance modeling with lower computational cost and improve the classification performance of the model. This module mainly consists of scalable position encoding (SPE), adaptive bidirectional selection state space model (ABSM) (as shown in Figure 2, Figure 4 As shown in Figure 2) and an adaptive gating mechanism. Among them, the adaptive bidirectional selection state space model (ABSM) (as shown in Figure 2) Figure 4 The proposed method includes a frequency domain enhancement module (FEM) and an adaptive bidirectional Mamba (ABi-Mamba) module. First, the position information is dynamically added through the scalable position encoding (SPE), and then the adaptive bidirectional selection state space model (ABSM) (as shown in FIG. Figure 4 The time domain and frequency domain features are extracted by using the gating mechanism. Finally, the frequency domain and time domain features are adaptively fused through the gating mechanism.
[0092] Step 2.2.1: extract the feature z″′ from step 2.1 o The feature dynamic position information obtained by inputting it into the scalable position encoding (SPE) module marked as F ensures the order of the time series. The scalable position encoding formula is shown in (4):
[0093] T=DWConv(F)×F (4)
[0094] In formula (4), DWConv is the deep convolution, and F is the time series feature after feature extraction. In addition, in order to ensure the stability of data feature distribution and accelerate the convergence speed of the model, layer normalization is used to normalize the features. T represents the feature after dynamic position encoding.
[0095] Step 2.2.2, the dynamic position encoding feature T obtained in step 2.2.1 is input into the frequency domain enhancement module (FEM) (such as Figure 4As shown in (5), the feature sequence T is linearly mapped through cascaded depthwise convolution (CDWConv) to obtain the corresponding feature M. Then, M is transformed into the frequency domain using Fourier transform. 1D convolution is then used to extract frequency domain features. Finally, the inverse Fourier transform is used to convert the enhanced frequency domain features back to the time domain. The formula is shown in (5):
[0096] M l =iFFT(f 1×3 (ReLU(f 1×3 (FFT(M))))) (5)
[0097] In formula (5), FFT is fast Fourier transform, iFFT is inverse Fourier transform, ReLU is the activation function that brings nonlinear features to the model, and f 1×3 represents a 1D convolution with a convolution kernel of 3, M l This is the output result after the frequency domain enhancement module (FEM).
[0098] Step 2.2.3, input the dynamic position encoding feature T obtained in step 2.2.1 into the adaptive bidirectional Mamba (ABi-Mamba) module (such as Figure 4 As shown), first, update T to T l-1 , indicating that this is the characteristic state of the previous layer before entering the current processing layer. l-1 Transpose the dimension (as shown in formula (6)) (Token sequence T l-1 Such a statement usually represents an intermediate state of data processing in a deep learning model. This state is the output of the model at a specific layer and is used for subsequent processing or as the basis for the final decision. ) and is normalized by the root mean square normalization (RMSNorm) layer to obtain T″ l-1 (shown in formula (7)); then, the sequence T″ l-1 Through the linear mapping layer, it is mapped to x and g, and the number of sequence channel dimensions is E (as shown in formulas (8) and (9)); then, cascaded depthwise convolution (CDWConv) is used to obtain x c (As shown in formula (10)). At this time, for x c For each direction, we first use the SiLU activation function to transform x c Convert to x' o (As shown in formula (11)), and then through the linear layer to transform x' o Mapping to B o and C o (as shown in formulas (12) and (13)); Δ o A parameter representing the time scale, Δo Used to discretize continuous signals and obtain and (As shown in formulas (15) and (16)), Δ o The formula is shown in (14); then, the state space model (SSM), that is, formula (17), is used to obtain y o The method is used to obtain y' forward and y' backward Finally, the forward feature y' forward and the backward feature y' backward Splice along the channel, use SeNet to filter useful information, and finally get the output feature sequence T l , as shown in formula (18).
[0099] T' l-1 =Reshape(T l-1 ) (6)
[0100] In formula (6), T' l-1 T l-1 The result after transposition is given by T l-1 ∈R C×D Change to T' l-1 ∈R D×C , C represents the number of channels, D represents T' l-1 The sequence length at this time.
[0101] T' l-1 =Norm(T″ l-1 ) (7)
[0102] In formula (7), Norm is the representation of the normalization performed by the root mean square normalization (RMSNorm) layer, T″ l-1 ∈R D×C , C represents the number of channels, D represents T″ l-1 The sequence length at this time.
[0103] x=Linear x (T″ l-1 ) (8)
[0104] g=Linear g (T″ l-1 ) (9)
[0105] In formulas (8) and (9), Linear x Indicates T″ l-1 Perform a linear mapping to get x, Linear g Indicates T″ l-1 Perform a linear mapping to obtain g, x∈RD×E , g∈R D×E , E represents the number of channels at this time, and D represents the sequence length of x and g.
[0106] x c =CDWConv(x) (10)
[0107] In formula (10), CDWConv represents the cascaded depth convolution of x to obtain x c , x c ∈R D×E , E represents the number of channels, D represents x c The length of the sequence.
[0108] x' o =SiLU(x c ) (11)
[0109] In formula (11), SiLU represents the activation function, for x c After the activation function, we get x' o , x' o ∈R D×E , E represents the number of channels, D represents x' o The length of the sequence.
[0110]
[0111] In formula (12) and (13), Indicates x' o Perform a linear mapping to get B o , Indicates x' o Perform a linear mapping to get C o , B o ∈R D×N , C o ∈R D×N , N represents the number of channels at this time, D represents B o and c o The length of the sequence.
[0112]
[0113] In formulas (14) to (16), Δ o A parameter representing the time scale, used to discretize continuous signals. log(1+exp()) represents the Softplus function, which is a smooth ReLU activation function used to ensure Δ o The non-negativity of Indicates x' o Perform a linear mapping, represents the learnable parameters set for Δ. Represents the learnable parameter A of the setting o . Δ o ∈R D×E , E represents Δ o The number of channels, D represents Δ o Sequence length, and They are Δ o The result after discretization of continuous signal.
[0114]
[0115] In formula (17), and They are Δ o The result after discretization of continuous signal, C o is the result obtained by formula (13), SSM is the state space model. o is the result obtained by formula (11). o ∈R D×E , E represents y o The number of channels, D represents y o Sequence length.
[0116] T l =Reshape(f 1×1 (SENet(Concat(y' forward ;y' backward )))) (18)
[0117] In formula (18), formula (17) obtains y o The method is used to obtain y' forward and y' backward , Concat performs channel concatenation, SENet is channel attention, f 1×1 It is a 1D convolution with a kernel of 1. Reshape means dimension transposition. l is the output result of this module, T l ∈R C×D , C represents T l The number of channels, D represents T l Sequence length.
[0118] Step 2.2.4, finally, to realize the frequency domain information M obtained in step 2.2.2 l and the time domain information T obtained in step 2.2.3 l The adaptive gating mechanism is used to control the proportion of information in each domain to ensure the balanced state of time-frequency information. The calculation formula is shown in (19):
[0119] out=T l ×(1-λ)+Ml ×λ (19)
[0120] In formula (19), λ is the proportion of hyperparameter control domain information.
[0121] Step 2.3, design a classification module, which consists of average pooling (Avgpool), fully connected layer (FC) and Softmax activation function. The feature out obtained after the time-frequency information fusion in step 2.2.4 is used to classify sleep apnea events. The predicted value of physiological signal segment classification is obtained through the above modules. The formula is shown in (20):
[0122]
[0123] Step 3: Use the dataset I processed in step 1 train The model is trained, and the results obtained by training the network are constrained using the cross entropy loss function (Formula (21)), and then the parameters are updated by reverse propagation through 100 trainings. Here, 1 time refers to training the preprocessed signal fragments once, and finally obtaining the trained network model. The process is shown in Formula (22):
[0124]
[0125] In formulas (21) and (22), k is the index variable that traverses all samples, indicating the cumulative sum of all samples, N is the number of samples, and y i represents the label of sample i, p i Indicates the probability that sample i is predicted as a positive class. y is the incoming label, which is the index value of a certain category. is the predicted value of the physiological signal segment classification, and Loss is the loss function used to evaluate the difference between the model's prediction results and the actual labels. The cross entropy loss function is used here.
[0126] Step 4: The test set I preprocessed in step 1 test The trained model in step 3 is sent to the final output of the classification test result.
[0127] Example 3
[0128] In order to obtain the best results and ensure the reproducibility of the model, the hyperparameter settings are shown in Table 1. Among them, in the hyperparameter settings, the ECG channel (ECG Channel) is 1, the length of each segment (Per-segement Length) is 60s, the learning rate (Learning Rate) is 1e-3, the decay rate (wd) is 1e-4, the Epoch is the number of iterations, which is set to 100 here, the batch size (Batchsize) is 64, the optimizer (Optimizer) is Adam, the hidden layer dimension (HS) is 1024, and the balance parameter λ is not fine-tuned due to random initialization and dynamic update of gradient backpropagation.
[0129] Table 1
[0130] Hyperparameters value ECG channel (ECGChannel) 1 Per-segementLength 60s Learning rate (lr) 1e-3 Decay rate (wd) 1e-4 Epoch 100 BatchSize 64 Optimizer Adam Hidden layer dimension (HS) 32
[0131] The experimental results of adjusting the hidden layer dimension (HS) are shown in Table 2. The experimental results show that the highest accuracy is 91.98% when HS is 32. Therefore, the hidden layer dimension (HS) is set to 32 in subsequent experimental analysis.
[0132] Table 2
[0133]
[0134] The results of the comparative experiment on the Apnea-ECG dataset are shown in Table 3 below. It is not difficult to find that, compared with other methods based on machine learning and deep learning, the present invention does not require complex feature engineering and complex processing methods for the original signal to achieve better results, and can better balance various evaluation indicators (including accuracy Acc, sensitivity Sen, specificity Spec and F1 score), and obtain higher accuracy and specificity. In addition, the state space model (SSM) in Mamba and the self-attention mechanism in Transformer are crucial in long-distance modeling and capturing contextual dependencies. Therefore, given a time series When and E = C, the computational complexity of the self-attention mechanism and the state space model (SSM) is as follows:
[0135] Ω(self-attention)=DC 2 +D 2 C
[0136] Ω(SSM)=3DCS+DCS
[0137] Among them, the self-attention mechanism has a quadratic relationship with the sequence length D, and the state space model (State Space model, SSM) has a linear relationship with D. Therefore, the present invention uses Mamba to greatly reduce the amount of calculation. C is the number of channels, and S is a fixed parameter.
[0138] also, Figure 5 The comparison results of the floating point operations (FLOPs) and accuracy of the present invention and the most advanced methods on the Apnea-ECG dataset are shown. It can be clearly seen from the figure that the present invention has an advantage in performance. Figure 6 The visualization results of the present invention using t-SNE technology on the test set of the Apnea-ECG dataset are shown. It can be clearly seen from the figure that data points of different categories are well separated in the low-dimensional space, indicating that the present method performs well in classification effect.
[0139] Table 3
[0140]
[0141]
[0142] [1] ARHassan, Computeraided obstructive sleep apnea detection using normal inverse Gaussian parameters and adaptive boosting, BiomedicalSignalProcessingandControl, vol.29, pp.2-30, Aug.2016, doi:10.1016 / j.bspc.2016.05.009.
[0143] [2]H.Sharma and KKSharma,Sleep apnea detection from ECG usingvariationalmodedecomposition,Biomed.Phys.Eng.Express,vol.6,no.1,p.015026,Jan.2020,doi:10.1088 / 2057-1976 / ab68e9.
[0144] [3]S.Hu,W.Cai,T.Gao,and M.Wang,A Hybrid Transformer Modelforobstructive Sleep Apnea Detection Based on Self-Attention MechanismUsingSingle-Lead ECG,IEEE Trans.Instrum.Meas.,vol.71,pp.1-11,2022,doi:10.1109 / TIM.2022.3193169.
[0145] [4]H.Liu,S.Cui,X.Zhao,and F.Cong,Detection of obstructive sleepapneafrom single-channel ECG signals using a CNN-transformer architecture,Biomedical Signal Processing and Control,vol.82,p.104581,Apr.2023,doi:10.1016 / j.bspc.2023.104581.
[0146] [5]C.Li et al.,TFFormer:A Time–Frequency Information Fusion BasedCNN-Transformer Model for OSA Detection With Single-Lead ECG,IEEETrans.Instrum.Meas.,vol.72,pp.1–17,2023,doi:10.1109 / TIM.2023.3312472。
Claims
1. A physiological signal segment analysis method based on an adaptive bidirectional selection state space, characterized in that: The specific steps include: Step 1: preprocess the original ECG signal X in the data set and divide the preprocessed data set into training set I train and test set I test ; Step 2, constructing a physiological signal segment analysis model based on an adaptive bidirectional selection state space, the model comprising a multi-scale feature extraction module, a context encoder module, and a classification module; Step 3: Use the training set I processed in step 1 train Train the model constructed in step 2; Step 4: Test set I processed in step 1 test The trained model in step 3 is sent to the final output of the classification test result.
2. The physiological signal segment analysis method based on adaptive bidirectional selection state space according to claim 1 is characterized in that: The specific process of step 2 is: Step 2.1, design a multi-scale feature extraction module, which includes a deep residual shrinkage network, a multi-scale efficient aggregation block module and multi-layer convolution; perform adaptive noise reduction through the deep residual shrinkage network; then use the multi-scale efficient aggregation block to complete lightweight multi-scale semantic information modeling; finally, filter the temporal information in the multi-scale features by stacking multiple layers of convolution; Step 2.2, design a context encoder module, which includes scalable position coding, an adaptive bidirectional selection state space model and an adaptive gating mechanism, wherein the adaptive bidirectional selection state space model includes a frequency domain enhancement module and an adaptive bidirectional Mamba module; dynamically add position information through scalable position coding, then use the adaptive bidirectional selection state space model to extract time domain and frequency domain features, and finally adaptively fuse the frequency domain and time domain features through the gating mechanism; Step 2.3, classify the sleep apnea events by using the classification module to fuse the features obtained in step 2 with the time-frequency information.
3. The physiological signal segment analysis method based on adaptive bidirectional selection state space according to claim 2 is characterized in that: The specific process of step 2.1 is as follows: Step 2.1.1, design a soft threshold as a shrinkage layer in the residual module. The shrinkage layer first performs global average pooling on the feature sequence and takes the absolute value. Then, the threshold is automatically learned through a neural network composed of a fully connected layer, batch normalization, ReLU and Sigmoid activation function to achieve soft threshold processing of the feature sequence and filter out noise in the feature. The soft threshold is shown in formula (1): In formula (1), z∈R 2×900 is the input characteristic, z o ∈R C×N is the output feature, C is the number of channels after the operation of formula (1), N is the sequence length after the operation of formula (1), τ represents the threshold, which is a positive number; Step 2.1.2: The denoised feature z in step 2.1.1 is o Input to the lightweight multi-scale efficient aggregation module for feature extraction, and the feature z is transformed into o Divide along the channel dimension to get z lo ∈R C / 2×N and z ro ∈R C / 2×N , then z ro Input a lightweight convolution module to get the feature z' o ; Step 2.1.3, use 1D CBAM to calculate z' obtained in step 2.1.2 o After fusion and preliminary screening, the 1D CBAM module converts 2D convolution into 1D convolution based on 2D CBAM. Finally, channel attention and time attention are used to effectively filter the time information in the one-dimensional multi-scale feature data to obtain z' o ”, the calculation formula is as follows (2) and (3): z″ o =z'o*σ(f 1×1 (f 1×1 (Avgpool(z' o )))) (2) With"' o =z″ o *σ(f 1×7 ([MP(z″ o );AP(z″ o )])) (3) In formulas (2) and (3), f 1×1 represents 1D convolution with a convolution kernel of 1, σ is the activation function of Sigmoid, MP is the maximum pooling, AP is the average pooling, [; ] is a channel cascade operation.
4. The physiological signal segment analysis method based on adaptive bidirectional selection state space according to claim 3 is characterized in that: The specific process of step 2.2 is as follows: Step 2.2.1, extract the feature z' from step 2.1 o " is marked as F and input into the scalable position encoding module to obtain the characteristic dynamic position information to ensure the order of the time series. The scalable position encoding formula is shown in (4): T=DWConv(F)×F (4) In formula (4), DWConv is the deep convolution, F is the time series feature after feature extraction, and T represents the feature after dynamic position encoding; Step 2.2.2: Input the dynamic position coding feature T obtained in step 2.2.1 into the frequency domain enhancement module, perform linear mapping on the feature sequence T through cascaded deep convolution to obtain the corresponding feature M, then transform M into the frequency domain using Fourier transform, and then use 1D convolution to extract the frequency domain features. Finally, use inverse Fourier transform to convert the enhanced frequency domain features back to the time domain, as shown in formula (5): M l =iFFT(f 1×3 (ReLU(f 1×3 (FFT(M)))))) (5) In formula (5), FFT is fast Fourier transform, iFFT is inverse Fourier transform, ReLU is the activation function that brings nonlinear features to the model, and f 1×3 represents a 1D convolution with a convolution kernel of 3, M l It is the output result after the frequency domain enhancement module; Step 2.2.3, input the dynamic position encoding feature T obtained in step 2.2.1 into the adaptive bidirectional Mamba module. First, update T to T l-1 , indicating that this is the characteristic state of the previous layer before entering the current processing layer; the Token sequence T l-1 Transpose the dimension, as shown in formula (6), and normalize it through the RMS normalization layer to obtain T' l ' -1 , as shown in formula (7); then, the sequence T' l ' -1 Through the linear mapping layer, it is mapped to x and g, and the number of sequence channel dimensions is E, as shown in formulas (8) and (9); then, cascaded depth convolution is used to obtain x c , as shown in formula (10), at this time, for x c For each direction, we first use the SiLU activation function to transform x c Convert to x' o , as shown in formula (11), and then x' is transformed into o Map to B o and C o , as shown in formulas (12) and (13); o Discretize the continuous signal and get and As shown in formulas (15) and (16), Δ o The formula is shown in (14); then, using the state space model, formula (17) to obtain y o The method is used to obtain y' forward and y' backward ; Finally, the forward feature y' forward and the backward feature y' backward Splice along the channel, use SeNet to filter the information, and finally get the output feature sequence T l , as shown in formula (18): T' l-1 =Reshape(T l-1 ) (6) In formula (6), T' l-1 T l-1 The result after transposition is given by T l-1 ∈R C×D Change to T' l-1 ∈R D×C , C represents the number of channels, D represents T' l-1 The sequence length at this time; T″ l-1 =Norm(T' l-1 ) (7) In formula (7), Norm is the representation of the normalization performed by the RMS normalization layer, T″ l-1 ∈R D×C , C represents the number of channels, D represents T″ l-1 The sequence length at this time; x=Linear x (T″ l-1 ) (8) g=Linear g (T″ l-1 ) (9) In formulas (8) and (9), Linear x Indicates T″ l-1 Perform a linear mapping to get x, Linear g Indicates T' l ' -1 Perform a linear mapping to obtain g, x∈R D×E , g∈R D×E , E represents the number of channels at this time, and D represents the sequence length of x and g: x c =CDWConv(x) (10) In formula (10), CDWConv represents the cascaded depth convolution of x to obtain x c , x c ∈R D×E , E represents the number of channels, and D represents the sequence length of x and g; x' o =SiLU(x c ) (11) In formula (11), SiLU represents the activation function, for x c After the activation function, we get x' o , x' o ∈R D×E , E represents the number of channels, and D represents the sequence length of x and g; In formula (12) and (13), Indicates x' o Perform a linear mapping to get B o , Indicates x' o Perform a linear mapping to get C o , x∈R D×N , g∈R D×N , N represents the number of channels at this time, and D represents the sequence length of x and g; In formulas (14) to (16), Δ o A parameter representing the time scale, used to discretize continuous signals; log(1+exp()) represents the Softplus function, which is a smooth ReLU activation function used to ensure Δ o The non-negativity of Indicates x' o Perform a linear mapping, represents the learnable parameters set for Δ; Represents the learnable parameter A of the setting o , Δ o ∈R D×E , E represents Δ o The number of channels, D represents Δ o Sequence length, and They are Δ o The result after discretization of continuous signal; In formula (17), and They are Δ o The result after discretization of continuous signal, C o is the result obtained by formula (13), SSM is the state space model, x' o is the result obtained by formula (11), y o ∈R D×N , E represents y o The number of channels, D represents y o Sequence length; T l =Reshape(f 1×1 (SENet(Concat(y' forward ;the' bckward )))) (18) In formula (18), formula (17) obtains y o The method is used to obtain y' forward and y' backward , Concat performs channel concatenation, SENet is channel attention, f 1×1 It is a 1D convolution with a kernel of 1; Reshape means dimension transposition; T l is the output result of this module, T l ∈R C×D , C represents T l The number of channels, D represents T l Sequence length; Step 2.2.4, the frequency domain information M obtained in step 2.2.2 l and the time domain information T obtained in step 2.2.3 l After fusion, the fused feature out is obtained, as shown in formula (19): out=T l ×(1-λ)+M l ×λ (19) In formula (19), λ is the proportion of hyperparameter control domain information.
5. The physiological signal segment analysis method based on adaptive bidirectional selection state space according to claim 4 is characterized in that: The specific process of step 3 is as follows: Use the dataset I processed in step 1 train The model is trained, and the results obtained by training the network are constrained using the cross entropy loss function formula (20), and then the parameters are updated by reverse propagation through 100 trainings. Here, 1 time refers to training the preprocessed signal fragments once, and finally obtaining the trained network model. The process is shown in formula (21): In formulas (20) and (21), k is the index variable that traverses all samples, indicating the cumulative sum of all samples, N is the number of samples, and y i represents the label of sample i, p i Indicates the probability that sample i is predicted to be a positive class; y is the incoming label, which is the index value of a certain category. is the predicted value of the physiological signal segment classification, and Loss is the loss function used to evaluate the difference between the model's prediction results and the actual labels. The cross entropy loss function is used here.
Citation Information
Cited By
Electrocardiogram data processing model, device and equipment
CN120022004A
Motor imagery classification and identification method
CN120316591A
Sewage treatment blower fault prediction method based on multi-scale Mangbar model
CN121278505A
A Fault Prediction Method for Wastewater Treatment Blowers Based on Multi-Scale Mamba Model
CN121278505B
Distributed optical fiber sensor vibration identification method and system
CN121524783A