Sleep apnea classification device based on lightweight deep learning

By using an adaptive fusion module with a dual-branch neural network and a cross-scale attention mechanism, the problem of insufficient multi-granularity feature extraction and fusion in existing technologies is solved, achieving high-precision sleep apnea detection and reducing model complexity, making it suitable for resource-constrained wearable devices and edge computing platforms.

CN121786554APending Publication Date: 2026-04-03AEROSPACE INFORMATION RES INST CAS
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-04
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing sleep apnea detection methods based on ECG signals lack the ability to extract and fuse multi-granularity features, and the models are complex and difficult to deploy in resource-constrained scenarios.

Method used

A lightweight deep learning device is constructed, which uses a dual-branch neural network structure to process short-window and long-window ECG signals in parallel. Combined with a cross-scale attention mechanism and an adaptive fusion module, it realizes the dynamic extraction and fusion of multi-granularity features.

Benefits of technology

It significantly improves the accuracy of sleep apnea classification, reduces the model parameter size and computational overhead, and is suitable for deployment on wearable devices and edge computing platforms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121786554A_ABST
    Figure CN121786554A_ABST
Patent Text Reader

Abstract

The invention discloses a sleep apnea classification device based on lightweight deep learning, and the device mainly comprises a double-branch feature extraction unit which is used for carrying out the parallel processing of long and short window ECG signals inputted by a global branch and a local branch, and respectively extracting the dynamic features of different granularities; the cross-scale attention mechanism unit is used for fusing cross-scale channel attention and cross-scale time attention and realizing dynamic weighted selection of features in channel dimensions and time dimensions under different time scales; and the self-adaptive feature fusion unit is used for generating a gating signal by utilizing global feature information of the global branch, dynamically adjusting the relative contribution degree of feature representation of the local branch and the global branch, and fusing the local branch and the global branch into enhanced combined feature representation for classification of sleep apnea. The device can effectively extract and fuse the multi-granularity features of the short time interval and the long time interval, improve the classification precision, reduce the model parameter scale and the calculation complexity, and facilitate the deployment of edge equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of sleep apnea assessment and physiological signal processing technology, and in particular to a sleep apnea classification device based on lightweight deep learning, belonging to the interdisciplinary field of medical artificial intelligence and wearable device intelligent diagnosis. Background Technology

[0002] Currently, sleep apnea (SA) detection methods based on single-lead electrocardiogram (ECG) signals mainly rely on deep learning models to classify ECG time-series signals. These methods typically employ a fixed window segmentation strategy, processing the entire night's ECG signal into segments, and extracting features and performing classification using architectures such as one-dimensional convolutional neural networks (1D-CNN), recurrent neural networks (RNN), and long short-term memory networks (LSTM). Typical implementations include: (1) Short window analysis method: A common approach is to divide the ECG signal into one-minute segments, with each segment treated as an independent sample and input into a deep network for feature extraction and classification. The advantages of this method are its simple model structure, high training efficiency, and ability to capture fine-grained local ECG dynamics. However, its disadvantage is that it ignores contextual temporal dependencies and fails to perceive trend features before and after sleep apnea events, thus limiting overall classification accuracy.

[0003] (2) Long window analysis method: Another type of method uses a longer time period (e.g., 5 minutes) as input to capture long-term features reflecting SA events, such as heart rate variability. This type of method enhances contextual modeling capabilities but also introduces significant problems: • The model size and computational cost increase significantly, making it unsuitable for deployment on edge devices; • Long-term signals may contain information that is irrelevant to the current state, which may dilute key features and affect classification performance; (3) Long and short window combined analysis method: To address the insufficient information at a single time scale, some studies have attempted to introduce multi-scale input mechanisms, simultaneously inputting ECG signal segments of different durations (e.g., 1 minute and 5 minutes) into the model to simultaneously acquire local details and global contextual information. These methods typically employ the following strategies: • Use multiple input branches to receive short window (1 min), medium window (3 min), and long window (5 min) signals respectively; • Each branch obtains its own feature representation through an independent feature extraction network (such as a convolutional network or an attention network); • Finally, features from different time scales are spliced, weighted, or fused for classification.

