Sleep state detection method, device and system based on electroencephalogram acquisition head ring

A sleep state and detection method technology, applied in the field of sleep detection, can solve problems such as poor test results, and achieve the effects of correct classification, accurate collection, and accurate identification

Pending Publication Date: 2022-06-07
钧晟(天津)科技发展有限公司
0 Cites 0 Cited by

AI-Extracted Technical Summary

Problems solved by technology

[0004] In view of this, the present invention aims to propose a sleep state detection method, device and system based on an EEG acqui...
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Abstract

The invention provides a sleep state detection method, device and system based on an electroencephalogram collection head ring, and the method comprises the steps: obtaining EEG electroencephalogram signals of an FP1 electrode and an FP2 electrode in a 10-20 international standard lead system; the EEG electroencephalogram signals are processed, and EEG epoch signals of 30 s are obtained; and inputting the 30s EEG epoch signal into a trained electroencephalogram staging attention mechanism model, and obtaining a sleep stage staging result output by the electroencephalogram staging attention mechanism model. According to the sleep state detection method, the sleep state of the user can be obtained through collection and data analysis of electroencephalogram signals, and then reference can be provided for the user to know the sleep health state of the user.

Application Domain

Technology Topic

Eeg electrodesPhysical therapy +5

Image

  • Sleep state detection method, device and system based on electroencephalogram acquisition head ring
  • Sleep state detection method, device and system based on electroencephalogram acquisition head ring
  • Sleep state detection method, device and system based on electroencephalogram acquisition head ring

Examples

  • Experimental program(5)

Example Embodiment

