Electroencephalogram automatic sleep staging method and system based on SAGAN-GP and CNN-BiGRU
By combining the SAGAN-GP and CNN-BiGRU models and optimizing the structure of generative adversarial networks and convolutional neural networks, the problems of class imbalance and insufficient data in automatic sleep staging of EEG were solved, and higher sleep staging accuracy was achieved.
Patent Information
- Application Number
- CN202511011322.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-22
- Publication Date
- 2025-11-07
AI Technical Summary
Existing automatic sleep staging models based on EEG suffer from class imbalance and limited sample data for the N1 stage, resulting in poor staging accuracy and difficulty in effectively distinguishing the N1 stage.
A combined model of SAGAN-GP and CNN-BiGRU is adopted. The network structure of the generator and discriminator is optimized through adversarial training of the generative adversarial network and convolutional neural network, data augmentation and feature extraction are performed, and sleep staging is performed by combining the BiGRU structure.
It improves the accuracy of automatic sleep staging based on EEG, reduces noise interference, resolves class imbalance issues, and enhances the staging effect of N1 stage.
Smart Images

Figure CN120913878A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of automatic sleep staging, and in particular to an EEG automatic sleep staging method and system based on SAGAN-GP and CNN-BiGRU. BACKGROUND
[0002] EEG-based automatic sleep staging is a technology that automatically determines and classifies sleep states by analyzing electroencephalogram (EEG) signals. Sleep staging is the process of dividing the sleep process into different stages according to different brain activity patterns, eye movements, electromyography, and other physiological parameters. The common sleep staging standard is the standard recommended by the American Academy of Sleep Medicine (AASM), which usually includes the following stages: wake stage (Wake), non-rapid eye movement sleep stage (NREM), and rapid eye movement sleep stage (REM); among them, the non-rapid eye movement sleep stage (NREM) includes N1 stage (light sleep), N2 stage (moderate sleep), and N3 stage (deep sleep).
[0003] Because the duration of the collected data is different in different stages, when using a neural network model for automatic sleep staging, the class imbalance problem between different stages and the small amount of sample data in the N1 stage result in poor accuracy of the trained model for automatic sleep staging, and the N1 stage cannot be well divided. SUMMARY
[0004] The present application provides an EEG automatic sleep staging method and system based on SAGAN-GP and CNN-BiGRU, which is used to solve the existing problems.
[0005] The purpose of the present application can be achieved by the following technical solutions: The first aspect of the present application is to provide an EEG automatic sleep staging method based on SAGAN-GP and CNN-BiGRU, comprising: obtaining EEG signal data of different subjects, wherein the EEG signal data of subjects without sleep disorders constitutes a Sleep-EDF dataset, and the EEG signal data of subjects with sleep disorders constitutes a SHHS dataset; preprocessing the EEG signal data to obtain the preprocessed Sleep-EDF dataset and SHHS dataset; obtaining the network structure of the generator and the discriminator in the GAN, and obtaining the network structure of the generator and the discriminator after optimization and adjustment; performing adversarial training according to the preprocessed electroencephalogram signal data in the Sleep-EDF dataset and the SHHS dataset, the network structure of the generator and the discriminator after optimization and adjustment, and the GAN to be analyzed, to obtain final electroencephalogram synthetic signal data; performing automatic electroencephalogram sleep staging through a convolutional neural network model according to the final electroencephalogram synthetic signal data.
[0006] Further, the electroencephalogram signal data of different subjects is composed of the electroencephalogram signal data of subjects without sleep disorders to form the Sleep-EDF dataset, and the electroencephalogram signal data of subjects with sleep disorders to form the SHHS dataset, including: electroencephalogram signal data of Fpz-Cz single lead sleep of a plurality of healthy subjects randomly selected from the Sleep-EDF Database Expanded public sleep electroencephalogram database to form the Sleep-EDF dataset; The multi-center cohort study dataset SHHS-1 about cardiovascular and other sleep disorders respiratory diseases is used, subjects with AHI less than a preset respiratory parameter are screened from the dataset SHHS-1 to form a screening dataset, and electroencephalogram signal data of C4-A1 single lead sleep of a plurality of subjects randomly selected from the screening dataset are taken as the SHHS dataset.
[0007] Further, the pre-processing of the electroencephalogram signal data to obtain the pre-processed Sleep-EDF dataset and the SHHS dataset includes: According to a preset low noise frequency and a preset high noise frequency , the electroencephalogram signal data in the Sleep-EDF dataset and the SHHS dataset is filtered through a Butterworth band-pass filter, and the electroencephalogram signal data after filtering is denoised by using a wavelet packet denoising technology to obtain the pre-processed Sleep-EDF dataset and the SHHS dataset.
[0008] Further, the GAN to be analyzed includes WGAN, WGAN-GP and Self-WGAN-GP.
[0009] Further, the optimization and adjustment of the network structure of the generator and the discriminator in the GAN to obtain the network structure of the generator and the discriminator after optimization and adjustment includes: The generator network structure optimization and adjustment process is: The input high-dimensional vector of the generator is dimensionally expanded by upsampling to obtain a higher-dimensional vector; the expanded higher-dimensional vector is then input into the network structure corresponding to the generator; wherein the network structure corresponding to the generator comprises four convolutional layers, two maximum pooling layers, an LSTM layer, and two self-attention layers; wherein the two self-attention layers are added after the first maximum pooling layer and the second activation function, respectively; then the features extracted by the convolutional layer are processed using the LSTM layer; The output of the LSTM is then flattened, and a sleep stage electroencephalogram signal data output is generated through a linear layer, and then the output features are converted to a suitable dimension through a fully connected layer to obtain the synthesized electroencephalogram signal data. The optimization and adjustment process of the discriminator network structure is as follows: The network structure corresponding to the discriminator comprises a convolutional layer, a maximum pooling layer, and a self-attention layer; spectral normalization and two time scale update rules are used to adjust the discriminator and enhance the data; specifically, spectral normalization is a weight regularization technique used in the discriminator network to enhance the training process, that is, the spectral norm of the weight of the convolutional layer is constrained by adding spectral normalization; the two time scale update rules are used to compensate for the slow learning problem of the regularized discriminator.
[0010] Further, the final electroencephalogram signal data is obtained by performing adversarial training on the preprocessed electroencephalogram signal data in the Sleep-EDF dataset and the SHHS dataset, the optimized and adjusted network structure of the generator and the discriminator, and the to-be-analyzed generative adversarial network, comprising: The process of obtaining the final electroencephalogram signal data is as follows: The final electroencephalogram signal data is obtained by performing adversarial training on the preprocessed electroencephalogram signal data in the Sleep-EDF dataset and the SHHS dataset, the optimized and adjusted network structure of the generator and the discriminator, and the to-be-analyzed generative adversarial network model, and evaluating the adversarial training results by the evaluation indicators FDRMSE and WD; the optimal generative adversarial network is selected from the to-be-analyzed generative adversarial network model based on the evaluation results, and a single-channel final electroencephalogram signal data is obtained through the optimal generative adversarial network.
[0011] Further, the automatic sleep staging of the electroencephalogram is performed by the convolutional neural network model based on the final electroencephalogram signal data, comprising: After using the CNN network to represent the features of the electroencephalogram signal data and using the residual network to retain the original information, a BiGRU structure with low complexity and a multi-head self-attention mechanism are added, i.e., a CNN-BiGRU network structure is obtained. The Sleep-EDF data set and the SHHS data set after synthesis adjustment are obtained according to the acquisition process of the final electroencephalogram synthesis signal data, and the Sleep-EDF data set and the SHHS data set after synthesis adjustment are used to divide a training set, a verification set and a test set; the CNN-BiGRU network structure is trained through the data set and the categories of the five sleep stages, the classification performance of each sleep stage is evaluated through the precision, the recall rate and the F1 score, and the trained CNN-BiGRU model is obtained through the evaluation result; Finally, the electroencephalogram automatic sleep staging is performed through the trained CNN-BiGRU model.
[0012] The second aspect of the present application provides an electroencephalogram automatic sleep staging system based on SAGAN-GP and CNN-BiGRU, comprising: A data acquisition module is configured to acquire electroencephalogram signal data of different subjects, wherein the electroencephalogram signal data of subjects without sleep disorders is used to form a Sleep-EDF data set, and the electroencephalogram signal data of subjects with sleep disorders is used to form a SHHS data set. A data preprocessing module is configured to preprocess the electroencephalogram signal data to obtain a preprocessed Sleep-EDF data set and a preprocessed SHHS data set. A generative adversarial module is configured to acquire a generative adversarial network to be analyzed, optimize and adjust the network structure of a generator and a discriminator in the GAN, and obtain the network structure of the generator and the discriminator after optimization and adjustment; and perform adversarial training according to the electroencephalogram signal data in the preprocessed Sleep-EDF data set and the preprocessed SHHS data set, the network structure of the generator and the discriminator after optimization and adjustment, and the generative adversarial network to be analyzed, to obtain final electroencephalogram synthesis signal data. A sleep staging module is configured to perform electroencephalogram automatic sleep staging through a convolutional neural network model according to the final electroencephalogram synthesis signal data.
[0013] The third aspect of the present application provides an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to realize the electroencephalogram automatic sleep staging method based on SAGAN-GP and CNN-BiGRU.
[0014] The fourth aspect of the present application provides a computer readable storage medium storing a computer program, wherein the computer program is executed by a processor to realize the electroencephalogram automatic sleep staging method based on SAGAN-GP and CNN-BiGRU.
[0015] Compared with the prior art, the present application has the beneficial effects that: the electroencephalogram signal data is preprocessed to obtain the preprocessed Sleep-EDF data set and SHHS data set, reducing the influence of noise interference; the to-be-analyzed generative adversarial network is obtained, and the network structure of the generator and discriminator in the GAN is optimized and adjusted to obtain the optimized and adjusted network structure of the generator and discriminator; the preprocessed electroencephalogram signal data in the Sleep-EDF data set and the SHHS data set, the optimized and adjusted network structure of the generator and discriminator, and the to-be-analyzed generative adversarial network are subjected to adversarial training to obtain the final electroencephalogram synthetic signal data, reducing the influence of the class imbalance problem between different sleep stages and the problem of less data in some sleep stages; and the electroencephalogram automatic sleep staging is performed through the convolutional neural network model according to the final electroencephalogram synthetic signal data, improving the accuracy of automatic sleep staging. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0017] Figure 1 A step flow chart of a SAGAN-GP and CNN-BiGRU-based electroencephalogram automatic sleep staging method is provided for the present application. Figure 2 A module flow chart of a SAGAN-GP and CNN-BiGRU-based electroencephalogram automatic sleep staging system is provided for the present application. Figure 3 A flow chart of electroencephalogram automatic sleep staging. DETAILED DESCRIPTION
[0018] In order to make the person skilled in the art better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely in the following with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present application.
[0019] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0020] To address the problems existing in the background technology, this study designs an automatic sleep staging method and system based on SAGAN-GP and CNN-BiGRU, which has significant practical implications.
[0021] like Figure 1 As shown, the first aspect of the present invention is to provide an automatic sleep staging method based on SAGAN-GP and CNN-BiGRU, comprising the following steps: Step S001: Collect the subject's electroencephalogram (EEG) signal data.
[0022] It should be noted that, in order to improve the generalization of the model and reduce the imbalance between data samples, different types of datasets are selected as the sample data for training the neural network.
[0023] Specifically, the Sleep-EDF dataset was obtained from the Sleep-EDF Database Expanded public sleep EEG database on the PhysioNet system, which contains PSG (Polysomnography) data from 197 subjects. Of these, 153 subjects' PSG data consisted of 24-hour routine PSG recordings from healthy individuals aged 25–101 years (SC, Sleep Chart Data), and 44 subjects' PSG data consisted of a full night's worth of PSG recordings from individuals with mild sleep disorders (ST, Sleep Telemetry Data). In the PSG recordings, EEG (Electroencephalogram) signals were taken from the Fpz-Cz and Pz-Oz electrode locations, respectively.
[0024] In the embodiment, Fpz-Cz single-lead sleep electroencephalogram signal data of 20 healthy subjects are randomly selected from the Sleep-EDF Database Expanded public sleep electroencephalogram database; the sampling frequency of the Fpz-Cz single-lead sleep electroencephalogram signal data is 100 Hz. The number of the 20 healthy subjects is not specifically limited, and can be determined according to specific conditions.
[0025] SHHS dataset (Sleep Heart Health Study) acquisition; the multicenter cohort study dataset SHHS-1 on cardiovascular and other sleep-disordered breathing diseases is used to evaluate the performance of the proposed method. The subjects of the dataset SHHS-1 are 40 years old or older and have multiple diseases. In order to minimize the impact of these diseases, the subjects with a smaller apnea hypopnea index (AHI) are selected as much as possible, that is, the smaller the AHI, the more normal, so that the subjects with an AHI less than the preset respiratory parameter are screened out as a screening dataset, and 50 subjects are randomly selected from the screening dataset as the SHHS dataset for analysis. In the embodiment, the preset respiratory parameter is not specifically limited. The sampling frequency of the C4-A1 electroencephalogram channel sleep electroencephalogram signal data is 125 Hz. The number of the 50 subjects is not specifically limited, and can be determined according to specific conditions.
[0026] Thus, the Sleep-EDF dataset and the SHHS dataset are obtained.
[0027] Step S002: data preprocessing.
[0028] It should be noted that, since other interference frequencies may exist when collecting signal data, directly analyzing the collected data may have errors, so the electroencephalogram signal data needs to be filtered and denoised.
[0029] According to the preset low-noise frequency and the preset high-noise frequency , the electroencephalogram signal data in the Sleep-EDF dataset and the SHHS dataset is filtered by Butterworth band-pass filtering, and the filtered electroencephalogram signal data is denoised by using wavelet packet denoising technology to obtain preprocessed electroencephalogram signal data, and the preprocessed Sleep-EDF dataset and the SHHS dataset are also obtained. The Butterworth band-pass filtering and the wavelet packet denoising technology are both known technologies, and will not be described in detail here.
[0030] wherein, in the present embodiment, the preset low-noise frequency is , the preset high-noise frequency is wherein, in the present embodiment, the preset low-noise frequency is and the preset high-noise frequency is not specifically limited, and can be determined by the implementer according to the specific situation.
[0031] wherein, in the present embodiment, the wavelet packet denoising technique adopts a Db4 wavelet basis function in the Daubechies (Db) wavelet function family, and a soft thresholding (Soft thresholding) function is used to modify it.
[0032] At this point, the preprocessed Sleep-EDF dataset and SHHS dataset are obtained.
[0033] Step S003: Obtain the to-be-analyzed generative adversarial network, optimize and adjust the network structure of the generator and discriminator in the GAN, obtain the network structure of the optimized and adjusted generator and discriminator; perform adversarial training according to the preprocessed electroencephalogram signal data in the Sleep-EDF dataset and the SHHS dataset, the network structure of the optimized and adjusted generator and discriminator, and the to-be-analyzed generative adversarial network, to obtain the final electroencephalogram synthetic signal data.
[0034] It should be noted that, since the data volume of the sleep stage of the actual human electroencephalogram signal is small and the data volume of different stages differs greatly, the electroencephalogram signal data is relatively complex, therefore a neural adversarial network is used to process and analyze the complex electroencephalogram signal data. Moreover, the GAN can efficiently extract key features from the EEG signal, and optimize the sleep staging result through generative adversarial training. This makes it have strong modeling ability when processing complex electroencephalogram signals, and can realize high-accuracy sleep staging prediction.
[0035] It needs to be further explained that in the training process of the GAN (Generative Adversarial Network), the generator obtains the synthetic sample, and then the discriminator learns through the adversarial training according to the data difference between the synthetic sample and the real sample. Generally, JS divergence (Jensen-Shannon Divergence) is used for adversarial training and learning, but JS divergence is prone to gradient disappearance and gradient explosion during training, and the training process is also difficult, so Wasserstein distance is used for adversarial training and learning in this embodiment, that is, WGAN (Wasserstein Generative Adversarial Network) is proposed. The Wasserstein distance is a known technology and will not be described in detail here.
[0036] Among them, since WGAN sometimes has difficulty converging for different samples, a WGAN with a gradient penalty term (Gradient penalty, GP) is proposed, that is, WGAN-GP.
[0037] In order to make the generator not only rely on the discriminator feedback in the adversarial training when generating samples, but also learn more features from the internal structure of the generated samples or between samples, so as to improve the quality and diversity of the generated samples, a self-supervised learning, that is, Self-WGAN-GP, is added to WGAN-GP.
[0038] Among them, SAGAN-GP (Self-Attention Generative Adversarial Network with Gradient Penalty) is a combination of attention mechanism and gradient penalty term.
[0039] Among them, the gradient penalty term is a known technology and will not be described in detail here.
[0040] It needs to be explained that in order to analyze the effect of the above three kinds of generative adversarial networks, the above three kinds of generative adversarial networks are analyzed to select the optimal generative adversarial network.
[0041] Specifically, WGAN, WGAN-GP and Self-WGAN-GP are denoted as the generative adversarial network to be analyzed; the accuracy effect of different samples of the generative adversarial network to be analyzed corresponding to different generative adversarial networks is analyzed through the following experiments.
[0042] At this point, the generative adversarial network to be analyzed is obtained.
[0043] It should be noted that due to the small number of corresponding samples in different sleep stages, the number of samples in different sleep stages is greatly different, causing class imbalance problem, which affects the learning effect of the model, so the data enhancement technology of the generative adversarial network is used to process the class imbalance problem.
[0044] Specifically, data enhancement is performed by optimizing and adjusting the generator network structure and the discriminator network structure respectively. Among them, the CNN model structure is used as the network structure in the generator and the discriminator.
[0045] First, the generator network structure optimization adjustment process is: It should be noted that due to the small amount of data in some stages, the number of samples in the small amount of data stage is increased by upsampling, which helps the model to better learn the features of these stages, thereby avoiding the model to be biased to the stages with more data. And upsampling also solves the problem of data class imbalance.
[0046] Specifically, the input high-dimensional vector of the generator is expanded in dimension by upsampling to obtain a higher-dimensional vector; and then the expanded higher-dimensional vector is input into the network structure corresponding to the generator. For example: the input of the generator is a reference dimension vector of 100 dimensions (or 125 dimensions), which is expanded to 3000 dimensions (or 3750 dimensions) by upsampling in the first step; and then the expanded reference dimension vector is input into the network structure corresponding to the generator.
[0047] Among them, the network structure corresponding to the generator includes: four convolutional layers (Conv1d), two maximum pooling layers (MaxPool1d), an LSTM layer, and two self-attention layers (Self-Attention); and the two self-attention layers (Self-Attention) are added after the first maximum pooling layer and the second activation function respectively; to more carefully extract and aggregate local and global features in the input vector, and then use the LSTM layer to process the features extracted by the convolutional layer to capture long-term dependencies in the sequence.
[0048] Then the output of the LSTM is flattened, a sleep stage electroencephalogram data output is generated through a linear layer, and then a feature is output through a fully connected layer to convert the feature to a suitable dimension for output, to obtain the synthesized electroencephalogram data. Among them, the Tanh activation function is applied in the feature space; wherein the Tanh activation function is a known technology, which will not be described in detail here.
[0049] Second, the discriminator network structure optimization adjustment process is: It should be noted that the network structure corresponding to the discriminator includes: a convolutional layer (Conv1d), a maximum pooling layer (MaxPool1d), and a self-attention layer (Self-Attention); the spectral norm (SN) is added to constrain the weight spectral norm of the convolutional layer, so as to improve the stability of the network.
[0050] Among them, the discriminator adjustment and data enhancement are carried out by two technologies, which are spectral normalization (SN) and two-scale update rule (TTUR).
[0051] Among them, the spectral normalization is a weight normalization technique used in the discriminator network to enhance the training process, which can ensure that the discriminator network is Lipschitz continuous; the TTUR technique is used to compensate for the slow learning problem of the regularized discriminator, making it possible to use fewer discriminator updates for each step of the generator update. Among them, SN and TTUR are known technologies, which will not be described in detail here.
[0052] Among them, the activation function LeakyReLU is used between the generator and the discriminator to ensure that the gradient can flow through the entire architecture. Among them, the activation function LeakyReLU is a known technology, which will not be described in detail here.
[0053] The final process of obtaining the electroencephalogram synthesis signal data is: According to the pre-processed electroencephalogram signal data in the Sleep-EDF data set and the SHHS data set, the network structure of the optimized and adjusted generator and discriminator, and the to-be-analyzed generative adversarial network model is trained in an adversarial manner, and the adversarial training result is evaluated by two evaluation indexes: FDRMSE (Frequency Domain Root Mean Square Error) and WD (Wasserstein Distance). Through the evaluation result, the optimal generative adversarial network is selected from the to-be-analyzed generative adversarial network model, and the optimal generative adversarial network is used to obtain the final synthesis sample, that is, a single-channel final electroencephalogram synthesis signal data is generated. Among them, the evaluation indexes FDRMSE and WD are known technologies, which will not be described in detail here.
[0054] The optimizer learning rate selection interval of the generator and the discriminator is [0.00001, 0.01], the optimizer is Adam, the momentum is β1=0.9 and β2=0.999, the slope of the Leaky ReLU action function is 0.2, the values of the hyperparameters λ of the gradient penalty term are respectively 1, 5 and 10, the values of the hyperparameters critic of the training mechanism are respectively 5, 10 and 20, and the iteration number is 8 times the length of the training data. Some parameters in the adversarial training are not specifically limited, and the implementer can determine according to the specific situation.
[0055] At this point, the final electroencephalogram synthesis signal data is obtained.
[0056] Step S004: automatically performing sleep staging of the electroencephalogram according to the final electroencephalogram synthesis signal data through a convolutional neural network model.
[0057] It should be noted that, since the electroencephalogram signal data is a continuous time series with strong correlation, the network needs to have a certain memory function to comprehensively judge the current sleep condition based on the information before and after. Since the input of the convolutional neural network (CNN) is an independent unit without context connection; in order to solve the above problem, a model with time characteristics is added.
[0058] Specifically, after using the CNN network to represent the features of the electroencephalogram signal data and using the residual network to retain the original information, a 3-layer BiGRU structure with low complexity and a multi-head self-attention mechanism are added, i.e., a CNN-BiGRU network structure is obtained; to help the network learn sequence information. The BiGRU layer and the attention layer are cascaded, wherein the output of the BiGRU layer is the input of the attention layer. The number of layers of the 3-layer BiGRU structure is an empirical and experimental value, but is not specifically limited, and the implementer can adjust it according to the specific sample data and scene.
[0059] According to the obtaining process of the final electroencephalogram synthesis signal data in step S003, the synthesized adjusted Sleep-EDF data set and SHHS data set are obtained, and the data of the training set, the validation set and the test set are divided into data sets in the ratio of 6:2:2. The CNN-BiGRU network structure is trained through the data set and the categories of the five sleep stages, and the classification performance of each sleep stage is evaluated through the precision (PR), recall (RE) and F1 score (F1). Through the evaluation results, the trained CNN-BiGRU model is obtained. The process of evaluating through the precision, recall and F1 score is a known technology, which will not be described in detail here. precision rate recall F1 score
[0060] In the CNN-BiGRU network structure, the Hard swish activation function is used to accelerate model convergence, and the Focal loss loss function is trained after feature fusion to improve the classification accuracy of the model. The Hard swish activation function and the Focal loss loss function are both known technologies, and will not be described in detail here.
[0061] During model training, the adaptive gradient method with weight decay is used to update and optimize the network weight value, which helps to avoid unnecessary effects of weight decay on bias parameters. In multiple training processes, the network still has overfitting problems. We use the random dropout and gradient clipping method to randomly remove neurons in the network with a certain probability to improve the generalization ability of the network. Secondly, the L2 regularization technology is used to reduce the complexity of the model by reducing the weight value in the loss function to prevent possible gradient instability and network degradation problems.
[0062] Finally, the trained CNN-BiGRU model is used for automatic sleep staging of electroencephalogram.
[0063] The flowchart of the automatic sleep staging of electroencephalogram is shown in Figure 3 .
[0064] As shown in Figure 2 , the second aspect of the present application provides an automatic sleep staging system for electroencephalogram based on SAGAN-GP and CNN-BiGRU, comprising the following modules: The data acquisition module 101 is used to acquire electroencephalogram data of different subjects, and the electroencephalogram data of subjects without sleep disorders is used to form a Sleep-EDF data set, and the electroencephalogram data of subjects with sleep disorders is used to form a SHHS data set. The data preprocessing module 102 is used to preprocess the electroencephalogram data to obtain the preprocessed Sleep-EDF data set and SHHS data set. The generative adversarial module 103 is used to obtain the generative adversarial network to be analyzed, optimize and adjust the network structure of the generator and discriminator in the GAN, and obtain the network structure of the optimized and adjusted generator and discriminator. According to the electroencephalogram data in the preprocessed Sleep-EDF data set and SHHS data set, the network structure of the optimized and adjusted generator and discriminator, and the generative adversarial network to be analyzed, the adversarial training is performed to obtain the final electroencephalogram synthetic signal data. The sleep staging module 104 is used to perform automatic sleep staging of electroencephalogram through the convolutional neural network model according to the final electroencephalogram synthetic signal data.
[0065] The third aspect of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the electroencephalogram automatic sleep staging method based on SAGAN-GP and CNN-BiGRU when executing the computer program.
[0066] The fourth aspect of the present application provides a computer readable storage medium, which stores a computer program, and the computer program implements the electroencephalogram automatic sleep staging method based on SAGAN-GP and CNN-BiGRU when executed by a processor.
[0067] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, etc.) containing computer-usable program code.
[0068] The present application is described with reference to flowcharts and / or block diagrams of the method, system, and computer program product according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce a device that implements the flow Figure 1 The function specified in one or more flows and / or blocks. Figure 1 The means for performing the function specified in one or more flows and / or blocks.
[0069] These computer program instructions can also be stored in a computer readable storage medium that can direct the computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer readable storage medium produce a product including instruction means, which implements the flow Figure 1 The function specified in one or more flows and / or blocks. Figure 1 The means for performing the function specified in one or more flows and / or blocks.
[0070] These computer program instructions can also be loaded into a computer or other programmable data processing apparatus, so that a series of operation steps are performed on the computer or other programmable data processing apparatus to produce a computer-implemented process, so that the instructions executed on the computer or other programmable data processing apparatus provide a process for implementing the flow Figure 1a flow or flows and / or a block Figure 1 a step of the function specified in a block or blocks.
[0071] It should be noted that the above-mentioned embodiments are only used to illustrate the technical solutions of the present application, but not limit the present application. Although the present application has been described in detail with reference to the above-mentioned embodiments, those skilled in the art should understand that the specific embodiments of the present application can be modified or equivalent replaced without departing from the spirit and scope of the present application, and any modification or equivalent replacement should be covered in the protection scope of the present application.
Claims
1. A SAGAN-GP and CNN-BiGRU-based electroencephalogram automatic sleep staging method, characterized in that, The method comprises the following steps: obtaining brain electrical signal data of different subjects, wherein the brain electrical signal data of sleep disorder-free subjects constitutes a Sleep-EDF dataset, and the brain electrical signal data of subjects with sleep disorders constitutes a SHHS dataset; preprocessing the brain electrical signal data to obtain the preprocessed Sleep-EDF dataset and SHHS dataset; obtaining a to-be-analyzed generative adversarial network, and optimizing and adjusting the network structure of a generator and a discriminator in the GAN to obtain the network structure of the generator and the discriminator after optimization and adjustment; performing adversarial training according to the brain electrical signal data in the preprocessed Sleep-EDF dataset and SHHS dataset, the network structure of the generator and the discriminator after optimization and adjustment, and the to-be-analyzed generative adversarial network to obtain final brain electrical synthetic signal data; performing automatic sleep staging of the brain electrical signal data through a convolutional neural network model according to the final brain electrical synthetic signal data.
2. The electroencephalogram automatic sleep staging method based on SAGAN-GP and CNN-BiGRU according to claim 1, characterized in that, The method comprises the following steps: randomly selecting Fpz-Cz single-lead sleep brain electrical signal data of a plurality of healthy subjects in the Sleep-EDF Database Expanded public sleep electroencephalogram database to constitute the Sleep-EDF dataset; A multicenter cohort study dataset SHHS-1 on cardiovascular and other sleep-disordered breathing diseases was used, from which subjects with AHI less than a pre-set respiratory parameter were screened as a screening dataset, and C4-A1 single-lead sleep electroencephalogram data of a number of subjects randomly selected from the screening dataset were used as a SHHS dataset as the SHHS dataset.
3. The electroencephalogram automatic sleep staging method based on SAGAN-GP and CNN-BiGRU according to claim 1, characterized in that, The method comprises the following steps: According to a preset low noise frequency and a preset high noise frequency The electroencephalogram data in the Sleep-EDF dataset and the SHHS dataset are filtered through a Butterworth band-pass filter, and then the electroencephalogram data after filtering is denoised by using a wavelet packet denoising technology, so as to obtain the preprocessed Sleep-EDF dataset and SHHS dataset.
4. The SAGAN-GP and CNN-BiGRU-based electroencephalogram automatic sleep staging method according to claim 1, characterized in that, The to-be-analyzed generative adversarial network comprises a WGAN, a WGAN-GP, and a Self-WGAN-GP.
5. The SAGAN-GP and CNN-BiGRU-based electroencephalogram automatic sleep staging method according to claim 1, characterized in that, The method comprises the following steps: The generator network structure optimization and adjustment process comprises the following steps: The input high-dimensional vector of the generator is dimensionally expanded through upsampling to obtain a higher-dimensional vector; the expanded higher-dimensional vector is then input into the network structure corresponding to the generator; wherein the network structure corresponding to the generator comprises four convolutional layers, two maximum pooling layers, an LSTM layer, and two self-attention layers; the two self-attention layers are added after the first maximum pooling layer and the second activation function, respectively; then the LSTM layer is used to process the features extracted through the convolutional layer; The output of the LSTM is then flattened, a linear layer is used to generate an output of sleep stage brain electrical signal data, and then a fully connected layer is used to output the features to a suitable dimension, thereby obtaining the synthetic brain electrical signal data; The discriminator network structure optimization and adjustment process comprises the following steps: The network structure corresponding to the discriminator comprises a convolutional layer, a max-pooling layer and a self-attention layer; the discriminator is adjusted and the data is enhanced through spectral normalization and two time scale update rules; specifically, the spectral normalization is a weight regularization technique used in the discriminator network to enhance the training process, that is, the weight spectral norm of the convolutional layer is constrained by adding spectral normalization; the two time scale update rule technique is used to compensate for the slow learning problem of the regularized discriminator.
6. The SAGAN-GP and CNN-BiGRU-based electroencephalogram automatic sleep staging method according to claim 1, characterized in that, The final electroencephalogram synthetic signal data is obtained by performing adversarial training on the preprocessed electroencephalogram signal data in the Sleep-EDF data set and the SHHS data set, the network structure of the generator and the discriminator after optimization and adjustment, and the generated adversarial network to be analyzed, and comprises the following steps: The acquisition process of the final electroencephalogram synthetic signal data is as follows: The final electroencephalogram synthetic signal data is obtained by performing adversarial training on the preprocessed electroencephalogram signal data in the Sleep-EDF data set and the SHHS data set, the network structure of the generator and the discriminator after optimization and adjustment, and the generated adversarial network to be analyzed, and comprises the following steps:
7. The SAGAN-GP and CNN-BiGRU-based electroencephalogram automatic sleep staging method according to claim 6, characterized in that, The final electroencephalogram synthetic signal data is obtained by performing adversarial training on the preprocessed electroencephalogram signal data in the Sleep-EDF data set and the SHHS data set, the network structure of the generator and the discriminator after optimization and adjustment, and the generated adversarial network to be analyzed, and comprises the following steps: After using the CNN network to represent the features of the electroencephalogram signal data and using the residual network to retain the original information, a BiGRU structure with low complexity and a multi-head self-attention mechanism are added, i.e., a CNN-BiGRU network structure is obtained; The synthetic adjusted Sleep-EDF data set and the SHHS data set are obtained according to the acquisition process of the final electroencephalogram synthetic signal data, and the synthetic adjusted Sleep-EDF data set and the SHHS data set are used to divide a training set, a validation set and a test set; the CNN-BiGRU network structure is trained through the data set and the five sleep stage categories, the classification performance of each sleep stage is evaluated through the precision, recall and F1 score, and a trained CNN-BiGRU model is obtained through the evaluation result; Finally, the trained CNN-BiGRU model is used for electroencephalogram automatic sleep staging.
8. An electroencephalogram automatic sleep staging system based on SAGAN-GP and CNN-BiGRU, characterized in that, It comprises: A data acquisition module is configured to acquire electroencephalogram signal data of different subjects, wherein the electroencephalogram signal data of subjects without sleep disorders constitutes a Sleep-EDF data set, and the electroencephalogram signal data of subjects with sleep disorders constitutes a SHHS data set; A data preprocessing module is configured to preprocess the electroencephalogram signal data to obtain a preprocessed Sleep-EDF data set and a SHHS data set; The generation confrontation module is configured to obtain a to-be-analyzed generative adversarial network, optimize and adjust network structures of a generator and a discriminator in the GAN, and obtain the network structures of the optimized and adjusted generator and the discriminator; and perform adversarial training according to the preprocessed electroencephalogram signal data in the Sleep-EDF dataset and the SHHS dataset, the network structures of the optimized and adjusted generator and the discriminator, and the to-be-analyzed generative adversarial network, to obtain final electroencephalogram synthetic signal data. The sleep staging module is configured to perform electroencephalogram automatic sleep staging on the final electroencephalogram synthetic signal data through a convolutional neural network model.
9. An electronic device, comprising: The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the electroencephalogram automatic sleep staging method based on the SAGAN-GP and the CNN-BiGRU according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the electroencephalogram automatic sleep staging method based on the SAGAN-GP and the CNN-BiGRU according to any one of claims 1-7.
Citation Information
Cited By
Single-channel electroencephalogram sleep analysis method and related equipment
CN121971042A