[0004] This method improves the model's ability to model multi-granularity features to some extent. However, it still has the following shortcomings in practical implementation: • Multiple input branches introduce parameter redundancy and resource overhead, which is not conducive to model lightweighting; • Fusion mechanisms generally lack “intelligence”, mostly using simple splicing or fixed weighting, making it difficult to adaptively adjust the importance of features at each scale according to the dynamic characteristics of the input; • The lack of a modeling mechanism for “cross-scale interaction” between features at different time scales leads to redundancy, conflict, or noise amplification in the fused information.

[0005] Therefore, although the combined long and short window analysis method has certain advantages, there is still considerable room for optimization in terms of feature fusion strategy, model efficiency, and deployment adaptability.

[0006] In summary, current technologies generally suffer from the following two core problems: First, multi-granularity features are not fully utilized. The impact of SA events on cardiac activity spans multiple time scales, manifesting as instantaneous rhythm changes in the short term and trend-based heart rate variability in the long term. Although some studies have attempted to model features of different granularities using fixed-length windows or dual-input structures, they often employ static splicing or averaging fusion strategies in the actual fusion stage, lacking dynamic adjustment mechanisms for the importance of features at different scales. This results in insufficient synergy of multi-scale information and inadequate expression of key features, limiting the classification accuracy of the model.

[0007] Secondly, the models are complex and difficult to deploy. Most existing research is based on complex structures such as deep networks, dual-path architectures, or Transformer models. Although these can improve accuracy to some extent, they usually have large parameter scales, slow inference speeds, and high energy consumption, making them difficult to adapt to resource-constrained scenarios such as low-power consumption and edge computing, such as wearable ECG devices or portable diagnostic terminals. Summary of the Invention

[0008] To address the shortcomings of existing ECG-based sleep apnea detection methods, such as insufficient multi-granularity feature extraction and fusion capabilities and complex models that are difficult to deploy, this disclosure provides a lightweight deep learning device to improve the classification accuracy of sleep apnea. It combines multi-granularity perception capabilities with a lightweight architecture. By introducing a simple yet highly expressive multi-branch feature extraction structure and an attention fusion module with an adaptive control mechanism, it fundamentally improves classification accuracy and meets the needs of terminal deployment.

[0009] The design concept of this device is as follows: • A dual-branch neural network structure processes short-window (e.g., 1 minute) and long-window (e.g., 5 minutes) ECG segments separately, enabling parallel extraction of fine-grained and coarse-grained features; • A cross-scale attention mechanism for the feature interaction stage weights and adjusts features from different time scales in both channel and time dimensions to improve the expression of key features. • An adaptive fusion mechanism for the feature integration stage dynamically generates gating signals based on global semantic information to guide the contribution allocation of different branches, thereby achieving intelligent information fusion; • In the overall network structure design, the principle of lightweight is followed, and a small number of convolutional channels, shallow structure and simple module design are adopted to make the model have the characteristics of high efficiency and low resource consumption.

[0010] Therefore, a deployable and high-performance lightweight deep learning system was constructed for sleep apnea event detection of single-lead ECG signals. It can effectively improve classification accuracy and reduce the deployment threshold, and has significant practical value and application prospects.

[0011] Lightweight deep learning devices that improve the accuracy of sleep apnea classification based on the above ideas mainly include: Dual-branch feature extraction unit: used to process short-window ECG signals from local branch input and long-window ECG signals from global branch input in parallel, extracting fine-grained dynamic features in the short time period and coarse-grained trend features in the long time period, respectively. Cross-scale attention mechanism unit: integrates cross-scale channel attention and cross-scale temporal attention to achieve dynamic weighted selection of features in the channel dimension and temporal dimension at different time scales; Adaptive Feature Fusion Unit: Generates a gating signal using global feature information from the global branch, dynamically adjusts the relative contribution of the feature representations of the local branch and the global branch, and fuses them into an enhanced joint feature representation for the classification of sleep apnea.

[0012] Furthermore, the dual-branch feature extraction unit employs a two-stream convolutional neural network to process short segments of input from local branches and long segments of input from global branches in parallel; each stream network consists of multiple stacked convolutional blocks, each convolutional block containing: One-dimensional convolutional layer: Using a convolutional kernel of a set size, it scans the input signal along the time dimension to extract local temporal patterns; Batch normalization layer: Following the convolutional layer, it is used to accelerate the convergence speed during model training, improve the generalization ability of the model, and reduce the sensitivity to initialization parameters. Nonlinear activation layer: Using modified linear units, nonlinear expressive power is introduced into the model, enabling it to learn more complex function mappings; Max pooling layers are used to downsample in both time and feature dimensions to reduce the computational cost and number of parameters in subsequent layers, prevent overfitting, increase the receptive field of neurons, and provide a certain degree of translation invariance.