[0078] Example 1
[0079] figure 1 This is a schematic flowchart of the sleep state detection method based on the EEG acquisition headband provided in the first embodiment of the present invention. This embodiment can be applied to the sleep state detection using the portable EEG acquisition headband. The sleep state detection device is implemented, which specifically includes the following steps:
[0080] S110. Obtain the EEG signals of the FP1 electrode and the FP2 electrode in the 10-20 international standard lead system;
[0081] Exemplarily, a portable EEG signal acquisition headband can be used, and electrode pads can be placed with reference to the 10-20 system electrode placement method to obtain the EEG EEG of the user's FP1 and FP2 electrodes corresponding to the 10-20 system electrode placement method. Signal,
[0082] figure 2 For a schematic diagram of the structure of the EEG signal acquisition head ring in the sleep state detection method based on the EEG acquisition head ring provided by the first embodiment of the present invention, see figure 2 The EEG signal acquisition head ring includes: electrode sheets and connecting devices connected in sequence for collecting EEG signals, a bioelectric signal acquisition module for EEG signal amplification and transformation, and a bioelectric signal acquisition module for controlling bioelectric signal acquisition. The ESP32 processor of the module and the WIFI wireless transmission circuit for transmitting EEG signals, the EEG signal acquisition head ring also includes a power circuit respectively connecting the bioelectric signal acquisition module and the ESP32 processor, and a retractable head for carrying content chips and circuits Ring housing. Wherein, the electrode sheet and the connecting device collect the EEG signal of the user's prefrontal lobe region, and are connected to the bioelectrical signal acquisition module through a flexible cable for acquisition and transmission of the bioelectrical signal.
[0083] The above-mentioned bioelectric signal acquisition module is composed of an integrated high common mode rejection ratio analog input module for receiving the voltage signal collected by the EEG cap, a low-noise programmable gain amplifier (PGA) for amplifying the brain voltage signal, and a It is composed of a bioelectric signal acquisition chip of a high-resolution synchronous sampling analog-to-digital converter (ADC) that converts analog signals into digital signals.
[0084] The above ESP32 processor is used to control the acquisition mode and parameters of the bioelectric signal acquisition module and control the WiFi wireless transmission mode and transmission speed.
[0085] The input of the above WiFi wireless transmission circuit is the output of the bioelectric signal acquisition module, which transmits the EEG signal data to the EEG signal analysis software.
[0086] The above-mentioned power supply circuit has an input voltage of 5V, and is powered by a lithium battery. The voltage conversion module provides different working voltages required by the system. It is also possible to directly use a USB data cable for power supply without using a lithium battery, but this will affect its portability.
[0087] The above-mentioned retractable headgear shell includes a post-ear fixing device, a retractable device, an elastic lining, a shell and an electrode opening, which can be worn on a human head and fixed behind the ear through the fixing device. For people with different head shapes, the retractable device can be used. Adjust the tightness of the headband. There are four electrode openings in the shell for placing four electrodes to contact the human body. The four electrodes are located on the forehead and behind the ears.
[0088] S120, processing the EEG signal to obtain an EEG epoch signal of 30s;
[0089] First, the collected EEG signals need to be preprocessed, by intercepting the 30s EEG epoch signal to reduce the difficulty of data processing and improve the analysis efficiency of the algorithm; exemplarily, a sixth-order Butterworth with a cutoff frequency of 0.1-50Hz can be used. The Sterling bandpass filter processes the complete EEG vector to filter out noise to improve the accuracy of subsequent signal processing. Then the collected EEG signal is down-sampled from 500Hz to 100Hz. Then, the EEG vector is divided into time series segments of 30s, and the 30s EEG epoch signal can be obtained.
[0090] image 3 A schematic flowchart of the method for acquiring the EEGepoch signal in 30s in the sleep state detection method based on the EEG acquisition headband provided in Embodiment 1 of the present invention, as shown in image 3 As shown, the EEG EEG signal can be processed by a sixth-order Butterworth band-pass filter with a cutoff frequency of 0.1-50Hz; then the processed EEG EEG signal is down-sampled from 500Hz to 100Hz, and then the EEG signal is downsampled. The complete EEG signal is divided into time series segments of 30s, and several 30s EEGepoch signals are obtained.
[0091] S130, input the EEG epoch signal of the 30s into the trained EEG staged attention mechanism model, and obtain the approximate Hilbert change of the EEG epoch signal of the 30s, that is, the EEG signal epoch;
[0092]The Hilbert transform is an important tool in signal analysis and is very useful in signal processing systems and communication systems. The main functions are as follows: First, it is used to construct an analytical signal, so that the signal spectrum contains only positive frequency components, thereby reducing the sampling rate of the signal; A method is proposed; the third is that it can be combined with other transformations and decompositions to perform spectrum analysis of non-stationary signals.
[0093] Exemplarily, the EEG epoch of 30s may be input to the first convolutional layer, the convolutional kernel size of the convolutional layer is Fs=N/100, 64 convolutional kernels, and the moving step size is Sd=N/1000. N is the number of sampling points included in each EEG epoch, that is, N=30*100=3000. The output of the convolutional layer is then fed into the two max-pooling layers, respectively. The size of the first pooling layer is N/1000, and its output is the frequency feature of the input EEG epoch, and the second output is of size π*N/1000, and its output is the amplitude feature of the input EEG epoch. Finally, the outputs of the two pooling layers will be summed point by point to obtain the approximate Hilbert variation of the input signal. Note that the input EEG epoch of 30s is s(t), then the Hilbert change is:
[0094] s a (t)=s(t)+i*H(s(t))
[0095] Among them, the real part contains frequency information, and the imaginary part contains amplitude information;
[0096] The * here represents the convolution operation.
[0097] Figure 4 It is a schematic structural diagram of a neural network unit of Hilbert transform in the sleep state detection method based on EEG acquisition headband provided in Embodiment 1 of the present invention; the neural network unit includes a first convolution layer and two maximum pooling layers ; Input the 30s EEG epoch signal into the first convolution layer, the convolution kernel size of the first convolution layer is Fs=N/100, 64 convolution kernels, and the moving step size is Sd=N/1000; among them, N is The number of sampling points contained in the EEG epoch signal of each 30s, that is, N=30*100=3000; the output of the first convolutional layer is input to the two maximum pooling layers respectively; among them, the first maximum pooling The size of the layer output is N/1000, and its output is the frequency characteristic of the 30s EEG epoch signal. The output size of the second maximum pooling layer is π*N/1000, and its output is the input 30s EEG epoch signal. Amplitude characteristics.
[0098] S140. Use the encoder in the EEG staged attention mechanism model to encode the EEG signal epoch to obtain a vector mapping sequence; the encoder includes a first residual block, a second residual block, and a global average pool that are sequentially connected chemical layer.
[0099] Figure 5 It is a schematic structural diagram of the first residual block in the sleep state detection method based on the EEG acquisition headband provided in Embodiment 1 of the present invention; such as Figure 5 As shown, the first residual block includes: the second convolution layer, the number of convolution kernels in the second convolution layer is 128, the convolution kernel size is 1*1, and the stride is 2; the third convolution layer, the first The number of convolution kernels in the third convolution layer is 64, the size of the convolution kernel is 3*1, and the stride is 1; the fourth convolution layer, the number of convolution kernels in the fourth convolution layer is 128, and the size of the convolution kernel is 1 *1, the step size is 1; the shortcut connection of the residual network of the first residual block uses the average pooling layer, the size of the average pooling layer is 2, and the step size is 2, so as to realize the conversion of 64-dimensional input into 128-dimensional output ; Sum the output of the fourth convolutional layer and the output of the average pooling layer, and then pass through the RELU function to obtain the output of the first residual block.
[0100] Image 6 A schematic structural diagram of the second residual block in the sleep state detection method based on the EEG acquisition headband provided in Embodiment 1 of the present invention, as shown in Image 6 As shown, the second residual block includes: the fifth convolution layer, the number of convolution kernels in the fifth convolution layer is 128, the size of the convolution kernel is 1*1, and the stride is 2; the sixth convolution layer, the first The number of convolution kernels of the six convolutional layers is 64, the size of the convolution kernels is 3*1, and the stride is 1; for the seventh convolutional layer, the number of convolution kernels of the seventh convolutional layer is 128, and the size of the convolution kernels is 1*1, the step size is 1; among them, the direct connection is used for the shortcut connection of the residual network of the second residual block; the output of the seventh convolutional layer and the direct connection are summed, and then after the RELU function, the second residual is obtained. The output of the difference block.
[0101] Compared with the traditional CNN, the last layer is a fully connected layer, and the number of parameters is very large, which is easy to cause overfitting (such as Alexnet). In a CNN model, most of the parameters are occupied by the fully connected layer, so this The embodiment proposes to use global mean pooling to replace the fully connected layer. Unlike traditional fully connected layers, we Figure 1 The entire image is globally mean pooled so that each feature map can get an output. In this way, the use of mean pooling can omit parameters, which can greatly reduce network parameters and avoid overfitting. On the other hand, it has a feature that each feature map is equivalent to an output feature, and then this feature represents our output class. feature.
[0102] Specifically, the advantages of global average pooling include: by enhancing the consistency between feature maps and categories, the convolution structure is simpler; no parameter optimization is required, so this layer can avoid overfitting; The summation is thus more stable to the spatial transformation of the input, so the processing efficiency of the EEG staged attention mechanism model can be effectively improved by using a global average pooling layer.
[0103] S150. Use the decoder based on the multi-head attention mechanism in the EEG staged attention mechanism model to decode the vector map sequence; the decoder includes a multi-head attention sub-module connected in sequence, a first fully connected layer, and a second full connection layer;
[0104] The resulting sequence of vector maps after encoding is decoded by a multi-head attention submodule and two fully connected layers.
[0105] Exemplarily, the output of the encoder and the position encoding PE can be summed and normalized, and then input to the multi-head attention mechanism sub-module of the decoder; wherein, the calculation method of the position encoding PE is as follows:
[0106]
[0107]
[0108] where p represents the position of the current EEG signal epoch in the input EEG signal epoch queue; d represents the number of EEG signal epochs contained in the input queue input to the multi-head attention mechanism sub-module; dim represents the global average pooling layer The number of output data; the position mapping of each EEG signal epoch can be directly calculated by the above equation without training, thus speeding up the training and helping the algorithm to learn transition rules from two directions.
[0109] After the input and output of the decoder are summed and normalized by residual connection, they are input to the second DropOut layer; wherein, the DropOut probability of the second DropOut layer is 0.5;
[0110] The output of the second DropOut layer is input into the SoftMax layer, and the SoftMax layer outputs the sleep stage staging results.
[0111] Compared with the traditional method, this embodiment introduces a multi-head attention mechanism. Traditional EEG analysis methods either do not pay attention to cross-time analysis, that is, when analyzing the current epoch, do not pay attention to the impact of the epoch before and after the epoch, or often use LSTM for analysis, but LSTM cannot perform parallel computing and will prolong the training process. The multi-head attention mechanism enables parallel computation and shortens the training process while performing cross-temporal analysis.
[0112] S160. Obtain the sleep stage staging result output by the EEG staging attention mechanism model.
[0113] The sleep state of the user can be obtained by collecting and analyzing the EEG signals, which can then provide a reference for the user to understand their own sleep health state; the sleep state based on the EEG acquisition headband provided in this embodiment The detection method can realize the accurate collection, accurate identification and correct classification of EEG signals, and classify the user's sleep state by identifying the user's EEG signal, so as to provide the user with a reference to understand his own sleep health state.

