PSG data automatic analysis method, device, computer equipment and storage medium
Technical Field
The invention relates to the technical field of sleep analysis, in particular to a method and a device for automatically analyzing PSG data, computer equipment and a storage medium.
Background
Obstructive sleep apnea-hypopnea syndrome (OSAHS) is a major source disease that can lead to hypertension, diabetes, coronary heart disease, senile dementia, and other diseases. Relevant studies indicate that 9.36 million people suffer from OSAHS in 2019 globally, and the number of people suffering from OSAHS in China is in the front of the world. OSAHS causes huge burden to the socioeconomic performance of China. Disease diagnosis of OSAHS requires monitoring of the patient's nocturnal sleep. At present, a Polysomnography (PSG) is mainly used for monitoring and analyzing signals of electroencephalogram, electrooculogram, geniomeyogram, electrocardio, blood oxygen, pulse wave and the like during the night sleep of a patient.
Where sleep staging is an important component of diagnosis of OSAHS disease. Professional sleep analysts perform sleep staging analysis using the PSG data, which consumes a great deal of time and labor cost. An experienced physician performed 3 events analysis per day relating to diagnosis of OSAHS disease. Differences between different physicians can cause the analysis results to have a variation rate of 5-20%. The sleep monitoring center is mainly concentrated in developed areas, and the distribution of related medical resource areas is unbalanced. Meanwhile, the cultivation threshold of sleep analysis doctors is high, and the sleep analysis talents are in short supply, so that the requirements of OSAHS disease diagnosis cannot be met. The problems can be effectively alleviated by using an artificial intelligence-based automatic sleep staging algorithm.
The automatic sleep staging algorithm uses the PSG-related signals to perform sleep staging analysis on the data of a night frame by frame. Only tens of seconds are needed to output a complete and accurate sleep staging result of a patient. The efficiency of sleep staging analysis can be greatly improved. In the traditional automatic sleep staging algorithm, the feature extraction method mainly comprises Fourier transform, wavelet transform, power spectrum, approximate entropy and the like. And inputting the extracted features into a traditional machine learning classifier for sleep stage analysis. The method needs to manually determine specific characteristics, has great limitation and has a good effect in a large amount of data.
Disclosure of Invention
In order to overcome the defects of the prior art, the invention provides a PSG data automatic analysis method, a PSG data automatic analysis device, computer equipment and a storage medium.
The technical scheme adopted by the invention for solving the technical problems is as follows: in a method for automatic analysis of PSG data, the improvement comprising the steps of:
s10, acquiring raw data, wherein the raw data comprises physiological signal data and sleep stage label data;
s20, preprocessing data, wherein the preprocessing comprises filtering, denoising, resampling and multi-frame splicing of physiological signal data;
and S30, processing the data by the sleep stage prediction module, inputting the preprocessed data into the sleep stage prediction module, wherein the processing process comprises the steps of extracting the characteristics of the input data by the characteristic extraction module, performing characteristic fusion on the extracted characteristics by the characteristic fusion module to obtain a characteristic vector, fusing the characteristic vector and the coding vector to obtain a new characteristic vector, and inputting the new characteristic vector into the Transformer module to obtain the sleep stage result of the current frame.
Further, in step S10, the physiological signal data includes an electroencephalogram signal, an electrooculogram signal, a mandibular electromyogram signal, an electrocardiographic signal, a chest strap signal, an abdominal strap signal, a pulse wave signal, a leg movement signal, a snore signal, a pulse rate signal, a blood oxygen saturation signal, and an electrocardiographic RR interval signal.
Further, in step S20, the filtering is used to remove invalid information of low frequency and high frequency, the denoising is used to remove noise in the signal, the resampling is used to convert the data into the same fixed frequency, and the multi-frame splicing is used to splice adjacent multi-frame data to correspond to a frame of sleep staging result.
Further, in step S30, the input data includes one or more signals selected from an electroencephalogram signal, an electrooculogram signal, a mandibular electromyogram signal, an electrocardiographic signal, a chest strap signal, an abdominal strap signal, a pulse wave signal, a leg movement signal, a snoring signal, a pulse rate signal, a blood oxygen saturation level signal, and an electrocardiographic RR interval signal, and the step of extracting the features of the input data includes:
s301, extracting the features of the input data by adopting a BN layer, a convolution layer, a ReLU layer combination and n serially connected group convolution modules in a feature extraction module;
s302, inputting the input data to a ReLU layer after adjusting the number of channels and fusing information among the channels through a BN layer and a convolution layer of 1 × 1;
s303, obtaining a preliminary characteristic diagram, and inputting the preliminary characteristic diagram into a BN layer, a 3 x 1 group convolution layer and a ReLU layer for further characteristic extraction;
s304, inputting the obtained feature map into the BN layer, the 1 × 1 convolution layer and the ReLU layer, and performing channel number adjustment and information fusion among channels to obtain a new feature map;
and S305, splicing the new feature graph with the input data, and inputting the new feature graph and the input data into a pooling layer to perform feature graph size adjustment and feature information fusion to obtain the output of the group convolution module.
Further, in step S30, the step of performing feature fusion on the extracted features by using a feature fusion module to obtain a feature vector includes:
s306, inputting the features extracted by the feature extraction module into a pooling layer to obtain fusion features;
s307, inputting the fusion features into a Flatten layer and unfolding the fusion features into one-dimensional feature vectors;
s308, the unfolded features pass through a full connection layer to obtain feature vectors;
the step of fusing the feature vector and the coding vector to obtain a new feature vector comprises the following steps:
s309, coding is carried out by using sleep stage results of the front and rear adjacent M frames to obtain a coding vector, and during model training, sleep stage labels of the front and rear adjacent M frames are adopted, wherein the value range of M is 0-100;
and S310, fusing the feature vector and the coding vector to obtain a new feature vector.
Further, in step S30, the step of inputting the new feature vector into the Transformer module to obtain the sleep stage result of the current frame includes:
s311, inputting the new feature vector into a transform module to obtain a final sleep stage result of the current frame;
and S312, because the new feature vector contains the feature information of the current frame and the sleep staging information of the adjacent M frames before and after, the sleep staging result of the current frame can be obtained through the transform module according to the feature of the current frame and the time sequence relation of the adjacent M frames before and after.
Further, the method also comprises the step of performing label smoothing on the sleep stage label data:
one-hot tags were converted to soft tags in training:
each component satisfies:
;
wherein c is the sleep stage number represented by the label, alpha i A weight coefficient corresponding to each sleep stage, k is the total number of sleep stages, epsilon is a label smoothing parameter, p i Labeling the value of each component for the sleep stage;
the invention also discloses a PSG data automatic analysis device, which is improved in that the device comprises an original data processing module, a data preprocessing module and a sleep stage prediction module;
the original data processing module is used for realizing the acquisition of original data, and the original data comprises physiological signal data and sleep stage label data;
the data preprocessing module is connected with the original data processing module and is used for filtering, denoising, resampling and multi-frame splicing the original data;
the sleep stage prediction module is connected with the data preprocessing module and comprises a feature extraction module, a feature fusion module and a Transformer module which are sequentially connected, wherein the feature extraction module is used for performing feature extraction on input data, the feature fusion module is used for performing feature fusion on extracted features to obtain feature vectors, and fusing the feature vectors and coding vectors to obtain new feature vectors, and the Transformer module is used for realizing new feature vector input and obtaining a sleep stage result of a current frame.
Further, the physiological signal data comprises an electroencephalogram signal, an electrooculogram signal, a mandibular electromyogram signal, an electrocardiosignal, a chest strap signal, an abdominal strap signal, a pulse wave signal, a leg movement signal, a snore signal, a pulse rate signal, a blood oxygen saturation signal and an electrocardio RR interval signal.
Furthermore, the feature extraction module comprises a BN layer, a convolution layer, a ReLU layer combination and n series-connected group convolution modules, and feature extraction is carried out on the input data through the BN layer, the convolution layer, the ReLU layer combination and the n series-connected group convolution modules.
Further, the feature fusion module comprises a pooling layer, a Flatten layer and a full connection layer, wherein the output of the pooling layer is unfolded into a one-dimensional fusion vector through the Flatten layer, and the unfolded one-dimensional fusion vector passes through the full connection layer to obtain a feature vector.
The invention also discloses a computer device, which comprises a memory and a processor, wherein the memory is stored with a computer program, and the improvement is that the processor realizes the steps of the PSG data automatic analysis method when executing the computer program.
The invention also discloses a computer storage medium on which a computer program is stored, the improvement of which is that the computer program realizes the steps of the PSG data automatic analysis method when being executed by a processor.
The invention has the beneficial effects that: the method and the device for automatically analyzing the PSG data can greatly improve the efficiency of doctors in analyzing the PSG signals of patients all night; after clinical application, daily workload of doctors can be greatly relieved, the efficiency of seeing a doctor for a patient is greatly improved, and the cost of seeing a doctor for the patient is reduced.
Drawings
Fig. 1 is a schematic flow chart of an automatic PSG data analysis method according to the present invention.
Fig. 2 is a general framework diagram of a sleep stage prediction module in the PSG data automatic analysis method of the present invention.
Fig. 3 is a schematic diagram of a data processing flow of a group convolution module in the PSG data automatic analysis method of the present invention.
Fig. 4 is a schematic diagram of a PSG data automatic analysis apparatus according to the present invention.
Detailed Description
The invention is further illustrated with reference to the following figures and examples.
The conception, the specific structure, and the technical effects produced by the present invention will be clearly and completely described below in conjunction with the embodiments and the accompanying drawings to fully understand the objects, the features, and the effects of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments, and those skilled in the art can obtain other embodiments without inventive effort based on the embodiments of the present invention, and all embodiments are within the protection scope of the present invention. In addition, all the connection relations related in the patent do not mean that the components are directly connected, but mean that a better connection structure can be formed by adding or reducing connection auxiliary components according to specific implementation conditions. All technical characteristics in the invention can be interactively combined on the premise of not conflicting with each other.
Referring to fig. 1, the present invention discloses a method for automatically analyzing PSG data, and specifically, in this embodiment, the method includes the following steps:
s10, acquiring raw data, wherein the raw data comprises physiological signal data and sleep stage label data;
in this embodiment, the physiological signal data includes an electroencephalogram signal, an electrooculogram signal, a mandibular electromyogram signal, an electrocardiograph signal, a chest strap signal, an abdominal strap signal, a pulse wave signal, a leg movement signal, a snore signal, a pulse rate signal, a blood oxygen saturation signal, and an electrocardiograph RR interval signal; training a sleep staging method model can be performed by adopting one or more physiological signal data combinations; in this embodiment, a sleep staging method model is trained by using a combination of an electroencephalogram signal, an electrooculogram signal, and a mandibular electromyogram signal.
S20, preprocessing data, wherein the preprocessing comprises filtering, denoising, resampling and multi-frame splicing of physiological signal data; in the scheme, filtering is used for removing invalid information of low frequency and high frequency, denoising is used for removing noise in signals, resampling is used for converting data into the same fixed frequency, and multi-frame splicing is used for splicing adjacent multi-frame data to correspond to a sleep stage result.
And S30, processing the data by the sleep stage prediction module, inputting the preprocessed data into the sleep stage prediction module, wherein the processing process comprises the steps of extracting the characteristics of the input data by the characteristic extraction module, performing characteristic fusion on the extracted characteristics by the characteristic fusion module to obtain a characteristic vector, fusing the characteristic vector and the coding vector to obtain a new characteristic vector, and inputting the new characteristic vector into the Transformer module to obtain the sleep stage result of the current frame. And the coding vector is coded by using the result of the adjacent multi-frame sleep stages to obtain the coding vector.
In step S30, the input data includes one or more signals selected from an electroencephalogram signal, an electrooculogram signal, a mandibular electromyogram signal, an electrocardiographic signal, a chest strap signal, an abdominal strap signal, a pulse wave signal, a leg movement signal, a snore signal, a pulse rate signal, a blood oxygen saturation signal, and an electrocardiographic RR interval signal.
More specifically, as shown in fig. 2 and 3, the step of extracting the features of the input data in step S30 includes:
s301, extracting the features of the input data by adopting a BN layer, a convolution layer and a ReLU layer combination in a feature extraction module and n serially connected group convolution modules;
s302, inputting the input data into a ReLU layer after adjusting the number of channels and fusing information among the channels through a BN layer and a 1 x 1 convolution layer;
s303, obtaining a preliminary feature map, and inputting the preliminary feature map into the BN layer, the 3 x 1 group convolution layer and the ReLU layer for further feature extraction;
s304, inputting the obtained feature graph into the BN layer, the 1 × 1 convolution layer and the ReLU layer, and performing channel number adjustment and information fusion among channels to obtain a new feature graph;
s305, splicing the new feature graph with input data, and inputting the new feature graph and the input data into a pooling layer to perform feature graph size adjustment and feature information fusion to obtain the output of a group convolution module; wherein the input data is characteristic map data processed by a neural network.
Further, as shown in fig. 2, in step S30, the step of performing feature fusion on the extracted features by using a feature fusion module to obtain a feature vector includes:
s306, inputting the features extracted by the feature extraction module into a pooling layer to obtain fusion features;
s307, inputting the fusion features into a Flatten layer and unfolding the fusion features into one-dimensional feature vectors;
s308, the unfolded features pass through a full connection layer to obtain feature vectors;
and, the step of fusing the feature vector and the encoding vector to obtain a new feature vector comprises:
s309, coding is carried out by using sleep stage results of the front and rear adjacent M frames to obtain a coding vector, and during model training, sleep stage labels of the front and rear adjacent M frames are adopted, wherein the value range of M is 0-100;
and S310, fusing the feature vector and the coding vector to obtain a new feature vector.
Further, in step S30, the step of inputting the new feature vector into the Transformer module to obtain the sleep stage result of the current frame includes:
s311, inputting the new feature vector into a transform module to obtain a final sleep stage result of the current frame;
and S312, because the new feature vector contains the feature information of the current frame and the sleep staging information of the adjacent M frames before and after, the sleep staging result of the current frame can be obtained through the transform module according to the feature of the current frame and the time sequence relation of the adjacent M frames before and after.
In addition, in the above embodiment, the method further includes the step of performing tag smoothing on the sleep stage tag data:
one-hot tags were converted to soft tags in training:
each component satisfies:
;
wherein c is the markSigned sleep stage number, alpha i A weight coefficient corresponding to each sleep stage, k is the total number of sleep stages, epsilon is a label smoothing parameter, p i Labeling the value of each component for the sleep stage;
with reference to fig. 4, the present invention further discloses an automatic PSG data analysis device, which includes an original data processing module 10, a data preprocessing module 20, and a sleep stage prediction module 30; the original data processing module 10 is configured to acquire original data, where the original data includes physiological signal data and sleep stage tag data; the data preprocessing module 20 is connected to the raw data processing module 10, and is configured to perform filtering, denoising, resampling, and multi-frame splicing on raw data; the sleep stage prediction module 30 is connected to the data preprocessing module 20, and the sleep stage prediction module 30 includes a feature extraction module, a feature fusion module and a Transformer module, which are connected in sequence, where the feature extraction module is configured to perform feature extraction on input data, the feature fusion module is configured to perform feature fusion on extracted features to obtain feature vectors, and fuse the feature vectors and coding vectors to obtain new feature vectors, and the Transformer module is configured to implement new feature vector input, and obtain sleep stage results of a current frame. Because the new feature vector contains the feature information of the current frame and the sleep stage information of the adjacent M frames, the sleep stage result of the current frame can be obtained through the Transformer module according to the features of the current frame and the time sequence relation of the adjacent M frames.
In this embodiment, the feature extraction module includes a BN layer, a convolution layer, a ReLU layer combination and n series-connected group convolution modules, and performs feature extraction on the input data through the BN layer, the convolution layer, the ReLU layer combination and the n series-connected group convolution modules. The feature fusion module comprises a pooling layer, a Flatten layer and a full-connection layer, wherein the output of the pooling layer is unfolded into one-dimensional fusion vectors through the Flatten layer, and the unfolded one-dimensional fusion vectors pass through the full-connection layer to obtain feature vectors.
In the above embodiment, the physiological signal data includes an electroencephalogram signal, an electrooculogram signal, a mandibular electromyogram signal, an electrocardiograph signal, a chest strap signal, an abdominal strap signal, a pulse wave signal, a leg movement signal, a snore signal, a pulse rate signal, a blood oxygen saturation signal, and an electrocardiographic RR interval signal.
In addition, the invention also discloses computer equipment which comprises a memory and a processor, wherein the memory is stored with a computer program, and the processor realizes the PSG data automatic analysis method when executing the computer program.
Furthermore, the present invention also discloses a computer storage medium, on which a computer program is stored, wherein the computer program is executed by a processor to implement the PSG data automatic analysis method as described above.
Based on the above, the method and the device for automatically analyzing the PSG data provided by the invention can greatly improve the efficiency of a doctor for analyzing the PSG signals of a patient all night, about three hours of manual analysis is originally needed, and the accuracy and the consistency of a human doctor can be achieved only by thirty seconds.
After clinical application, daily workload of doctors can be greatly relieved, the doctors have more energy to engage in diagnosis and scientific research work requiring more mental labor, the diagnosis efficiency of patients is greatly improved, and the diagnosis cost of the patients is reduced.
While the preferred embodiments of the present invention have been illustrated and described, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.