[0013] Furthermore, the cross-scale attention unit includes: a cross-scale channel attention subunit and a cross-scale temporal attention subunit; wherein: The cross-scale channel attention subunit is used to learn and adjust the interrelationships and importance between corresponding channels of feature maps at different scales. The computational cost is related to the number of channels. Cross-scale temporal attention subunits are used to assign attention weights at different time scales, and the computational cost is related to the sequence length. Cross-scale channel attention subunits are deployed in the early stage of the network, and cross-scale temporal attention subunits are deployed in the later stage of the network. The early stage and the later stage of the network are the first few layers and the last few layers of the neural network, respectively. Each of them deploys a dual-branch feature extraction unit and a cross-scale attention unit.

[0014] Furthermore, the cross-scale channel attention subunit is relevant to local branch inputs. and global branch input It processes input sequences at local and global time scales respectively, where B represents the batch size. , These represent the sequence length, and C represents the number of channels; The processing procedure includes the following steps: ① Scale feature compression: For the feature map of each branch and Global average pooling is applied along the time dimension L to compress the overall response of each channel at the corresponding time scale into a scalar value, thus obtaining the channel statistics. and :

[0015] ② Joint cross-scale excitation: The compressed channel statistical vector and The data is concatenated and then fed into a shared activation module, which is a fully connected layer with a bottleneck structure, to generate a joint attention vector.

[0016] in, Indicates a splicing operation; and The weight matrix is ​​a learnable weight matrix; Represents the ReLU activation function; This represents the Sigmoid activation function; r is the compression ratio; ③ Scale-specific recalibration: the generated joint attention vector It contains joint adjustment information for the feature channels at both scales. To apply this information back to the original local and global feature maps respectively, the following steps are taken: Divide into two parts equally along the channel dimension: and The local branch weights and global branch weights are applied back to the original feature map through element-wise multiplication. and ;

[0017] in, It represents element-wise multiplication, and Dropout is used for regularization.

[0018] Furthermore, the only difference between the cross-scale temporal attention subunit and the cross-scale channel attention subunit in terms of specific processing methods and processes is that the feature map is compressed along the channel dimension to preserve complete sequence information, rather than compressed along the temporal dimension.

[0019] Furthermore, the processing procedure of the adaptive fusion unit includes the following steps: Let the local and global branch inputs be respectively: , Where B represents the batch size, , C represents the sequence length, and C represents the number of channels; ① Global scale compression: for input Global average pooling is applied along the sequence length dimension L, aggregating the responses of each channel across the entire sequence into a single scalar descriptor:

[0020] ②Gating weight generation: The generation of the gating weight α is entirely based on the compression features of the global branch. : Processed through a linear transformation layer The C-dimensional channel information is mapped to a single scalar value; then, the Sigmoid activation function σ(·) is applied to constrain this value within the interval (0, 1), generating a gating weight α. This weight reflects the... The pairs obtained from global feature calculation Assessment of its own importance:

[0021] Accordingly, the weight β of the local branch is calculated using the complementarity relation: ; ③ Two-branch fusion: The generated gating weights α and β are used to compress the original feature vectors of the two branches. and Perform weighted modulation:

[0022]

[0023] in and These are learnable parameters; This represents the Sigmoid activation function; These two weighted feature vectors are concatenated along the channel dimension to form the final fused feature output:

[0024] An enhanced feature representation that integrates information from the two original branches is used for the classification of sleep apnea.

[0025] Compared with the prior art, the beneficial effects of this disclosure are: (1) In terms of feature extraction: Based on the dual-branch structure, the ability to model multi-scale physiological information is significantly improved. Unlike existing methods that rely on a single time window or static multi-input structure, this disclosure innovatively introduces a parallel structure of local branches and global branches to process short-term (1 minute) and long-term (5 minute) ECG segments respectively, fully capturing instantaneous rhythm changes and trend changes in ECG signals, realizing collaborative modeling of local fine-grained features and global coarse-grained features, and effectively avoiding the problems of information loss and redundancy.