Example Embodiment

[0114] Embodiment 2
[0115] Figure 7 This is a schematic flowchart of a sleep state detection method based on an EEG acquisition headband provided in Embodiment 2 of the present invention; this embodiment is optimized on the basis of the above-mentioned embodiment. In this embodiment, the EEG phased attention mechanism is used. The encoder in the model encodes the EEG signal epoch, and after obtaining the vector mapping sequence, the following steps are added: input the vector mapping sequence output by the global average pooling layer into the first DropOut layer to obtain the output of the encoder; The DropOut probability of the DropOut layer is 0.5.
[0116] Correspondingly, the sleep state detection method based on the EEG acquisition headband provided by this embodiment specifically includes:
[0117] S210. Obtain the EEG signals of the FP1 electrode and the FP2 electrode in the 10-20 international standard lead system;
[0118] S220, processing the EEG signal to obtain an EEG epoch signal of 30s;
[0119] S230, input the EEG epoch signal of the 30s into the EEG staged attention mechanism model that has been trained, and obtain the approximate Hilbert change of the EEG epoch signal of the 30s, that is, the EEG signal epoch;
[0120] S240. Use the encoder in the EEG staged attention mechanism model to encode the EEG signal epoch to obtain a vector mapping sequence; the encoder includes a first residual block, a second residual block, and a global average pool that are sequentially connected chemical layer;
[0121] S250, input the vector mapping sequence output by the global average pooling layer into the first DropOut layer to obtain the output of the encoder; wherein, the DropOut probability of the first DropOut layer is 0.5;
[0122] Exemplarily, since 64 convolution kernels are used in the first convolutional layer in the above steps, the features input to the encoder have 64 feature maps; Figure 8 A schematic structural diagram of an encoder in a sleep state detection method based on an EEG acquisition head ring provided in Embodiment 2 of the present invention, as shown in Figure 8 shown, the encoders in the EEG staged attention mechanism model include:
[0123] The second convolution layer, the number of convolution kernels in the second convolution layer is 128, the size of the convolution kernel is 1*1, and the stride is 2.
[0124] The third convolution layer, the number of convolution kernels is 64, the size of the convolution kernel is 3*1, and the stride is 1.
[0125] The fourth convolutional layer is introduced in order to obtain the percentage of signals in different frequency bands in an epoch. The number of convolution kernels in the fourth convolutional layer is 128, the size of the convolution kernel is 1*1, and the stride is 1.
[0126] A shortcut connection of the residual network, because the input of the second convolutional layer is 64 dimensions, and the output of the fourth convolutional layer is 128 dimensions. In order to perform dimension matching, an average pooling layer of size 2 is used in the shortcut connection. , with a step size of 2, converts a 64-dimensional input into a 128-dimensional output.
[0127] The output of the fourth convolutional layer and the output of the average pooling layer are summed, and then through the RELU function, the output of the first residual block is obtained.
[0128]The fifth convolution layer, the number of convolution kernels in the fifth convolution layer is 128, the size of the convolution kernel is 1*1, and the stride is 2.
[0129] The sixth convolution layer, the number of convolution kernels is 64, the size of the convolution kernel is 3*1, and the stride is 1.
[0130] The seventh convolution layer, the number of convolution kernels in the seventh convolution layer is 128, the size of the convolution kernel is 1*1, and the stride is 1.
[0131] The shortcut connection of the residual network, because the input and output signal dimensions of the second residual block are both 128, so the direct connection is used.
[0132] The output of the seventh convolutional layer and the direct connection are summed, and then through the RELU function, the output of the second residual block is obtained.
[0133] The output of the second residual block is fed into a global average pooling layer to obtain a vector map. Since the output of the second residual block is 128-dimensional data, 128 data are obtained after the global average pooling layer.
[0134] In the first DropOut layer, the DropOut probability is 0.5. For each neural network unit, it is temporarily discarded from the network according to a certain probability to alleviate the degree of overfitting.
[0135] The 30s EEG epoch is encoded by using the connection of the two residual blocks followed by a global average pooling layer as the encoder. Compared with the traditional method, this network structure overcomes the disadvantage that the network model is highly dependent on hyperparameter tuning. After changing a tester, the model needs to be retrained and parameters adjusted, otherwise good results cannot be obtained, and our network structure It can be adapted to different testers without re-training and adjusting parameters. After training the model on the data of one tester, replacing the data of other testers can also achieve good results. Just like this, the sleep state detection system based on the portable EEG acquisition headband does not require the user to perform a training process first during use.
[0136] S260. Use the decoder based on the multi-head attention mechanism in the EEG staged attention mechanism model to decode the vector map sequence; the decoder includes a multi-head attention sub-module connected in sequence, a first fully connected layer, and a second full connection layer;
[0137] S270. Obtain the sleep stage staging result output by the EEG staging attention mechanism model.
[0138] In this embodiment, by adding a first DropOut layer after the global average pooling layer, each neural network unit can be temporarily dropped from the network according to a certain probability, so as to alleviate the degree of overfitting and improve signal processing. efficiency.

