Lightweight time-frequency fusion signal classification method guided by data rebalancing loss
Patent Information
- Application Number
- CN202410220339.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-28
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2044-02-28
AI Technical Summary
[0005]本发明的目的是提供数据再平衡损失指导的轻量级时频融合信号分类方法,该方法通过设计轻量级Transformer降低模型参数量,解决了由于数据类别不平衡导致的阻塞性睡眠呼吸暂停事件分类不准确的问题
[0036]1.设计由加和时频融合注意力(ATFA)和多尺度MLP(MSM)组成的Transformer架构以极低的计算开销完成时域信息和频域信息的融合,以及通道信息的整合有效解决参数量大问题。
Smart Images

Figure CN118228097B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of medical physiological signal processing technology, and relates to a lightweight time-frequency fusion signal classification method guided by data rebalancing loss. Background Technology
[0002] Obstructive sleep apnea (OSA) is an obstructive event that occurs during sleep due to insufficient airflow. In severe cases, it can lead to hypertension, coronary heart disease, heart failure, and other health problems. Therefore, timely and accurate OSA classification is of great importance.
[0003] Currently, to extract the optimal feature set and improve the accuracy of OSA event classification, researchers have explored the optimal combination space using a combination of CNN and Transformer models, achieving some success. However, observation of publicly available datasets used for OSA classification reveals that although OSA subjects repeatedly experience apnea and hypopnea events at night, the total duration of these respiratory events is significantly shorter than the normal respiratory duration. Therefore, the study found that when ECG signals are segmented into fixed 60-second segments and classified according to the occurrence of respiratory events, the number of respiratory event segments is less than that of normal respiratory segments, indicating an imbalance in the sample size of different categories, or a class imbalance problem in the dataset.
[0004] However, in the field of OSA event detection, the cross-entropy loss function is often used to guide model parameter updates. Classes with larger sample sizes are given greater weights, while those with smaller sample sizes are given lower weights. This leads to a shift in the classification decision boundary, reducing the extraction of the model's optimal feature space and thus lowering the model's classification performance. Therefore, overcoming the class imbalance problem to improve OSA classification accuracy remains a challenge in this field. Summary of the Invention
[0005] The purpose of this invention is to provide a lightweight time-frequency fusion signal classification method guided by data rebalancing loss. This method reduces the number of model parameters by designing a lightweight Transformer, thus solving the problem of inaccurate classification of obstructive sleep apnea events caused by data class imbalance.
[0006] The technical solution adopted in this invention is a lightweight time-frequency fusion signal analysis method guided by data rebalancing loss, which specifically includes the following steps:
[0007] Step 1: Input the original ECG signals from the public dataset, perform preprocessing operations on the corresponding signals, and divide them into training and test sets;
[0008] Step 2: Construct a lightweight time-frequency information fusion Transformer physiological signal analysis model guided by data rebalancing loss, and classify physiological signal segments using this model;
[0009] Step 3: Use the training set processed in Step 1 to train the lightweight time-frequency information fusion Transformer physiological signal analysis model constructed in Step 2 with data rebalancing loss guidance. Use the data rebalancing loss function to constrain the results obtained from training the network, and then back-broadcast to update the parameters until the model performance converges to obtain the trained network model.
[0010] Step 4: Input the ECG signal of the test set after preprocessing in Step 1 into the model trained in Step 3, and finally output the classification and detection results.
[0011] The invention is further characterized by:
[0012] The preprocessing of the ECG signal in step 1 is as follows:
[0013] The time series z is obtained by sequentially performing segmentation, filtering, R-peak detection and RR interval and R-peak amplitude extraction, linear interpolation, and channel splicing.
[0014] In step 2, the lightweight time-frequency information fusion Transformer physiological signal analysis model guided by data rebalancing loss includes a feature extraction module, an information fusion module, and a classification module;
[0015] The feature extraction module includes Deep Residual Shrinking Networks (DRSNs), Multi-Scale Temporal-Pass Fusion Attention (MTCA), and Multi-Layer Convolutional ReLU Module (CRL).
[0016] The information fusion module consists of an scalable location coding module, an additive time-frequency fusion attention module (ATFA), and a multi-scale MLP module.
[0017] The classification module includes average pooling, fully connected layers, and the Softmax activation function.
[0018] The specific process of step 2 is as follows:
[0019] Step 2.1: Process the time series z through a deep residual shrinking network (DRSNs) for adaptive denoising to obtain the denoised signal z. nr ; then z nrThe input is fed into an SBL module consisting of three layers of spatial and channel reconstruction convolutions (SCConv), batch normalization (BN), and ReLU activation functions stacked sequentially to achieve lightweight multi-scale modeling. The convolutional block attention module (CBAM) is used to filter features in the temporal and channel dimensions. Finally, the filtered features are processed by stacking multiple layers of convolutions (Conv1D), normalization, and ReLU to reduce the sequence length. The enhanced temporal feature F is then output.
[0020] Step 2.2: Input the temporal feature F output in Step 2.1 into the Scalable Positional Encoding (SPE) for dynamic encoding. Then, input the dynamically encoded feature into the Transformer architecture, which includes the Attention Flow Amplification (ATFA) module and the Multi-Scale Multi-Scale Programming (MLP) module, to complete the fusion of temporal and frequency domain information. Output the feature ψ” after fusion of time and frequency information to complete channel information extraction and dimensional transformation.
[0021] Step 2.3: Based on the feature ψ” output in Step 2.2, classify obstructive sleep apnea events to obtain the physiological signal segment classification prediction value. The formula is as follows:
[0022]
[0023] Step 2.4, based on the predicted values obtained in Step 2.3 Whether the value is greater than 0.5 determines whether an OSA event has occurred. A value greater than 0.5 indicates an obstructive sleep apnea event, while a value less than 0.5 indicates a normal event.
[0024] During the training process in step 3, the data rebalancing loss, i.e., the following formulas (2) to (9), is used to constrain the model constructed in step 2:
[0025] The formula for the category rebalancing loss function DRLoss is as follows:
[0026] L DRLoss =εL FL +(1-ε)L MLDAM (2)
[0027] L FL =-(1-p t ) δ log(p t (3)
[0028]
[0029]
[0030]
[0031] w = log(M × T) (7)
[0032]
[0033]
[0034] In formulas (2) to (9), ε is an adjustable hyperparameter, and L FL Let L be the FocalLoss loss function. MLDAM Represents the weighted LDAM, z y For the model output, Δy and Δj are class dependency boundaries, k represents the number of classes, C is a constraint, and n j The number of samples for each category, p t For predicting probabilities, δ is an adjustable hyperparameter; w is a weighting factor consisting of a weighted memory unit M and a classification penalty term T; λ is a hyperparameter; t represents the current time step; t-1 represents the previous time step; I represents the number of samples in a batch; the relationship between the weight values of the previous batch and the current batch is obtained through M; and batch balance is better achieved through memory storage; θ is an adjustable hyperparameter; P error P represents the incorrectly predicted sample. right This represents a correctly predicted sample.
[0035] The beneficial effects of this invention are as follows:
[0036] 1. A Transformer architecture consisting of Additive Time-Frequency Fusion Attention (ATFA) and Multi-Scale MLP (MSM) is designed to achieve the fusion of time-domain and frequency-domain information and the integration of channel information with extremely low computational overhead, effectively solving the problem of large number of parameters.
[0037] 2. A data rebalancing loss function was designed based on the characteristics of the dataset to guide the model parameter update. This solved the problem that the decision boundary shift caused by class imbalance led to a decrease in model classification performance, resulting in inaccurate judgment results for obstructive sleep apnea events. Attached Figure Description
[0038] Figure 1 This is a schematic diagram of the preprocessing process for the lightweight time-frequency fusion signal analysis method guided by data rebalancing loss of the present invention;
[0039] Figure 2 This is a schematic diagram of the overall structure of the lightweight time-frequency fusion signal segment analysis model guided by data rebalancing loss constructed in the lightweight time-frequency fusion signal analysis method guided by data rebalancing loss of the present invention;
[0040] Figure 3This is a schematic diagram of the structure of the summation time-frequency fusion attention module constructed in the lightweight time-frequency fusion signal analysis method guided by data rebalancing loss of the present invention;
[0041] Figure 4 This is a schematic diagram of the structure of the multi-scale MLP module constructed in the lightweight time-frequency fusion signal analysis method guided by data rebalancing loss of the present invention;
[0042] Figure 5 This is a visualization of TSNE features in the lightweight time-frequency fusion signal analysis method guided by data rebalancing loss of this invention. Detailed Implementation
[0043] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments.
[0044] This invention relates to a lightweight time-frequency fusion signal classification method guided by data rebalancing loss. This invention utilizes a lightweight time-frequency information fusion model composed of multi-scale time-pass attention and summed time-frequency fusion attention to analyze physiological signals, and uses a designed class rebalancing loss function to guide model parameter updates to solve the class imbalance problem, thereby improving the accuracy of analyzing whether obstructive sleep apnea events have occurred in physiological signal segments.
[0045] Example 1
[0046] A lightweight time-frequency fusion signal classification method guided by data rebalancing loss includes the following steps:
[0047] Step 1: Input the raw ECG signal from the public dataset. After appropriate preprocessing, obtain 33,790 time series z, which are divided into training and test sets. Use the training set for training and the test set for testing.
[0048] Step 2: Input the time series z obtained in Step 1 into the physiological signal segment analysis model of the lightweight time-frequency information fusion Transformer guided by data rebalancing loss (e.g., Figure 2 The output will show the classification result as Normal or OSA state. The specific steps are: z sequentially passes through the Feature Extraction module, the Information Fusion module, and the Classifier module.
[0049] Step 3: Use the training set processed in Step 1 to train the model, use the data rebalancing loss function to constrain the results of the trained network, and then back-broadcast to update the parameters until the model performance converges to obtain the trained network model.
[0050] Step 4: Input the ECG signal of the test set after preprocessing in Step 1 into the model trained in Step 3, and finally output the classification and detection results.
[0051] Example 2
[0052] Based on Example 1, each step is performed according to the following procedure:
[0053] The specific process of step 1 is as follows:
[0054] Step 1.1, Signal Preprocessing. The ECG signal is segmented, filtered, R-peaks detected, and the RR interval (RRI) and R-peak amplitude (RA) extracted, linearly interpolated, and channel spliced.
[0055] The overall process is as follows Figure 1 As shown, the processing method details are as follows:
[0056] Fragmentation: Based on the annotations provided in the dataset, each individual signal is divided into 1-minute segments. For example, in the Apnea-ECG dataset, the sampling rate is 100Hz, so each signal segment has 100 × 60 = 6000 sampling points and a corresponding label. Furthermore, considering that OSA classification relies on continuous-time information, this method concatenates the two minutes before and after the current segment to form a 5-minute segment, while the label remains unchanged for the current 1 minute.
[0057] Filtering: The input raw ECG signal frequency band is preprocessed by applying a second-order Butterworth Band Pass Filter (BPPF), with a high-pass frequency of 5Hz and a low-pass frequency of 35Hz, to suppress high-frequency and low-frequency noise and preserve the original signal.
[0058] R-peak detection and extraction of RR interval (RRI) and R-peak amplitude (RA): The Hamilton algorithm is used to detect the position of the R-peak, obtaining the RR interval (RRI) and R-peak amplitude (RA). Median filtering is then used to remove noise present in the RR interval.
[0059] Linear interpolation: Because the RR interval and R peak amplitude have different data dimensions after extraction, the RRI and RA are interpolated to a sequence of length 900 to maintain dimensionality consistency. At this point, the RRI sequence is defined as... RA sequence is defined as Where 1 represents the number of channels and 900 represents the length of the interpolated sequence.
[0060] Channel concatenation (Concat): To fully utilize the extracted RR intervals and R peak amplitudes, they are concatenated across channels to obtain a time series. Then input the network model.
[0061] Step 1.2: The 33,790 time series z obtained from the preprocessing in Step 1.1 are divided into training set and test set. In order to verify its applicability and robustness to the physiological signal segment analysis task, the division is carried out proportionally on the basis of independent individuals.
[0062] The specific process of step 2 is as follows:
[0063] Step 2.1: Design a feature extraction module to achieve adaptive noise reduction and extraction of temporal features. This module includes Deep Residual Shrinking Networks (DRSNs) and Multi-Scale Temporal Attention Modules (MTCA) (such as...). Figure 2 (as shown in (a)) and consists of two convolutional layers (Conv1D) + normalization (BN) + ReLU module (CBL). The Deep Residual Shrinking Network (DRSNs) is responsible for dynamic denoising. The Multi-Scale Temporal Attention Module (MTCA) is responsible for adaptive filtering of multi-scale temporal information. Multiple convolutional layers are responsible for reducing sequence length and decreasing model computation.
[0064] First, the time series z is processed by Deep Residual Shrinking Networks (DRSNs) for adaptive denoising to obtain the denoised signal z. nr Then, z nr The input is fed into a lightweight multi-scale modeling module consisting of three layers of spatial and channel reconstruction convolutions (SCConv), batch normalization (BN), and ReLU activation functions stacked sequentially. A convolutional block attention module (CBAM) is then used to filter effective features in both the temporal and channel dimensions, thereby enhancing the overall model's temporal modeling capability. Finally, a multi-layer convolution (Conv1D) + normalization (BN) + ReLU module (CBL) is stacked to reduce the sequence length and computational cost. The resulting enhanced temporal feature is F.
[0065] Step 2.1.1: To implement soft thresholding of the feature sequence z, the DRSNs module designs a shrinking layer based on the residual network. The shrinking layer first performs global average pooling (GAP) and takes the absolute value of the feature sequence z. Then, a neural network consisting of a fully connected layer, batch normalization, ReLU, and sigmoid activation functions automatically learns the threshold τ, ultimately obtaining the denoised z. nr The soft threshold formula is:
[0066]
[0067] In formula (1), τ is the threshold and is a positive number, z is the input feature data, and z nr The output features are determined by thresholding. Thresholding shrinks the input feature data to near zero, achieving noise reduction.
[0068] Step 2.1.2, next we will denoise the feature z nr Input to a multi-scale time-pass attention module (MTCA) (e.g.) Figure 2 (a) shows the output as z m This module will z nr The input is fed into an SBL module consisting of three layers stacked sequentially, comprising spatial and channel reconstruction convolutions (SCConv), batch normalization (BN), and ReLU activation functions, to achieve lightweight multi-scale modeling. The modeled features are then filtered for effective features in both the temporal and channel dimensions using a convolutional block attention module (CBAM), thereby enhancing the overall model's temporal modeling capability. The final output is the adaptively filtered feature z. m .
[0069] Step 2.1.3, transfer feature z m The input is fed into a 2-layer convolutional (Conv1D) + normalization (BN) + ReLU module (CBL) to reduce the sequence length and computational cost. The enhanced temporal feature output is F.
[0070] Step 2.2, Design the Information Fusion module (e.g., Figure 2 (b) shows a module that achieves the fusion of time-domain and frequency-domain information with a relatively low parameter count. This module comprises Scalable Position Encoding (SPE), Additive Time-Frequency Fusion Attention (ATFA), and Multi-Scale MLP (MSM). SPE dynamically adds positional information to maintain the chronological order of the time series. ATFA and MLP together form a Transformer architecture to fuse time-domain and frequency-domain information, as well as integrate channel information.
[0071] Step 2.2.1: Input the temporal features F obtained by the feature extraction module into the SPE module to dynamically encode the temporal features to obtain features ψ. The extended positional encoding formula is as follows:
[0072] ψ=DWConv(F)×F (2)
[0073] In formula (2), ψ represents the feature after dynamic position encoding, DWConv is the depthwise convolution, and F is the time series feature after feature extraction. In addition, LayerNorm is used to normalize the feature ψ in order to ensure the stability of the data feature distribution and accelerate the convergence speed of the model.
[0074] Step 2.2.2, in order to reduce the number of model parameters while simultaneously fusing time-domain and frequency-domain information, an Additive Time-Frequency Fusion Attention Module (ATFA) was designed (e.g., ...). Figure 3 (As shown). This module calculates temporal attention from the weights of one-dimensional learnable parameters and temporal features, and enhances the frequency domain features of the sequence through a Fourier transform-convolution-inverse Fourier transform module. Subsequently, the temporal and frequency domain features are added along the channels to obtain time-frequency attention weights. Based on these weights, time-frequency weights are allocated to complete the fusion of temporal and frequency domain information, enhance the richness of feature extraction, and reduce the number of parameters, complexity, and computational cost of the self-attention mechanism.
[0075] like Figure 3 As shown, the ATFA model first maps the feature sequence ψ to a depthwise convolution. Where b is the batch size, n is the number of channels, and d is the sequence length. The use of depthwise convolution is primarily to reduce the number of model parameters and to introduce inductive bias into the self-attention mechanism, thereby accelerating model convergence.
[0076] Q=ψ*W Q (3)
[0077] V=ψ*W V (4)
[0078] In formulas (3) to (4), W Q and W V Q and V represent different linear matrices, and are different eigenvectors.
[0079] Subsequently, learnable parameters were designed. The weight allocation for each Q vector is dynamically learned, and the important information of the Q vector is extracted by dot product multiplication. Since the number of α parameters is small, the computational cost is small, which can reduce the computational complexity to a certain extent. At this time, the Q that allocates the weights is defined as Q'.
[0080] Q'=Q*α (5)
[0081] In formula (5), α is the learnable weight vector.
[0082] Since frequency domain and time domain information are complementary in signal processing, time-frequency fusion can improve model performance. This paper designs a 1D frequency domain enhancement module that conforms to time-series characteristics. This module converts the time domain signal into the frequency domain by performing a Fourier transform on Q, then extracts frequency domain features from the frequency domain perspective using 1D convolution, and finally uses inverse Fourier transform to convert the enhanced frequency domain features back into the time domain output Q. f The formula is shown below:
[0083] Q f =iFFT(f 1×3 (ReLU(f 1×3 (FFT(Q))))) (6)
[0084] In formula (6), FFT is Fast Fourier Transform, iFFT is Inverse Fourier Transform, and ReLU is the activation function that introduces nonlinear characteristics to the model. 1×3 This represents a 1D convolution with a kernel of 3.
[0085] To achieve the fusion of time-frequency information while reducing computational cost, Q' and Q' are... f As input, attention weights are obtained by channel concatenation and addition along the channel dimension. Then, weights are assigned to feature V through multiplication. Finally, residual connections are used to fuse low-level semantic information with globally modeled information, enhancing the model's feature extraction capability. This yields the time-frequency fusion feature ψ. attn .
[0086] ψ attn =∑ n concat(Q',Q f )×V+ψ (7)
[0087] In formula (7), Q f This represents the frequency domain query vector, and concat represents concatenation.
[0088] To fully utilize the time-frequency fusion global information extracted through the ATFA module, inspired by Res2Net, a multi-scale MLP (MSM) is used (e.g., Figure 4 As shown), the module integrates channel information. The entire module first integrates ψ... attn Local information is extracted using 1×1 convolution. Then in the passageway Divide into four equal parts. No direct mapping is performed. The remaining features are extracted using depthwise convolution (DWConv) and then information is exchanged using dot products. Finally, the four parts are concatenated, and channel information is integrated using a 1×1 convolution and SENet. At this point, the feature information is defined as MSM. The formula is as follows:
[0089]
[0090]
[0091] In formulas (8) and (9), σ is the Sigmoid activation function, f 1×1 This represents a convolution operation with a kernel of 1; SE stands for SENet. This represents each feature subset, and MT represents the features extracted from different feature subsets through depthwise convolution.
[0092] The calculation formula for the time-frequency information fusion module, obtained from the above description, is as follows:
[0093] ψ'=ATFA(Norm(ψ))+ψ (10)
[0094] ψ”=MSM(Norm(ψ'))+ψ' (11)
[0095] In formulas (10) and (11), ATFA is the summation time-frequency fusion attention module, Norm is LayerNorm, ψ' is the feature after time-frequency information fusion, and ψ” is the feature after time-frequency information fusion to complete channel information extraction and dimension transformation.
[0096] Step 2.3, the final step, is the classification module (Classifier), which classifies sleep apnea events based on the features ψ” output in step 2.2. This classification module consists of average pooling (Avgpool), fully connected layers (FC), and a softmax activation function. The above modules yield the predicted classification values for physiological signal segments. The formula is as follows:
[0097]
[0098] Step 2.4, based on the predicted value Whether the value is greater than 0.5 determines whether an OSA event has occurred. A value greater than 0.5 indicates an OSA state, while a value less than 0.5 indicates a normal event.
[0099] In step 3, during the training process, the data rebalancing loss is used to constrain the model constructed in step 2, as shown in formulas (13) to (20) below:
[0100] The main drawback of using cross-entropy loss in class imbalance problems is that it insists on equal learning across all classes. Due to the highly imbalanced distribution of class numbers, the model tends to favor the majority class during gradient backpropagation, suppressing the minority class. To address class imbalance, FocalLoss achieves balance by reducing the weights of the majority class and the weights of easy and difficult samples, while LDAM achieves class balance by adjusting the distance of samples from the boundary. To achieve a balance between easy and difficult samples and boundary awareness, LMFLoss combines FocalLoss and LDAM using hyperparameters, and its effectiveness in medical image classification is verified through experiments.
[0101] Although LMFLoss effectively combines the LDAM and FocalLoss losses, it still has the following problems: 1. LDAM weight allocation is based on the frequency of sample occurrences, and the weights are not updated afterward, ignoring the imbalance of samples within the batch; 2. LDAM adjusts the balance from a boundary-aware perspective, while FocalLoss assigns greater weights based on difficulty. The simple summation causes the boundary originally adjusted by LDAM to shift towards outlier samples due to the influence of FocalLoss, making the overall performance of the model worse than the cross-entropy loss function.
[0102] To address the aforementioned problems, a novel class rebalancing loss function, DRLoss, is designed. Inspired by the LMFLoss function, this loss function first incorporates a weighted memory unit (WMU) to address the issue of ignoring intra-batch sample imbalance. Subsequently, a classification penalty term (CPI) is designed to assign new weights from two different perspectives: misclassification and correct classification, in order to achieve a new balance. The overall formula for DRLoss is as follows:
[0103] L DRLoss =εL FL +(1-ε)L MLDAM (13)
[0104] L FL =-(1-p t ) δ log(p t (14)
[0105]
[0106]
[0107]
[0108] w = log(M × T) (18)
[0109] In formulas (13) to (18), ε is an adjustable hyperparameter, and LFL Let L be the FocalLoss loss function. MLDAM Represents the weighted LDAM, z y For the model output, Δy and Δj represent class dependency boundaries, k represents the number of classes, C is a constraint, and n j The number of samples for each category, p t For predicting probabilities, δ is an adjustable hyperparameter. w is a weighting factor consisting of the weighted memory units M and T, representing a classification penalty term.
[0110] The Weighted Memory Unit (WMU) primarily addresses the issue in designing an imbalanced loss function where simply using sample frequency ignores the quantitative imbalance that still exists within a batch. The WMU uses the sample weights within the current batch as a basis, drawing on historical information such as sample frequency and classification penalty weights from the previous batch. This allows for dynamic weight allocation from local to global, effectively mitigating both batch-level and overall imbalance. The formula is as follows:
[0111]
[0112] In formula (19), λ is a hyperparameter, t represents the current time, t-1 represents the previous time, and I represents the number of samples in a batch. The relationship between the weight value of the previous batch and the current batch is obtained through M, and the balance within the batch is better achieved through memory storage.
[0113] To adjust the LDAM decision boundary and organically combine LDAM and FocalLoss, a classification penalty term is designed. The core idea is to increase the model's attention to incorrectly predicted samples by imposing a larger penalty on them, while simultaneously adding correct prediction terms to supplement information and ensure the stability of correct predictions. This adjusts the LDAM decision boundary and achieves class rebalancing.
[0114]
[0115] In formula (20), θ is an adjustable hyperparameter, and P error P represents the incorrectly predicted sample. right This represents a correctly predicted sample.
[0116] Example 3
[0117] The preprocessed test set data is input into the model trained in step 3 to reproduce the experimental results. To obtain the optimal results and ensure model reproducibility, the hyperparameter settings are shown in Table 1. Specifically, the ECG channel is 1, the per-segment length is 60s, the learning rate is 1e-3, the decay rate (wd) is 1e-4, the number of Transformer layers (L) is 1, ε is 0.9, λ is 0.6, θ is 100, Epoch is the number of iterations (set to 100 here), the batch size is 64, and the optimizer is Adam.
[0118] Table 1
[0119]
[0120]
[0121] The comparative experimental results on the Apnea-ECG dataset are shown in Table 2 below. It is easy to see that, compared with other class-balanced loss function methods, this invention achieves higher accuracy and specificity across various evaluation metrics (including accuracy (ACC), sensitivity (Sen), specificity (Spec), and F1 score). This fully demonstrates the superior performance of the method designed in this invention. The Baseline model is the one constructed in step 2, using the cross-entropy loss function to guide model parameter updates. Subsequent loss functions were all tested using the same model and environment.
[0122] Table 2
[0123] Baesline 91.80 88.36 93.91 89.15 CBloss[1] 91.42 90.37 92.07 88.94 IBloss[2] 91.80 88.36 93.91 89.15 IBFocalLoss[2] 91.80 88.36 93.91 89.15 Focalloss[3] 90.18 88.13 91.45 87.27 LDAM[3] 91.34 86.92 94.07 88.45 BCELoss 90.87 86.41 93.63 87.84 EQLv2[4] 91.38 85.95 94.73 88.38 Seesaw[5] 38.16 100 0 55.24 DRLossOurs 92.12 88.40 94.42 89.54
[0124] Experimental results on the test set of the Apnea-ECG dataset are visualized using TSNE features, as shown below. Figure 5 As shown, observations reveal that the method designed in this invention can effectively distinguish between Normal and OSA states, verifying the effectiveness of the method designed in this paper.
[0125] [1]Y.Cui,M.Jia,T.-Y.Lin,Y.Song,and S.Belongie,“Class-Balanced LossBased on Effective Number of Samples,”presented at the Proceedings of theIEEE / CVF Conference on Computer Vision and Pattern Recognition,2019,pp.9268–9277.Accessed:Nov.09,2023.[Online].Available:https: / / openaccess.thecvf.com / content_CVPR_2019 / html / Cui_Class-Balanced_Loss_Based_on_Effective_Number_of_Samples_CVPR_2019_paper.html
[0126] [2]S.Park,J.Lim,Y.Jeon,and J.Y.Choi,“Influence-Balanced Loss forImbalanced Visual Classification,”presented at the Proceedings ofthe IEEE / CVFInternational Conference on Computer Vision,2021,pp.735–744.Accessed:Nov.12,2023.[Online].Available:https: / / openaccess.thecvf.com / content / ICCV2021 / html / Park_Influence-Balanced_Loss_for_Imbalanced_Visual_Classification_ICCV_2021_paper.html
[0127] [3]T.-Y.Lin,P.Goyal,R.Girshick,K.He,and P.Dollár,“Focal Loss forDense Object Detection.”arXiv,Feb.07,2018.Accessed:Nov.12,2023.[Online].Available:http: / / arxiv.org / abs / 1708.02002
[0128] [4]J.Tan,X.Lu,G.Zhang,C.Yin,and Q.Li,“Equalization Loss v2:A NewGradient Balance Approach for Long-tailed Object Detection,”in 2021 IEEE / CVFConference on Computer Vision and Pattern Recognition(CVPR),Nashville,TN,USA:IEEE,Jun.2021,pp.1685–1694.doi:10.1109 / CVPR46437.2021.00173.
[0129] [5]J.Wang et al.,“Seesaw Loss for Long-Tailed Instance Segmentation.”arXiv,Jun.17,2021.doi:10.48550 / arXiv.2008.10032.
Claims
1. A lightweight time-frequency fusion signal analysis method guided by data rebalancing loss, characterized in that: Specifically, the steps include the following: Step 1: Input the original ECG signals from the public dataset, perform preprocessing operations on the corresponding signals, and divide them into training and test sets; Step 2: Construct a lightweight time-frequency information fusion Transformer physiological signal analysis model guided by data rebalancing loss, and classify physiological signal segments using this model; Step 3: Use the training set processed in Step 1 to train the lightweight time-frequency information fusion Transformer physiological signal analysis model guided by the data rebalancing loss constructed in Step 2. Use the data rebalancing loss function to constrain the results obtained from training the network, and then back-relay to update the parameters until the model performance converges to obtain the trained network model. During the training process in step 3, the model constructed in step 2 is constrained using the data rebalancing loss, i.e., the following formulas (1) to (8): The formula for the category rebalancing loss function DRLoss is as follows: (1) (2) (3) (4) (5) (6) (7) (8) In formulas (1)~(8), For adjustable hyperparameters, FocalLoss loss function Represents the weighted LDAM, For model output, and This represents the category dependency boundary, k represents the number of categories, and C is a constraint. The number of samples for each category, To predict probabilities, The hyperparameter is adjustable; w is the weighting factor, which consists of the weighted memory unit M and the T classification penalty term. Here, M is a hyperparameter, t represents the current time step, t-1 represents the previous time step, and I represents the number of samples in a batch. The relationship between the weights of the previous batch and the current batch is obtained through M. By using a memory-based storage method, better batch balance can be achieved. For adjustable hyperparameters, Represents incorrectly predicted samples. Representative of correctly predicted samples; Step 4: Input the ECG signal of the test set after preprocessing in Step 1 into the model trained in Step 3, and finally output the classification and detection results.
2. The lightweight time-frequency fusion signal analysis method guided by data rebalancing loss according to claim 1, characterized in that: The preprocessing of the ECG signal in step 1 is as follows: The time series z is obtained by sequentially performing segmentation, filtering, R-peak detection and RR interval and R-peak amplitude extraction, linear interpolation, and channel splicing.
3. The lightweight time-frequency fusion signal analysis method guided by data rebalancing loss according to claim 2, characterized in that: In step 2, the physiological signal analysis model of the lightweight time-frequency information fusion Transformer guided by data rebalancing loss includes a feature extraction module, an information fusion module, and a classification module. The feature extraction module includes Deep Residual Shrinking Networks (DRSNs), Multi-Scale Temporal-Pass Fusion Attention (MTCA), and Multi-Layer Convolutional ReLU Module (CRL). The information fusion module consists of an scalable location coding module, an additive time-frequency fusion attention module (ATFA), and a multi-scale MLP module. The classification module includes average pooling, fully connected layers, and the Softmax activation function.
4. The lightweight time-frequency fusion signal analysis method guided by data rebalancing loss according to claim 3, characterized in that: The specific process of step 2 is as follows: Step 2.1: Process the time series z through a deep residual shrinking network (DRSNs) for adaptive denoising to obtain the denoised signal. ; Then The input is fed into an SBL module consisting of three layers of spatial and channel reconstruction convolutions (SCConv), batch normalization (BN), and ReLU activation functions stacked sequentially to achieve lightweight multi-scale modeling. A convolutional block attention module (CBAM) is then used to filter features in both the temporal and channel dimensions. Finally, the filtered features are sequentially processed through multiple layers of convolutions (Conv1D), normalization, and ReLU to reduce the sequence length, resulting in the enhanced temporal features as output. ; Step 2.2: Input the temporal feature F output in Step 2.1 into the Scalable Positional Encoding (SPE) for dynamic encoding. Then, input the dynamically encoded feature into the Transformer architecture, which includes the Attention Flow Amplification (ATFA) module and the Multi-Scale Multi-Level Processing (MLP) module, to complete the fusion of temporal and frequency domain information. Output the feature after time-frequency information fusion, which has completed channel information extraction and dimensionality transformation. ; Step 2.3, based on the features output in Step 2.2 Classification of obstructive sleep apnea events yields physiological signal segment classification prediction values. The formula is as follows: (9) Step 2.4, based on the predicted value obtained in Step 2.3 Whether an OSA event has occurred is determined by whether the value is greater than 0.
5. A value greater than 0.5 indicates an obstructive sleep apnea event, while a value less than 0.5 indicates a normal event.
Citation Information
Patent Citations
Adaptive rate adjustment method of LPWAN internet of things based on network condition
CN108093436A
Long tail distribution method based on feature space distribution uniformity
CN116168268A