[0026] (2) In terms of feature fusion: a cross-scale attention mechanism is introduced to achieve dynamic weighting and deep interaction. Existing multi-input fusion strategies mostly employ simple concatenation or fixed weighting, lacking dynamic evaluation of the importance of features at different scales and failing to flexibly adjust based on sample differences. To address this, this disclosure designs cross-scale channel attention and cross-scale temporal attention units, dynamically weighting features at different scales in the channel and temporal dimensions respectively. This strengthens the representation of key information, suppresses irrelevant noise, and promotes deep interaction modeling between scales, significantly enhancing the model's ability to discriminate sleep apnea events.

[0027] (3) In terms of fusion strategy: introduce a gating mechanism to achieve adaptive feature integration Compared to traditional static fusion methods, this disclosure uses an adaptive fusion unit to generate gating weights using global features, dynamically adjusting the proportion of local and global features in the final feature representation, achieving "self-adjustment of information contribution," and further enhancing the model's generalization ability and robustness.

[0028] (4) In terms of model efficiency: The overall lightweight design is adapted to resource-constrained devices. Compared to existing methods, this disclosure addresses structural design, significantly reducing parameter size and computational overhead. The model contains only about 24KB of parameters and requires only 0.47 MFLOPs of computation, far lower than existing similar methods. It supports real-time deployment and operation in resource-constrained scenarios such as wearable devices and edge computing platforms, demonstrating promising prospects for practical applications. Attached Figure Description

[0029] The above and other objects, features and advantages of this disclosure will become more apparent from the more detailed description of exemplary embodiments of this disclosure taken in conjunction with the accompanying drawings, in which the same reference numerals generally represent the same components.

[0030] Figure 1 This is a schematic diagram of a system composition according to an exemplary embodiment of the present disclosure; Figure 2 This is an example of a cross-scale attention unit; Figure 3 This is a confusion matrix diagram based on different classification models. Detailed Implementation

[0031] Preferred embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While preferred embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be thorough and complete, and will fully convey the scope of the present disclosure to those skilled in the art.

[0032] To effectively extract and fuse short-term and long-term multi-granular features from single-lead ECG signals to improve classification accuracy, and to reduce model parameter size and computational complexity while ensuring detection performance, making it easier to deploy on edge devices, this disclosure provides a sleep apnea classification device based on a lightweight deep learning model for automatic identification of sleep apnea events in single-lead ECG (electrocardiogram) signals.

[0033] The device mainly includes: (1) Dual-branch feature extraction structure: A dual-branch network architecture consisting of local and global branches is constructed to process short-window (e.g., 1 minute) ECG signals input from the local branch and long-window (e.g., 5 minutes) ECG signals input from the global branch, respectively. Fine-grained dynamic features of the short time period and coarse-grained trend features of the long time period are extracted, effectively improving the modeling ability of SA-related features at different time scales.

[0034] (2) Cross-scale attention mechanism (CSA): This mechanism integrates cross-scale channel attention and cross-scale temporal attention to achieve dynamic weighted selection of features across the channel and temporal dimensions at different time scales. This fosters deep interaction between features at different scales, enhances the expressive power of key features, and suppresses redundant or irrelevant information.

[0035] (3) Adaptive feature fusion unit: An adaptive fusion strategy based on a gating mechanism is adopted, which uses global branches to generate fusion weights and dynamically controls the contribution of local and global features in the final output. This achieves intelligent and adjustable multi-scale information integration, effectively improving the discriminative ability of the final feature representation.

[0036] To further improve model performance and deployment adaptability, the following optimization methods were also adopted: (1) Lightweight model design strategy: By optimizing parameters such as the number of convolutional kernels, the number of channels, and the network depth, the overall model parameters are compressed to approximately 24KB, and the computational complexity is controlled at 0.47 MFLOPs, achieving a balance between high accuracy and low computational overhead. This makes the model suitable for wearable ECG monitoring devices and edge computing platforms.

[0037] (2) Attention module location optimization deployment strategy: By deploying the channel attention module in the front end of the network (where there are fewer channels) and the time attention module in the back end of the network (where the time duration is shorter), the overall computational overhead can be reduced while maintaining fusion efficiency, thereby optimizing the resources and maximizing the functionality of the attention mechanism.