Example Embodiment

[0139] Embodiment 3
[0140] Figure 9 This is a schematic flowchart of a sleep state detection method based on an EEG acquisition headband provided in Embodiment 3 of the present invention; this embodiment is optimized on the basis of the above-mentioned embodiment. In this embodiment, the output of the encoder is encoded with the position After the PE is summed and normalized, and then input to the multi-head attention mechanism sub-module of the decoder, the following steps are added: Input the output of the multi-head attention mechanism sub-module to the third DropOut layer, and the DropOut probability of the third DropOut layer is 0.8 , the output of the multi-head attention mechanism sub-module is normalized through the processing of the third DropOut layer; among them, the number of heads in the multi-head attention mechanism sub-module is 8, the size of each head is 64 dimensions, and the attention mechanism is in each The heads are executed in parallel; the attention mechanism function is expressed as:
[0141]
[0142] Where X is the matrix composed of the input sequence, dim represents the data dimension; the expression in Corresponding to the scale layer in the multi-head attention mechanism sub-module; input the output of the third DropOut layer into the first fully connected layer, and then activate the result through the RELU function; input the output of the first fully connected layer into the second fully connected layer. Connection layer, the output result of the second fully connected layer is the output of the decoder; wherein, the normalized output of the multi-head attention mechanism is added to the output of the first fully connected layer and the second fully connected layer through skip connections.
[0143] Correspondingly, the sleep state detection method based on the EEG acquisition headband provided by this embodiment specifically includes:
[0144] S301. Obtain the EEG signals of the FP1 electrode and the FP2 electrode in the 10-20 international standard lead system;
[0145] S302, processing the EEG signal to obtain an EEG epoch signal of 30s;
[0146] S303, input the EEG epoch signal of the 30s into the EEG staged attention mechanism model that has been trained, and obtain the approximate Hilbert change of the EEG epoch signal of the 30s, that is, the EEG signal epoch;
[0147] S304. Use the encoder in the EEG staged attention mechanism model to encode the EEG signal epoch to obtain a vector mapping sequence; the encoder includes a first residual block, a second residual block, and a global average pool that are sequentially connected chemical layer;
[0148] S305. After summing and normalizing the output of the encoder and the position encoding PE, it is input to the multi-head attention mechanism sub-module of the decoder; the calculation method of the position encoding PE is as follows:
[0149]
[0150]
[0151] where p represents the position of the current EEG signal epoch in the input EEG signal epoch queue; d represents the number of EEG signal epochs contained in the input queue input to the multi-head attention mechanism sub-module; dim represents the global average pooling layer The number of output data.
[0152] Exemplarily, d is 30, indicating that the input queue input to the multi-head attention mechanism contains 30 EEG signal epochs, and dim is 128, which is the number of data output by the above global average pooling layer, and the location mapping of each epoch can be found in It is directly calculated by the above equation without training, which speeds up training and helps the algorithm learn transition rules from both directions.
[0153] S306, input the output of the multi-head attention mechanism sub-module to the third DropOut layer, the DropOut probability of the third DropOut layer is 0.8, and normalize the output of the multi-head attention mechanism sub-module through the processing of the third DropOut layer; The number of heads in the force mechanism sub-module is 8, the size of each head is 64 dimensions, and the attention mechanism is executed in parallel in each head; the attention mechanism function is expressed as:
[0154]
[0155] Where X is the matrix composed of the input sequence, dim represents the data dimension; the expression in Corresponds to the scale layer in the multi-head attention mechanism sub-module; then the output of each head in the multi-head attention mechanism sub-module is connected and then the fully connected layer is used to project the cascaded result from a higher dimension (8×64=512) to the same dimension 128 of the vector map of the original input to the decoder.
[0156] S307, after inputting the output of the third DropOut layer into the first fully connected layer, activate the result through the RELU function; wherein, the first fully connected layer is a complete connection layer composed of 2048 neurons;
[0157] S308. Input the output of the first fully-connected layer into the second fully-connected layer, and the output result of the second fully-connected layer is the output of the decoder; wherein, the second fully-connected layer can project the activation result back to 128 dimensions; The normalized output of the attention mechanism is added to the output of the first fully connected layer and the second fully connected layer through skip connections;
[0158] S309, after the input and output of the decoder are summed and normalized by using the residual connection, the second DropOut layer is input; wherein, the DropOut probability of the second DropOut layer is 0.5. For each neural network unit, according to a certain probability, It is temporarily dropped from the network to alleviate overfitting; among them, by concatenating the encoder output with the output residual of the previous step, it is possible to improve performance and avoid the problem of vanishing gradients during backpropagation.
[0159] S310, input the output of the second DropOut layer into the SoftMax layer, and the SoftMax layer outputs the sleep stage staging result;
[0160] S311 , obtaining the sleep stage staging result output by the EEG staging attention mechanism model.
[0161] Figure 10 A schematic structural diagram of a decoder in a sleep state detection method based on an EEG acquisition head ring provided in Embodiment 3 of the present invention, as shown in Figure 10 As shown, the above decoder includes a multi-head attention mechanism sub-module, a third DropOut layer, a first fully connected layer, a second fully connected layer, a second DropOut layer, and a SoftMax layer, which are connected in sequence.
[0162] In this embodiment, by introducing a multi-head attention mechanism, parallel computation can be performed while cross-time analysis can be performed, and the training process can be shortened, so as to improve the detection efficiency of the user's sleep state.
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

no PUM

Description & Claims & Application Information

We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Similar technology patents

Molten pool plasma radiation spectrum acquisition mechanism and laser welding device

ActiveCN106289519AAccurate collectionReliable data supportRadiation pyrometryLaser beam welding apparatusPlasma radiationLaser assisted
Owner:HUAZHONG UNIV OF SCI & TECH

Classification and recommendation of technical efficacy words

  • Accurate collection
  • Accurate identification
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products