Insomnia recognition method based on the fusion of short-term and long-term temporal features from ECG
The fusion of long-term and short-term ECG features using deep learning techniques addresses the limitations of traditional insomnia diagnosis methods, enhancing accuracy and efficiency in identifying insomnia through advanced signal processing and classification.
Patent Information
- Application Number
- TW114138766
- Authority / Receiving Office
- TW · TW
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2025-10-08
- Publication Date
- 2026-07-11
- Estimated Expiration
- 2045-10-07
AI Technical Summary
Current clinical diagnosis and assessment methods for insomnia, such as polysomnography and multiple sleep latency tests, are cumbersome, costly, and limited in widespread application due to their requirement for specialized equipment and environments, affecting accuracy and convenience.
An insomnia identification method based on the fusion of long-term and short-term electrocardiogram (ECG) features using advanced deep learning technology, including signal preprocessing, multi-timescale feature extraction, and classification, employing techniques like R-peak normalization, residual networks, and long short-term memory networks to analyze ECG signals.
Improves the accuracy of insomnia detection by stabilizing signal amplitudes, capturing temporal dependencies, and reducing computational burden, enabling efficient and accurate identification of insomnia events.
Smart Images

Figure IMG-2_DRAW_114138766-A0305-14-0001-1 
Figure IMG-2_DRAW_114138766-A0305-14-0002-2 
Figure IMG-2_DRAW_114138766-A0305-14-0003-3
Abstract
Description
Technical Field
[0001] This invention relates to an identification method for insomnia based on electrocardiogram (ECG), specifically an insomnia identification method based on the fusion of long-term and short-term temporal features of ECG. Prior Technology
[0002] Insomnia is a common sleep disorder affecting the health and lives of millions of people worldwide. Its characteristics typically include poor sleep quality, difficulty falling asleep, frequent awakenings during the night, or waking up too early in the morning and being unable to fall back asleep. These sleep disorders significantly impact daily life, leading to lethargy, decreased work and study efficiency, and potentially triggering a range of health risks over time. In addition to physical fatigue, chronic insomnia can damage mental health, causing poor concentration, mood swings, irritability, and anxiety. Over time, it can even lead to more serious psychological problems such as depression and anxiety disorders. Therefore, early identification and effective treatment of insomnia not only help improve an individual's quality of life but also reduce health risks, making it crucial for maintaining overall physical and mental well-being.
[0003] Following the foregoing, current clinical diagnosis and assessment of insomnia primarily rely on two standard methods: polysomnography (PSG) and multiple sleep latency tests (MSLT). These methods typically require specialized medical equipment, are cumbersome, time-consuming, and costly. Furthermore, the testing process is inconvenient because subjects must undergo the tests in specialized sleep laboratories, an environment that can severely disrupt their daily routines. Many subjects also struggle to fall asleep in unfamiliar settings, affecting the accuracy of the tests and consequently the effectiveness of clinical diagnosis and assessment. Moreover, while these methods are considered the gold standard for insomnia diagnosis and assessment, their cost and time constraints limit their widespread application to large-scale insomnia screening and continuous monitoring. Therefore, to reduce the human and time costs required for insomnia identification, the inventors of this invention have dedicated themselves to research and development, addressing the aforementioned problems through multiple rounds of research and improvement, leading to this application for the present invention. Summary of the Invention
[0004] Therefore, the purpose of this invention is to provide an insomnia identification method based on the fusion of long and short-term time features of electrocardiograms, which can effectively improve the accuracy of assessing or identifying whether an electrocardiogram indicates an insomnia event.
[0005] Therefore, this invention provides an insomnia identification method based on the fusion of long-term and short-term electrocardiogram (ECG) features. This method is executed by computer software to automatically detect and identify the input ECG signals from the subject. The aforementioned ECG signals at least include the characteristic morphologies of P waves, QRS complexes, and T waves. The method includes signal preprocessing, multi-timescale feature extraction, feature fusion, and classification steps. Firstly, the preprocessing step removes noise from the original input signal and processes it using two-level adaptive R-peak normalization to ensure signal consistency between different subjects and different time segments. The multi-timescale feature extraction, feature fusion, and classification steps employ optimal methods that have been trained, validated, and tested. This invention employs advanced deep learning technology, including the creation of detection and classification models, the establishment of experimental groups and training, validation, and testing datasets for insomnia detection, and the training, validation, and testing of these models. Specifically, in the experimental design for insomnia detection, participants are divided into insomnia and non-insomnia groups. The established training, validation, and testing datasets are used to train, validate, and test the detection and classification model. A loss function and an optimizer are used in conjunction to perform calculations, enhancing the stability of the calculated values. This yields an optimized model's predictive probability, which is then used to detect and classify the input electrocardiograms of the participants, outputting the classification results. The optimized predictive probability is used to improve the accuracy of insomnia event detection. Simple Explanation of the Diagram
[0006] Figure 1 is a flowchart of a preferred embodiment of the present invention. Figure 2 is a block diagram of the preprocessing procedure of this preferred embodiment. Figure 3 is a block diagram of the detection and classification model of the preferred embodiment. Figure 4 is a block diagram of the multi-timescale feature extraction procedure, feature fusion and classification procedure of the preferred embodiment. Figure 5 is a schematic diagram of the residual network in Figure 4. Figure 6 is a schematic diagram of the convolutional neural network block shown in Figure 5. Figure 7 is a schematic diagram of the long short-term memory network of the second path in Figure 4. Figure 8 is an internal block diagram of the long short-term memory network of the second and third paths. Figure 9 is a schematic diagram of the long short-term memory network of the third path in Figure 4. Implementation
[0007] The foregoing description and other technical contents, features and effects of this invention will become clear in the following detailed description of the preferred embodiments with reference to the accompanying drawings.
[0008] Referring to Figure 1, a preferred embodiment of the present invention describes an insomnia identification method based on the fusion of long-term and short-term electrocardiogram (ECG) features. This method is executed by computer software to automatically detect and identify whether the subject is experiencing insomnia based on the input ECG signal. The ECG signal at least includes characteristic morphologies of P waves, QRS complexes, and T waves. The method includes signal preprocessing 31 and multi-timescale feature extraction, feature fusion, and classification 32. The signal preprocessing 31 includes a preprocessing program to process the input raw ECG signal. Referring to Figure 2, the preprocessing program includes the following steps:
[0009] One removal technique utilizes a fourth-order Butterworth bandpass filter with a passband set between 0.5 Hz and 20 Hz. This effectively suppresses low-frequency DC baseline drift and high-frequency electromyography (EMG) or environmental noise in the ECG signal, while fully preserving the most diagnostically valuable physiological components of the ECG signal. This makes subsequent feature extraction more stable and reliable.
[0010] The normalization process employs a two-level adaptive R-peak normalization method, using global and regional reference values. This method utilizes a heartbeat detection algorithm to automatically locate the R-peak position within a 10-second ECG signal after noise removal. This avoids misinterpreting high-frequency noise or T waves within the same heartbeat as additional R-peaks. Specifically, once an R-peak is identified, subsequent peaks are ignored for 200 to 300 milliseconds, ensuring that each QRS complex corresponds to only one valid R-peak. This 200 to 300 millisecond timeframe is adaptively adjusted based on the subject's real-time heart rate, set to 50% of the average of the last three RR intervals to ensure robustness across different heart rhythm states. After R-peak localization, amplitude reference values at two levels are simultaneously calculated, including global and regional reference values.
[0011] Continuing from the previous point, the global baseline value is obtained by summing the R-peak amplitudes of all heartbeats within 10 seconds and taking the median as the basis for global scaling of the entire signal, reflecting the overall heartbeat amplitude level of the subject during that time period. The regional baseline value, on the other hand, is obtained by selecting the R-peak amplitudes of the two heartbeats before and after each heartbeat in the ECG signal (a total of 5 heartbeats), calculating the median of that interval, and using it as the regional baseline for the current heartbeat. This reflects the amplitude changes between heartbeats caused by breathing, posture, or autonomic nervous system regulation. Subsequently, the global and regional baseline values are combined through a weighted fusion method, with a weight ratio of 70% for the global baseline and 30% for the regional baseline, as the final normalization reference scale. This design avoids relying solely on the global baseline and ignoring local changes, and also prevents inconsistencies in amplitude across segments caused by relying solely on the regional baseline.
[0012] Therefore, during normalization, the entire 10-second ECG signal is scaled according to the aforementioned weighted reference scale to ensure that the R-peak amplitude of each heartbeat remains consistent across different segments. For example, for a 10-second ECG signal, after R-peak detection, 10 heartbeats are obtained, and their R-peak amplitudes are shown in the table below:
[0013] Table 1 Heartbeat 1 Heartbeat 2 Heartbeat 3 Heartbeat 4 Heartbeat 5 0.95 1.02 1.10 0.98 1.05 Heartbeat 6 Heartbeat 7 Heartbeat 8 Heartbeat 9 Heartbeat 10 1.20 1.00 1.08 0.97 1.15
[0014] For example, when calculating the global baseline value, the median of all R-peak amplitudes is taken, resulting in a global baseline value of 1.03. Next, for a specific heartbeat (e.g., the 6th beat), its regional baseline value is calculated. Assuming two beats before and after this heartbeat (i.e., the 4th, 5th, 6th, 7th, and 8th beats) are selected, their amplitudes are 0.98, 1.05, 1.20, 1.00, and 1.08 respectively. Taking the median of these five values yields a regional baseline value of 1.05. Finally, the global baseline value (1.03) and the regional baseline value (1.05) are weighted and merged, with weights of 70% and 30% respectively. Therefore, the final normalized reference scale is:
[0015] 1.03 × 0.7 + 1.05 × 0.3 = 1.036
[0016] In other words, the heartbeat corresponding to the 6th beat will use 1.036 as the amplitude benchmark for normalization. Therefore, through this method, the amplitude benchmark value of the entire ECG signal is controlled within a stable range, while also preserving the physiological changes reflected by the regional benchmark. This makes the normalization result both robust and dynamically adaptable to differences between heartbeats. Thus, if some heartbeat amplitudes are significantly abnormal (e.g., too large or too small, or deviating from the population distribution), these abnormal values will be automatically removed and not included in the benchmark calculation to ensure the robustness of the normalization process. By incorporating this two-level adaptive R-peak normalization method, not only can the amplitude scale between different subjects be unified, eliminating the influence of equipment and environmental factors, but also the naturally existing variation information between heartbeats can be preserved. This avoids excessive smoothing that leads to distortion of physiological signals, thereby significantly improving the feature learning ability of ECG signals and the accuracy of insomnia identification in subsequent steps of deep learning technology for multi-timescale feature extraction, feature fusion, and classification.
[0017] In the steps of multi-timescale feature extraction, feature fusion, and classification 32, optimized deep learning technology, after training, validation, and testing, is used to classify the pre-processed electrocardiogram signals. This deep learning technology includes techniques such as establishing detection and classification models, establishing experimental groups for insomnia detection, and training, validation, and testing datasets and training, validation, and testing models. Referring to Figures 3 and 4, the technique for establishing the detection and classification model includes a multi-timescale feature extraction program, a feature fusion and classification program, and loss functions and Adam optimizers that are used in conjunction with the multi-timescale feature extraction program and the feature fusion and classification program, respectively, as detection and classification model techniques. Referring to Figure 4, the aforementioned multi-timescale feature extraction program has three parallel paths from input to output: a first path for extracting short-term features, a second path for modeling medium-term features, and a third path focusing on modeling long-term features. That is, short-term, medium-term, and long-term features are extracted from the pre-processed signals, and the corresponding short-term, medium-term, and long-term feature vectors are output.
[0018] Referring to Figure 5, the first path includes a ResNet. This ResNet consists of a leading Convolutional Neural Network (CNN) block with parameters C, K, and S, a ResNet using a Bottleneck Layer, a shortcut connection, an addition operation, and a Global Average Pooling layer. The Bottleneck Layer ResNet is composed of three CNN blocks to reduce the computational burden of the model and enhance feature capabilities. Each CNN block has three parameters: a CNN block with (0.2*, 1, S), a CNN block with (0.2*, K, S), and a CNN block with (C, 1, S). Each of these CNN blocks consists of a CNN layer with parameters C, K, and S, a batch normalization layer, and an activation layer using the ReLU function. The system consists of interconnected layers, as shown in Figure 6.
[0019] Continuing from the foregoing, the main purpose of using the residual network in this invention is to extract short-term features from the input 10-second electrocardiogram signal. For example, if the input signal length is 2560 sampling points, it will first pass through the leading convolutional neural network block to perform preliminary feature extraction and gentle downsampling with the number of channels C=64, core size K=7, and stride=2 (SAME padding), reducing the sequence length from 2560 to 1280. Then it enters the residual stage with a single bottleneck structure, where the output channels are set to C=128 and the bottleneck ratio is 0.2. Its main branch performs channel compression, feature extraction, and channel restoration in the order of "1×1→K×1→1×1".
[0020] For example, the first 1×1 convolution compresses the number of input channels to 0.2C and reduces the sequence length from 1280 to 256 with a stride S=5; then, the second convolution is a K×1 (K=5) main convolution, maintaining the bottleneck channel number at 0.2C and further reducing the length to 64 with a stride S=4; finally, the third 1×1 convolution restores the number of channels to C, while reducing the length from 64 to 32 with a stride S=2; thus, the strides of the three convolutions multiplied by 5×4×2=40, combined with the stride 2 of the preceding convolutional neural network block, results in a total downsampling factor of 80, which can effectively reduce the input signal... The length is precisely reduced from 2560 to 32, so the output size in the residual stage will be 128×32. Then, the average value of 32 samples is calculated on each channel by the global average pooling layer, compressing the original 128×32 output features into a 1×32 representation (the short-term feature quantity of its output can be denoted as X(1)). Therefore, this structural design can not only effectively reduce the number of parameters, but also reduce the risk of overfitting, while preserving the overall information of the sequence in the time dimension, so that the final output is more compact and suitable as input for subsequent classification or feature judgment procedures.
[0021] Referring to Figure 7, the second path includes a ResNet and a Long Short-Term Memory (LSTM) network. The architecture of the ResNet is the same as that of the ResNet in the first path, and will not be described in detail here. The LSTM network has five LSTM units (also known as five time steps) from input to output. The design of the LSTM network will allocate each time step... [ t The input feature vector and hidden layer state are input together, and the memory unit is updated recursively. This allows for the consideration of both current and historical signals, forming a time-series recurrent neural network architecture. The input is a feature vector spanning five consecutive time steps, including... , , , ,and The output at the last time step is Therefore, the purpose of this Long Short-Term Memory network is to extract mid-term features of the input electrocardiogram signal by considering dynamic dependencies across 5 time steps (a total of 50 seconds).
[0022] Referring to Figure 8, the internal structure of each Long Short-Term Memory (LSTM) network at time step t mainly consists of four basic units: a Forget Gate, an Input Gate, an Output Gate, and a Memory Cell. The Forget Gate controls whether previous memory information is retained or discarded. The Input Gate determines the impact of the current input on the Memory Cell. The Output Gate controls the hidden updates and outputs. In Figure 8, the symbol σ represents the Sigmoid function, whose input range is between 0 and 1, representing the "retention level" or "update ratio." The tanh function is used to generate candidate memory content, and its output range is between -1 and +1. Through the synergistic effect of these gate control mechanisms, the LTM network can effectively capture long-term dependencies in time-series tasks.
[0023] Therefore, in this embodiment, the hidden layer dimension of the Long Short-Term Memory network is set to 160, meaning that a 160-dimensional hidden state vector will be output at each time step. [ h ] [ t ], at the time step [ t The input to this Long Short-Term Memory network is the current feature vector. Cell state at the previous time step [ c t ] [ -1 ], and the hidden state of the previous time step. [ h ] [ t ] [ -1 After processing through the forget gate, the input gate, and the output gate, the updated cell state is obtained. [ c t [and hidden state] [ h ] [ t The hidden state corresponds to... Therefore, as shown in Figure 7, the Long Short-Term Memory Network receives input features from 5 consecutive time steps and outputs the corresponding hidden state at the last time step. Thus, overall, the Long Short-Term Memory Network can effectively encode the temporal dependency features of the input sequence into a 1×32-dimensional representation (the output intermediate feature quantity can be denoted as X(2)), which can be used as the input for subsequent classification or feature judgment procedures.
[0024] Referring to Figure 9, the third path includes a ResNet and a Long Short-Term Memory (LSTM) network. The architecture of the ResNet is the same as that of the ResNet in the first path, and will not be repeated here. The LSTM network has sixty LSTM units (also known as 60 time steps) from input to output. Each LSTM network further includes a Forget Gate, an Input Gate, an Output Gate, and a Memory Cell. Therefore, its core lies in using the 60 time-step input sequence for stepwise recursive computation. Although the LSTM network shown in Figure 9 is presented in multiple blocks, it is actually the same model sharing and repeating weights on the time axis. When the input is a feature vector of 60 consecutive time steps, it contains... … , ,and The output at the last time step is Therefore, the main purpose of the aforementioned structure is to capture the dynamic dependencies of ECG signals spanning up to 60 time steps (a total of 10 minutes), thereby extracting the long-term features of the ECG signals (the output of the medium-term features can be denoted as X(3)). Since the periodicity and rhythm of ECG signals usually span multiple heartbeats, relying solely on short-term signals cannot fully reflect the pattern of cardiac activity. Thus, through this long-sequence long short-term memory network, it is possible to track the fluctuations of signals over a larger time range.
[0025] The feature fusion and classification procedure includes an addition operation connected to the aforementioned three feature paths, a fully connected layer (FC layer) connected to the addition operation, and a classification layer (FC-2) using the Softmax function connected to the fully connected layer. The fully connected layer uses 1024 neurons to linearly transform the feature vector fused by the addition operation. The classification layer uses the Softmax function for calculation. That is, the addition operation fuses the short-term feature vector, medium-term feature vector, and long-term feature vector output by the multi-timescale feature extraction procedure to achieve the integration of features at different scales. The fused result is denoted as X(4) (dimension 5×160), and its calculation method is as follows:
[0026] X(4) = X(1) + X(2) + X(3)
[0027] X(1), X(2), and X(3) represent the outputs of the first path for extracting short-term features, the second path for extracting medium-term features, and the third path for extracting long-term features, respectively. The fused short-, medium-, and long-term feature vectors X(4) are fed into the fully connected layer for further learning of the nonlinear relationships between features. The purpose of using this fully connected layer is to perform a linear transformation on X(4) and learn the relationships between features through a nonlinear activation function. That is, the fully connected layer uses 1024 neurons to calculate the output feature vector, and the calculation formula is as follows:
[0028] XFC=σ(X(4)W1+b1)
[0029] Where XFC has a dimension of 1×1024, W1 is the weight matrix of the fully connected layer with a dimension of 160×1024, which maps the input feature vector X(4) to 1024 hidden units, and b1 is the bias vector with a dimension of 1×1024, while σ(·) is the ReLU activation function that introduces non-linear relationships, allowing the model to capture and learn the complex interaction relationships between features; therefore, the feature vector XFC after the fully connected layer is fed into the final classification layer (FC-2), which maps the feature vector to the two categories of classification (insomnia and normal), and generates unstandardized class scores (logis) through linear transformation, the calculation formula of which is as follows:
[0030] XO = XFCW2 + b2
[0031] Where XO has a dimension of 1×2, representing the output of the classification layer and indicating the score of each category, W2 is the weight matrix of the classification layer with a dimension of 1024×2, and b2 is the bias vector with a dimension of 1×2. Finally, the Softmax function is applied to convert the aforementioned category scores into a standardized probability distribution and calculate the probability of each category. The formula for calculating the Softmax function is as follows:
[0032] and
[0033] in [ y i ] indicates that the input belongs to the first... [ i The probability of class ] (between 0 and 1), and the output of the Softmax function [ y ] [1] and [ y ] [2] The probabilities of two categories, and satisfying [ y ] [1]+ [ y ] [2]=1, and the class with the higher probability is the classification result of the model.
[0034] Furthermore, the loss function used is the cross-entropy loss function, which can be used to determine the closeness between the model output and the expected output. That is, the smaller the distance between the probability distribution of the model output and the expected output, the smaller the cross-entropy value; conversely, the larger the distance between the probability distribution of the model output and the expected output, the larger the cross-entropy value. This is combined with the optimizer used to minimize the loss value.
[0035] The Adam optimizer is an adaptive learning rate optimization algorithm based on first-order and second-order momentum of the gradient. It combines the advantages of momentum descent and adaptive learning rate gradient descent, resulting in strong convergence and stability when handling high-dimensional parameter spaces and large datasets. A key feature of the Adam optimizer is its ability to simultaneously track the mean gradient (momentum) and the mean squared gradient of each parameter, dynamically adjusting the learning rate based on these estimates. Compared to traditional stochastic gradient descent, the Adam optimizer can adaptively adjust the learning rate according to different gradient characteristics, allowing the model to update parameters more flexibly under different gradient conditions. This adaptive learning rate mechanism helps the optimizer avoid excessive oscillation, especially under drastic gradient changes. Furthermore, the Adam optimizer introduces a bias correction mechanism. This design addresses the issue that initially, the estimated momentum and squared gradient values are too small, leading to a slow learning pace. The Adam optimizer uses bias correction to offset the effects of bias in the initial iterations, enabling faster and more accurate parameter updates during early training. Another key feature is the inclusion of a very small constant ϵ in the update formula to prevent division by zero during computation. This enhances numerical stability and overall training robustness. The Adam optimizer's adaptive nature makes it perform exceptionally well in many deep learning tasks, especially when data is sparse or gradients change frequently. It effectively accelerates convergence compared to traditional gradient descent, quickly adapting to learning rate changes and significantly improving model performance in the early stages of training. Furthermore, the Adam optimizer is highly adaptable to different tasks and network architectures without requiring extensive learning rate adjustments, making it widely used in various neural network architectures.
[0036] In the technique for establishing experimental grouping and training, validation, and testing datasets for insomnia detection, the experimental design for insomnia detection divides participants into insomnia and non-insomnia groups. Electrocardiogram (ECG) signals from the Stanford Technology Analytics and Genomics in Sleep (STAGE) database are used. This database at least categorizes participants into insomnia and non-insomnia groups. A total of 50,000 sets of 10-second ECG signals were extracted from different participants, with each signal corresponding to a label (indicating insomnia or non-insomnia). The entire dataset is proportionally divided into a 70% training set, a 15% validation set, and a 15% test set for performance evaluation during the training, validation, and testing of the deep learning model.
[0037] In the training, validation, and testing techniques, the aforementioned training, validation, and testing datasets are used to train, validate, and test the detection and classification model. Specifically, 70% of the training dataset, 15% of the validation dataset, and 15% of the testing dataset are sequentially used to train, validate, and test the detection and classification model. The loss function and the Adam optimizer are used in conjunction with the calculations during training, validation, and testing to determine the closeness between the model's output and the expected output. Simultaneously, the Adam optimizer... The optimizer has a bias correction mechanism to enhance the stability of the calculated values and thus obtain an optimized model. Finally, the optimized model is used to preprocess the input subject's signal to obtain three sets of short-term, medium-term and long-term time-step electrocardiogram signals. The input signal is directly passed through the residual network through the first path in the short-term feature extraction mode. Through the design of the bottleneck layer and the fast connection, the waveform morphological changes and short-term frequency characteristics of the local electrocardiogram signal can be effectively captured, and the short-term feature vector X(1) is output.
[0038] Continuing from the above, the second path focuses on modeling intermediate features. The input signal is first processed through the residual network to extract local features, and then input into a long short-term memory network covering 5 time steps. Here, the 5 time steps use 5 consecutive sets of 10-second ECG signals. The long short-term memory network can capture intermediate dependencies spanning several heartbeat cycles by transmitting information between adjacent time signals through its memory units, and outputs an intermediate feature vector X (2). As for the third path, it focuses on modeling long-term features. After the input signal is extracted by the residual network, it enters a long short-term memory network covering 60 time steps. At this time, the input signal contains 60 sets of 10-second ECG signals. The model can track the fluctuations and rhythm changes of the signal on a longer time scale, further extract long-term time series features, and output a long-term feature vector X (3). Ultimately, the feature vectors from three different time scales are fused into an integrated feature representation through addition. This representation simultaneously includes the short-term local morphology of the electrocardiogram, the dynamic dependence across the cardiac cycle in the medium term, and the long-term rhythm changes, forming a multi-layered and complementary signal description. The fused features are then further compressed and abstracted in the fully connected layer, and finally, the classification result is output through the classification layer. In this way, the input electrocardiogram signal is classified as either insomnia or non-insomnia, providing a mechanism for medical intervention. This allows medical personnel to provide corresponding medical assistance based on the actual insomnia state of the test subject, thereby helping the test subject improve their quality of life and reduce health risks.
[0039] In summary, this invention, based on the fusion of long- and short-term electrocardiogram (ECG) features, is a method for identifying insomnia. It primarily classifies the ECG signals input by the subject to determine the probability of insomnia. This is achieved through signal preprocessing and multi-timescale feature extraction, fusion, and classification. First, the preprocessing procedure removes noise from the raw input signal and employs a two-level adaptive R-peak normalization process. This ensures signal consistency across different subjects and time segments. Finally, the optimized depth... (The sentence is incomplete and requires further context to translate accurately.) The learning model, combined with a corresponding loss function and optimizer, establishes an automatic detection and classification architecture. It adopts a multi-timescale feature extraction, feature fusion, and classification mode, and uses the loss function and optimizer to perform calculations to enhance the stability of the calculated values. It analyzes and detects the processed electrocardiogram signals, and then outputs a detection and identification of the predicted probability of insomnia and non-insomnia, which can be used by medical personnel as a reference or as an intervention mechanism. It can also provide corresponding medical assistance according to the actual insomnia state to help improve the physiological and life inconvenience caused by long-term insomnia in the test subjects.
[0040] However, the above description is only for illustrating preferred embodiments of the present invention and should not be construed as limiting the scope of the present invention. Any simple equivalent changes and modifications made in accordance with the scope of the patent application and the contents of the specification of the present invention should still fall within the scope of the patent of the present invention.
[0041] (This invention) 3: Insomnia Identification Method Based on Fusion of Long-Term and Short-Term Features of Electrocardiogram 31: Signal Preprocessing 32: Multi-timescale feature extraction, feature fusion, and classification
Claims
1. A method for identifying insomnia based on the fusion of short-term and long-term temporal features of electrocardiogram (ECG), executed by computer software, to automatically detect or identify input ECG signals from a subject, wherein the ECG signals at least contain characteristic morphologies of P waves, QRS complexes, and T waves; the method includes: a signal preprocessing step, in which a preprocessing program performs baseline shifting and high-frequency noise removal on the input raw ECG signals, and performs bi-level adaptive R-peak normalization processing, i.e., a normalization method using weighted fusion of global and regional amplitude reference values, to suppress noise and ensure signal consistency between different subjects and different time segments, and to form three sets of short-term, medium-term, and long-term time-step T-second ECG signals for use as input signals; and a multi-timescale feature extraction, feature fusion, and classification method, which uses optimized deep learning technology after training, validation, and testing to classify the preprocessed ECG signals; wherein, This deep learning technique includes: establishing a detection and classification model, comprising a multi-timescale feature extraction procedure, a feature fusion and classification procedure, and loss functions and an Adam optimizer that operate in conjunction with the multi-timescale feature extraction procedure, feature fusion and classification procedure, respectively, as the detection and classification model technique; wherein, the multi-timescale feature extraction procedure has three parallel paths from input to output, namely a first path for extracting short-term features, a second path for modeling medium-term features, and a third path focusing on modeling long-term features, that is, extracting short-term, medium-term and long-term features from the preprocessed signal and outputting feature vectors; the feature fusion and classification procedure has an addition operation connected to the aforementioned three feature paths, and a fully connected layer (FC) connected to the addition operation. The system consists of a fully connected layer and a classification layer using the Softmax function. This layer uses a multi-scale feature fusion model to fuse the aforementioned feature vectors into an integrated feature representation through addition. The fused features are further compressed and abstracted, and finally, through classification calculations, the system outputs the detection and identification results of the predicted probability of insomnia or non-insomnia. An experimental grouping and training, validation, and testing dataset for insomnia detection are established. The experimental design for insomnia detection divides participants into insomnia and non-insomnia groups, and utilizes the Stanford Technology Analytics and Genomics database. The database contains electrocardiogram (ECG) signals from sleep (STAGE) subjects, categorized into insomnia and non-insomnia groups. A total of 50,000 sets of 10-second ECG signals were collected from different subjects, each signal corresponding to a label (indicating insomnia or non-insomnia). The entire dataset is divided proportionally into 70% training data, 15% validation data, and 15% test data for training, validation, and performance evaluation of the deep learning model. The training, validation, and test datasets are used to train, validate, and test the detection and classification model. The loss function and Adam optimizer are used to calculate the approximation between the model output and the expected output. The Adam optimizer has a bias correction mechanism to enhance the stability of the calculated values, thereby obtaining an optimized model. The predicted probability of the optimized model is used to detect the input subject's ECG signals, ultimately outputting a classification result based on the predicted probability.
2. The insomnia identification method based on the fusion of long and short-term electrocardiogram features as described in request item 1, wherein, The preprocessing procedure includes: removal, which uses a fourth-order Butterworth bandpass filter with a passband set in the 0.5Hz to 20Hz frequency band to suppress low-frequency DC baseline drift and high-frequency electromyography or environmental noise in the ECG signal; and normalization, which employs a two-level adaptive R-peak normalization method, global reference value, and regional reference value. This allows the ECG signal after noise removal to automatically locate all R-peak positions in a 10-second ECG signal using a heartbeat detection algorithm. After R-peak localization, the global reference value aggregates the R-peak amplitudes of all heartbeats within 10 seconds and takes the median as the basis for global scaling of the entire signal, reflecting the overall heartbeat amplitude level of the subject during that time period. The regional reference value selects the R-peak amplitudes of the two heartbeats before and after each heartbeat in the ECG signal (a total of 5 heartbeats) and calculates the median of that interval as the regional reference for the current heartbeat.
3. The insomnia identification method based on the fusion of long-term and short-term electrocardiogram features as described in claim 1, wherein, The first path has a ResNet, the second path includes a ResNet and a Long Short-Term Memory (LSTM) network with five LSTM units from input to output, and the third path has a ResNet and a Long Short-Term Memory (LSTM) network with sixty LSTM units from input to output.
4. The insomnia identification method based on the fusion of long-term and short-term electrocardiogram features as described in claim 3, wherein, Each residual network consists of a leading convolutional neural network block (CNN Block) with parameters C, K, and S, a residual network employing a bottleneck layer, a shortcut connection, an addition operation, and a global average pooling layer concatenated together. The bottleneck layer residual network is composed of three CNN Blocks. Each of the aforementioned CNN Blocks has three parameters: a CNN Block with (0.2*, 1, S), a CNN Block with (0.2*, K, S), and a CNN Block with (C, 1, S).
5. The insomnia identification method based on the fusion of long and short-term electrocardiogram features as described in claim 4, wherein, Each convolutional neural network block consists of a convolutional layer (CNN Layer) with parameters C, K, and S, a batch normalization layer, and an activation layer using the ReLU function, connected in series.
6. The insomnia identification method based on the fusion of long-term and short-term electrocardiogram features as described in claim 3, wherein, Each long short-term memory network further includes a forget gate, an input gate, an output gate, and a memory cell.
7. The insomnia identification method based on the fusion of long-term and short-term electrocardiogram features as described in claim 1, wherein, This fully connected layer uses 1024 neurons to perform a linear transformation on the feature vector fused by addition. The classification layer uses the Softmax function to calculate and finally maps the input feature vector to two categories (insomnia and normal). The category with the higher probability is the classification result.
8. The insomnia identification method based on the fusion of long-term and short-term electrocardiogram features as described in claim 1, wherein, The Adam optimizer is an adaptive learning rate optimization algorithm based on first-order and second-order gradient momentum, and it has a bias correction mechanism.