[0038] (3) Scalability and compatibility of the fusion mechanism: The adaptive fusion mechanism supports seamless replacement of other feature fusion methods, such as weighted averaging, residual fusion, and graph convolution fusion. It can be flexibly extended to multi-input models with different structures, laying a general foundation for subsequent multimodal signal fusion.

[0039] In one exemplary embodiment, a lightweight deep learning device for improving the classification accuracy of sleep apnea according to this disclosure has the structure shown in the attached figure. Figure 1As shown, it consists of a dual-branch feature extraction unit 3, a cross-scale attention unit (composed of two sub-units: a cross-scale channel attention unit 4 and a cross-scale temporal attention unit 5), and an adaptive fusion unit 6.

[0040] (1) Dual-branch feature extraction unit 3: This unit is constructed using a two-stream convolutional neural network, processing local branch 1 (1-minute segment input) and global branch 2 (5-minute segment input) in parallel. Each stream network consists of multiple stacked convolutional blocks, each typically containing: ① One-dimensional convolutional layer (Conv1D Layer): Uses a specific kernel size (kernel size 11, padding 5 to keep the sequence length basically unchanged) to scan the input signal along the time dimension and extract local temporal patterns. The number of convolutional kernels (i.e., the number of output channels) can be increased layer by layer to 16, 24, 32, 48, etc., to learn more abstract feature representations; ② Batch Normalization Layer: Following the convolutional layer, it is used to accelerate the convergence speed during model training, improve the generalization ability of the model, and reduce the sensitivity to initialization parameters. ③ Nonlinear Activation Layer: Using Rectified Linear Unit (ReLU), nonlinear expressive power is introduced into the model, enabling it to learn more complex function mappings; ④ Max pooling layer: Downsampling is performed in both time and feature dimensions. On the one hand, it can reduce the computational cost and number of parameters in subsequent layers and prevent overfitting. On the other hand, it can increase the receptive field of neurons and provide a certain degree of translation invariance.

[0041] (2) Cross-scale attention unit: Traditional attention methods are often used for single-scale or homogeneous features, which are difficult to fully address the inherent heterogeneity of multi-scale features in tasks. Therefore, the cross-scale attention unit includes two sub-units: cross-scale channel attention unit 4 and cross-scale temporal attention unit 5.

[0042] The cross-scale channel attention unit 4 focuses on learning and adjusting the interrelationships and importance between corresponding channels of feature maps at different scales, and the computational cost is related to the number of channels; The cross-scale temporal attention unit 5 focuses on the weighting of key time steps in the sequence dimension, which is used to allocate attention weights at different time scales. The computational cost is related to the sequence length.

[0043] In the network architecture of this embodiment, based on the dimensionality and computational efficiency of feature maps at different network depths, these two modules are strategically deployed: the cross-scale channel attention unit 4, whose computational cost is related to the number of channels C, is applied in the early stage of the network (when C is small and L is large), while the cross-scale temporal attention unit 5, whose computational cost is more related to the sequence length L, is deployed in the later stage of the network (when L is significantly reduced and C is increased). This design aims to efficiently achieve deep fusion of cross-scale information and meet the requirements of lightweight design.

[0044] In this embodiment, the cross-scale attention unit structure is shown in the attached figure. Figure 2 As shown.

[0045] Specifically, the cross-scale channel attention unit 4 is used for local branch inputs. and global branch input It processes input sequences at local and global time scales respectively, where B represents the batch size. , Here, C represents the sequence length and the number of channels, respectively. This process involves the following steps: ① Scale feature compression: For the feature map of each branch and Applying global average pooling along the time dimension L7, this step compresses the overall response of each channel at the corresponding time scale into a scalar value, effectively capturing the core feature expression of that channel at that scale and obtaining the channel statistics. and :

[0046] ② Joint cross-scale excitation: In order to capture and model the interdependence between feature channels of two scales, in this embodiment, the compressed channel statistical vectors are... and The data is concatenated and then fed into a shared activation module, typically a fully connected layer 8 with a bottleneck structure, to generate a joint attention vector.

[0047] in Indicates a splicing operation; and The weight matrix is ​​a learnable weight matrix; Represents the ReLU activation function; This represents the Sigmoid activation function; r is the compression ratio.

[0048] ③ Scale-specific recalibration: the generated joint attention vector It contains joint adjustment information for the feature channels at both scales. In order to apply this information back to the original local and global feature maps respectively, in this embodiment, Divide into two parts equally along the channel dimension: and The local branch weight 9 and the global branch weight 10 are applied back to the original feature map through element-wise multiplication. and This step enables adaptive recalibration of each channel in the feature map at each scale, enhancing information-relevant channel features while suppressing relatively unimportant channels.

[0049] in, This indicates element-wise multiplication. Dropout can be applied to regularization.

[0050] Another key subunit of the cross-scale attention unit is the cross-scale temporal attention unit. Unlike the cross-scale channel attention unit, which focuses on the channel dimension, the cross-scale temporal attention unit focuses on capturing and utilizing cross-scale information along the time (sequence) dimension. The main difference lies in the fact that feature map compression is performed along the channel dimension to preserve complete sequence information, rather than along the time dimension. Given its high similarity to the cross-scale channel attention unit in design philosophy and process, its specific implementation details will not be elaborated here.

[0051] (3) Adaptive Fusion Unit: In multi-branch neural network architectures, such as dual-branch networks handling different context scales or feature types, the final feature fusion strategy plays a decisive role in the overall performance of the model. To achieve effective integration of information between branches, an adaptive fusion unit is designed in this embodiment. The core idea of ​​this unit is to use the global feature information of a global branch to generate a gating signal, which is then used to dynamically adjust the relative contribution of the feature representations of the two branches, and finally fuse them into an enhanced joint feature representation for the classification of sleep apnea.

[0052] Specifically, for two-branch input , Where B represents the batch size, , C represents the sequence length and the number of channels.

[0053] ① Global scale compression: To obtain a global context summary of the feature maps of each branch, the input is compressed. Global average pooling is applied along the sequence length dimension L. This operation aims to aggregate the responses of each channel across the entire sequence into a single scalar descriptor, thereby providing compact global information for subsequent gating weight generation.

[0054]

[0055] ②Gated weight generation: The generation of gated weight α is entirely based on the compression features of the global branch. Processed through a linear transformation layer The C-dimensional channel information is mapped to a single scalar value. Then, the sigmoid activation function σ(·) is applied to constrain this value within the interval (0, 1), generating a gating weight α. This weight reflects the... The pairs obtained from global feature calculation Assessment of its own importance:

[0056] Accordingly, the weight β of the local branch is calculated using the complementarity relation:

[0057] ③ Two-branch fusion: The generated gating weights α and β are used to compress the original feature vectors of the two branches. and Perform weighted modulation:

[0058]

[0059] in, and These are learnable parameters; This represents the Sigmoid activation function. Finally, these two weighted feature vectors are concatenated along the channel dimension to form the final fused feature output:

[0060] This unit outputs This is an enhanced feature representation that fuses information from two original branches. The representation preserves the channel information from both branches and, through... The generated gating weights were adaptively weighted.

[0061] Compared with existing methods that use only 1-minute and 5-minute windows with a single branch (the single branch model in this embodiment omits the cross-scale attention and adaptive feature fusion units), the results are shown in the appendix. Figure 3 As shown: (1) Existing method: Classification accuracy: 1-minute segment input accuracy: 86.58%; 5-minute segment input accuracy: 91.43%; The accuracy rate of the method in this embodiment is 92.99%.

[0062] (2) The number of parameters (24KB) and the computational cost (0.47 M FLOPs) are much lower than those of existing models.

[0063] The above technical solutions are merely exemplary embodiments of the present invention. For those skilled in the art, based on the application methods and principles disclosed in the present invention, it is easy to make various types of improvements or modifications, and not limited to the methods described in the specific embodiments of the present invention. Therefore, the methods described above are merely preferred and not restrictive.

Claims

1. A sleep apnea classification device based on lightweight deep learning, characterized in that, include: Dual-branch feature extraction unit: used to process short-window ECG signals from local branch input and long-window ECG signals from global branch input in parallel, extracting fine-grained dynamic features in the short time period and coarse-grained trend features in the long time period, respectively. Cross-scale attention mechanism unit: integrates cross-scale channel attention and cross-scale temporal attention to achieve dynamic weighted selection of features in the channel dimension and temporal dimension at different time scales; Adaptive Feature Fusion Unit: Generates a gating signal using global feature information from the global branch, dynamically adjusts the relative contribution of the feature representations of the local branch and the global branch, and fuses them into an enhanced joint feature representation for the classification of sleep apnea.

2. The apparatus according to claim 1, characterized in that, The dual-branch feature extraction unit employs a two-stream convolutional neural network to process short segments of input from local branches and long segments of input from global branches in parallel. Each stream of the network consists of multiple stacked convolutional blocks, and each convolutional block contains: One-dimensional convolutional layer: Using a convolutional kernel of a set size, it scans the input signal along the time dimension to extract local temporal patterns; Batch normalization layer: Following the convolutional layer, it is used to accelerate the convergence speed during model training, improve the generalization ability of the model, and reduce the sensitivity to initialization parameters. Nonlinear activation layer: Using modified linear units, nonlinear expressive power is introduced into the model, enabling it to learn more complex function mappings; Max pooling layers are used to downsample in both time and feature dimensions to reduce the computational cost and number of parameters in subsequent layers, prevent overfitting, increase the receptive field of neurons, and provide a certain degree of translation invariance.

3. The apparatus according to claim 1, characterized in that, The cross-scale attention unit includes: a cross-scale channel attention subunit and a cross-scale temporal attention subunit; wherein: The cross-scale channel attention subunit is used to learn and adjust the interrelationships and importance between corresponding channels of feature maps at different scales. The computational cost is related to the number of channels. Cross-scale temporal attention subunits are used to assign attention weights at different time scales, and the computational cost is related to the sequence length. Cross-scale channel attention subunits are deployed in the early stage of the network, and cross-scale temporal attention subunits are deployed in the later stage of the network. The early stage and the later stage of the network are the first few layers and the last few layers of the neural network, respectively. Each of them deploys a dual-branch feature extraction unit and a cross-scale attention unit.

4. The apparatus according to claim 3, characterized in that, The cross-scale channel attention subunit for local branch input and global branch input It processes input sequences at local and global time scales respectively, where B represents the batch size. , These represent the sequence length, and C represents the number of channels; The processing procedure includes the following steps: ① Scale feature compression: For the feature map of each branch and Global average pooling is applied along the time dimension L to compress the overall response of each channel at the corresponding time scale into a scalar value, thus obtaining the channel statistics. and : ② Joint cross-scale excitation: The compressed channel statistical vector and The data is concatenated and then fed into a shared activation module, which is a fully connected layer with a bottleneck structure, to generate a joint attention vector. in, Indicates a splicing operation; and The weight matrix is ​​a learnable weight matrix; Represents the ReLU activation function; This represents the Sigmoid activation function; r is the compression ratio; ③ Scale-specific recalibration: the generated joint attention vector It contains joint adjustment information for the feature channels at both scales. To apply this information back to the original local and global feature maps respectively, the following steps are taken: Divide into two parts equally along the channel dimension: and The local branch weights and global branch weights are applied back to the original feature map through element-wise multiplication. and ; in, It represents element-wise multiplication, and Dropout is used for regularization.

5. The apparatus according to claim 4, characterized in that, The only difference between the cross-scale temporal attention subunit and the cross-scale channel attention subunit in terms of specific processing methods and processes is that the feature map is compressed along the channel dimension to preserve complete sequence information, rather than compressed along the time dimension.

6. The apparatus according to claim 4 or 5, characterized in that, The processing procedure of the adaptive fusion unit includes the following steps: Let the local and global branch inputs be respectively: , Where B represents the batch size, , C represents the sequence length, and C represents the number of channels; ① Global scale compression: for input Global average pooling is applied along the sequence length dimension L, aggregating the responses of each channel across the entire sequence into a single scalar descriptor: ②Gating weight generation: The generation of the gating weight α is entirely based on the compression features of the global branch. : Processed through a linear transformation layer The C-dimensional channel information is mapped to a single scalar value; then, the Sigmoid activation function σ(·) is applied to constrain this value within the interval (0, 1), generating a gating weight α. This weight reflects the... The pairs obtained from global feature calculation Assessment of its own importance: Accordingly, the weight β of the local branch is calculated using the complementarity relation: ; ③ Two-branch fusion: The generated gating weights α and β are used to compress the original feature vectors of the two branches. and Perform weighted modulation: in and These are learnable parameters; This represents the Sigmoid activation function; These two weighted feature vectors are concatenated along the channel dimension to form the final fused feature output: An enhanced feature representation that integrates information from the two original branches is used for the classification of sleep apnea.