Method and system for removing electroencephalogram artifacts based on deep learning and decision denoising

By building a deep learning model, combining segmentation networks, short-term and long-term denoising networks, and using position coding and attention mechanisms to process EEG artifacts, the problem of time-varying overlap of long-term and short-term artifacts in the existing technology is solved, and efficient EEG signal denoising performance.

CN118535858AActive Publication Date: 2024-08-23GUANGZHOU UNIVERSITY

Patent Information

Application Number
CN202410658818.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2024-08-23
Estimated Expiration
2044-05-27

AI Technical Summary

Technical Problem

Existing EEG artifact removal methods are difficult to effectively handle the time-varying overlap of long- and short-term distribution artifacts, resulting in increased difficulty in model training and distortion removal, and existing deep learning methods do not fully consider the temporal distribution and waveform diversity of artifact signals. .

Method used

Using deep learning-based methods, we build an EEG artifact removal model that includes segmentation network, short-term denoising network and long-term denoising network. We use position coding and attention mechanisms to remove short-term and long-term artifacts, and combine LSTM and weight initialization convolution. Technologies such as layer and TCN capture temporal features and local complex features.

Benefits of technology

It achieves efficient removal of mixing artifacts and improves denoising performance. The correlation coefficient and signal-to-noise ratio reach 90.88% and 9.9008%, which significantly improves the model's denoising ability and feature representation ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535858A
    Figure CN118535858A
Patent Text Reader

Abstract

The invention discloses an electroencephalogram artifact removal method and system based on deep learning and decision denoising, and the method comprises the steps: generating polluted electroencephalogram signals containing long-term artifacts and short-term artifacts, and constructing a semi-simulation data set; constructing an electroencephalogram artifact removal network model, wherein the electroencephalogram artifact removal network model comprises a segmentation network, a short-term denoising network and a long-term denoising network; adding a position code tag of a noise artifact to the polluted electroencephalogram signal, and inputting the position code tag and the polluted electroencephalogram signal into a segmentation network for pre-training to obtain a position code corresponding to the electroencephalogram signal interfered by the long-term artifact and the short-term artifact; training an electroencephalogram artifact removal network model based on the semi-simulation data set; and inputting the test set of the polluted electroencephalogram signals into the trained electroencephalogram artifact removal network model, and outputting de-noised signals. According to the method, the short-term de-noising network and the long-term de-noising network are guided to remove short-term distributed artifacts and long-term distributed artifacts by judging position codes of the segmentation network, so that efficient removal of mixed artifacts is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of signal processing technology, and in particular to a method and system for removing electroencephalogram artifacts based on deep learning and decision denoising. Background Art

[0002] As a widely used neuroimaging technology, EEG plays an important role in research fields such as brain-computer interface and mental health assessment. Although it is relatively easy to collect EEG data, it is challenging to use it in practical applications. The presence of artifacts makes data analysis difficult. Various types of artifacts can introduce noise into EEG signals, such as electrooculogram (EOG), electrocardiogram (ECG), electromyogram (EMG), etc., which results in a low signal-to-noise ratio of EEG and limits its further research and development. Therefore, studying effective methods to remove artifacts from EEG sequences has become one of the important topics of current research.

[0003] Currently, commonly used methods for artifact removal include traditional methods and methods based on deep learning. Traditional methods are usually based on signal processing technology and mathematical models, including filters, independent component analysis (ICA), etc. The filter method can adjust the filter parameters according to the dynamic characteristics of the signal to achieve artifact removal. The disadvantage is that the optimal parameter value of the filter is difficult to determine. Too large or too small parameter values ​​may cause the filter to be unstable or the adaptive process to be slow. ICA is a commonly used blind source separation technology. It can decompose a mixed signal into multiple independent components and reconstruct a clean EEG signal by removing the components corresponding to the artifact signal. The disadvantage is that ICA is limited to sufficient data volume and number of channels, and the signal decomposed by ICA requires professionals to further explain its source.

[0004] In contrast, deep learning-based artifact removal methods have higher potential and flexibility, and can better adapt to different types of artifacts. However, the existing structural design does not fully consider the randomness of the temporal distribution of artifact signals and the diversity of waveforms, ignoring the time-varying overlap of EMG artifacts with EEG in long-term distribution and the mutual interference between long-term and short-term artifacts. Most network structures directly process samples interfered by mixed artifacts, which increases the difficulty of model training and leads to certain distortions in the removal of long-term and short-term distribution artifacts. Summary of the invention

[0005] In order to overcome the defects and shortcomings of the prior art, the present invention provides a method and system for removing EEG artifacts based on deep learning and decision denoising. The present invention guides the short-term denoising network and the long-term denoising network to remove short-term distributed artifacts and long-term distributed artifacts through the decision of the position encoding obtained by the segmentation network, thereby achieving efficient removal of mixed artifacts.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] The present invention provides a method for removing electroencephalogram artifacts based on deep learning and decision denoising, comprising the following steps:

[0008] Generate contaminated EEG signals containing long-term artifacts and short-term artifacts to construct a semi-simulated data set;

[0009] Constructing an EEG artifact removal network model, wherein the EEG artifact removal network model includes a segmentation network, a short-term denoising network and a long-term denoising network;

[0010] The position coding label of the noise artifact is added to the polluted EEG signal, and the label is input into the segmentation network for pre-training with the polluted EEG signal to obtain the position coding corresponding to the EEG signal disturbed by the long-term artifact and the short-term artifact;

[0011] The short-term denoising network includes an LSTM layer, a weight-initialized convolution layer and a TCN layer. The EEG signal disturbed by the short-term artifact is input into the LSTM layer to extract the state characteristics of the EEG signal. The state characteristics of the EEG signal are input into the weight-initialized convolution layer. A one-dimensional convolution operation is performed on the state characteristics of the EEG signal based on the new weight parameters generated by the weight-initialized convolution layer, and a local time series feature is output. The TCN layer captures the characteristics of the short-term artifact according to the local time series feature and smoothes the short-term artifact.

[0012] The long-term denoising network includes an auxiliary network and a generating network. The EEG signal disturbed by long-term artifacts is input into the auxiliary network to obtain a preliminary denoised EEG signal as condition information of the generating network. The generating network generates EEG signal data matching the condition information based on the attention mechanism, and outputs the reconstructed EEG signal after aggregation with the time feature.

[0013] Train the EEG artifact removal network model based on a semi-simulated dataset;

[0014] The test set of contaminated EEG signals is input into the trained EEG artifact removal network model to output the denoised signal.

[0015] As a preferred technical solution, a semi-simulated data set is constructed, and the specific steps include:

[0016] Obtain clean EEG signals, short-term distributed EOG signals in the time domain, and randomly distributed EMG signals;

[0017] Based on the wavelet transform to process ECG signals, all signals are standardized and the EOG, EMG and ECG signals are introduced into the clean EEG signals as artifacts to synthesize the contaminated EEG signals, which can be expressed as:

[0018] X N=S+λN

[0019] Among them, X N is the synthesized contaminated EEG signal, S is the clean EEG signal, N is the artifact noise, and λ is the weight coefficient;

[0020] The signal-to-noise ratio is calculated and the weight coefficient is set based on the signal-to-noise ratio to control the degree of contamination of the clean EEG signal by the artifact noise. The calculation formula of the signal-to-noise ratio is expressed as:

[0021]

[0022] Among them, s i is the amplitude of the clean EEG signal, n i is the amplitude of the artifact noise.

[0023] As a preferred technical solution, the segmentation network adopts a one-dimensional residual U-type network, including an encoder, a skip connection and a decoder;

[0024] In the encoder, a one-dimensional convolutional layer is used to extract features from the contaminated EEG signal to obtain a convolutional feature map. A maximum pooling operation is performed on each convolutional feature map. By stacking convolutional layers and pooling layers, a feature map of high-dimensional features is obtained.

[0025] Every time the encoder undergoes a pooling operation, the convolutional feature map of the current layer is saved and passed to the decoder through a skip connection;

[0026] The decoder performs deconvolution on the convolution feature map. At the same time, in each layer of the decoder, the feature map of the same layer as the encoder is merged through jump connections. The merged feature map is input into the convolution layer of the decoder, and a one-dimensional convolution operation is performed with the features extracted by the original encoder. The outputs of the same layer of the encoder and decoder are added through residual connections.

[0027] As a preferred technical solution, the short-term denoising network includes an LSTM layer, a weight-initialized convolutional layer and a TCN layer. The specific processing process includes:

[0028] The EEG signal affected by short-term artifacts is input into the LSTM layer to extract the state features of the EEG signal, and the hidden state and unit state of the LSTM layer are initialized to zero vectors. For each time step of the EEG signal affected by short-term artifacts, the LSTM layer receives the current input and the hidden state of the previous moment as input, and outputs the hidden state and unit state of the current moment. The hidden state is used as the state feature of the EEG signal extracted by the LSTM layer, including long-term dependencies and contextual information, and the feature space output by the LSTM layer is mapped to the same dimensional space as the weight-initialized convolutional layer through the linear connection layer.

[0029] As a preferred technical solution, the new weight parameters generated by the weight-initialized convolutional layer are specifically expressed as:

[0030]

[0031] Among them, normalized ij represents the new weight parameter, mean represents the mean of the weight matrix, var represents the variance of the weight matrix, and w ij represents the i-th row and j-th column element in the weight matrix, and ∈ represents a constant.

[0032] As an optimal technical solution, the TCN layer includes a residual module, a connection layer and a rectified linear unit. The residual module includes multiple groups of residual layers, each residual layer is connected to the corresponding input stream and output stream, and a jump output method is adopted in the first and last residual layers. The middle residual layer includes an expanded convolution layer and a 1×1 convolution layer. The expanded convolution layer captures the characteristics of short-term artifacts according to the local temporal characteristics of the output of the weight-initialized convolution layer, inserts a hole in the middle of the convolution kernel to increase the receptive field of the convolution kernel, and smoothes the short-term artifacts. The 1×1 convolution layer performs a dimensionality reduction operation and regularizes the output. The features of different layers are integrated through the connection layer and the high-dimensional features are mapped to the low-dimensional space. The rectified linear unit introduces nonlinear features, fits the data distribution of clean EEG signals, and outputs clean EEG signals.

[0033] As a preferred technical solution, the generation network generates EEG signal data matching the conditional information based on the attention mechanism, and aggregates and outputs the reconstructed EEG signal with the time feature, specifically including:

[0034] The generation network performs EEG reconstruction including forward diffusion and reverse denoising processes;

[0035] The generation network includes a residual layer, a conditional attention layer, a downsampling layer, a temporal embedding layer and an upsampling layer;

[0036] Generate time steps and Gaussian random noise, and perform a forward diffusion process to randomly generate Gaussian white noise at each time step and add it to the EEG signal to obtain a data sequence of T time steps;

[0037] Normalize the time step to get the time vector T en , the time vector T en Input into the time embedding layer for time embedding encoding, which is specifically expressed as:

[0038]

[0039] Where d represents half the dimension of the embedding vector, and i represents the dimension index of the embedding vector;

[0040] The reverse denoising process converts the T-th time step data X T Denoising restores the original sample X0, which is specifically expressed as:

[0041]

[0042] in, μ θ and Σ θ Respectively represent the mean and covariance matrix of the posterior distribution of the network parameter θ;

[0043] The EEG signal affected by long-term artifacts is extracted through the residual layer to extract high-dimensional feature representation, and then input into the conditional attention layer together with the conditional information. The attention mechanism is used to query and project the conditional information S to obtain Q s , project the key and value of the input feature to obtain K and V, calculate the attention weight, and the attention calculation formula is expressed as:

[0044]

[0045] Among them, softmax is the activation function, is the scaling factor;

[0046] The attention mechanism is used to filter out long-term artifacts that do not match the conditional information and generate EEG signal data that matches the conditional information.

[0047] After reducing the data dimension through the downsampling layer, it is aggregated with the time features obtained through the time embedding layer, and the data dimension is restored through the upsampling layer. The upsampled signal passes through the residual layer, and the low-dimensional feature representation of the input signal is retained through the residual connection. The reconstructed EEG signal is obtained by combining the extracted high-dimensional feature representation.

[0048] As a preferred technical solution, the forward diffusion process is expressed as:

[0049] α t =1-β t

[0050]

[0051]

[0052] Among them, β t represents the interpolation rate used in the t-th step of the noise addition process, β represents a hyperparameter, and X t Represents the original data X0 and random Gaussian white noise The linear combination of and Represents the corresponding combination coefficient.

[0053] As a preferred technical solution, the test set of contaminated EEG signals is input into the trained EEG artifact removal network model, and the mean square error (mse) is specifically used to optimize the parameters of the short-term denoising network, which is specifically expressed as:

[0054]

[0055] in, is the denoised EEG signal, l is the clean EEG signal corresponding to the short-term distribution artifact, and n is the number of samples;

[0056] The absolute value error L1_loss is used to optimize the parameters of the long-term denoising network, which is specifically expressed as:

[0057]

[0058] in, is the denoised EEG signal, and g is the clean EEG signal corresponding to the long-term distributed artifact.

[0059] The present invention also provides an EEG artifact removal system based on deep learning and decision denoising, comprising: a data generation module, an EEG artifact removal network model construction module, a pre-training module, an EEG artifact removal network model training module, and a denoising signal output module;

[0060] The data generation module is used to generate contaminated EEG signals containing long-term artifacts and short-term artifacts to construct a semi-simulated data set;

[0061] The EEG artifact removal network model construction module is used to construct an EEG artifact removal network model, and the EEG artifact removal network model includes a segmentation network, a short-term denoising network and a long-term denoising network;

[0062] The pre-training module is used to add the position coding label of the noise artifact to the contaminated EEG signal, and input it into the segmentation network for pre-training with the contaminated EEG signal to obtain the position coding corresponding to the EEG signal disturbed by the long-term artifact and the short-term artifact;

[0063] The short-term denoising network includes an LSTM layer, a weight-initialized convolution layer and a TCN layer. The EEG signal disturbed by the short-term artifact is input into the LSTM layer to extract the state characteristics of the EEG signal. The state characteristics of the EEG signal are input into the weight-initialized convolution layer. A one-dimensional convolution operation is performed on the state characteristics of the EEG signal based on the new weight parameters generated by the weight-initialized convolution layer, and a local time series feature is output. The TCN layer captures the characteristics of the short-term artifact according to the local time series feature and smoothes the short-term artifact.

[0064] The long-term denoising network includes an auxiliary network and a generating network. The EEG signal disturbed by long-term artifacts is input into the auxiliary network to obtain a preliminary denoised EEG signal as condition information of the generating network. The generating network generates EEG signal data matching the condition information based on the attention mechanism, and outputs the reconstructed EEG signal after aggregation with the time feature.

[0065] The EEG artifact removal network model training module is used to train the EEG artifact removal network model based on a semi-simulated data set;

[0066] The denoising signal output module is used to input the test set of contaminated EEG signals into the trained EEG artifact removal network model and output a denoising signal.

[0067] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0068] (1) The present invention constructs a novel EEG artifact removal method RLANET, which discriminates between long-term and short-term distributed artifacts, and separates long-term artifact samples that are prone to time-varying overlap from short-term artifact samples according to the sample position encoding obtained by the segmentation network output, thereby solving the technical problem that the time-varying overlap of long-term and short-term artifacts increases the difficulty of model training. Compared with the existing artifact removal methods, the method achieves the best denoising performance on a semi-simulated data set, with a correlation coefficient (CC) and signal-to-noise ratio (SNR) as high as 90.88% and 9.9008.

[0069] (2) The present invention adopts a technical solution of adding a self-attention module to the skip connection stage of the existing segmentation network ResUnet, which solves the technical problem that the simple skip connection in the ResUnet network is not sufficient to capture complex feature relationships. Compared with the original simple skip connection, the feature representation capability is enhanced, and a more accurate position coding prediction effect is achieved.

[0070] (3) The present invention proposes a short-term denoising network LWTCN for removing short-term distributed artifacts. By introducing weight initialization convolution technology to connect the two time series processing models LSTM and TCN, it can better capture long-term and short-term dependencies and local complex features, and combine them with the overall EEG features to remove short-term distributed artifacts.

[0071] (4) The present invention proposes a long-term denoising network ADDPM for removing long-term distributed artifacts, which is composed of an auxiliary network and a generation network. The auxiliary network is introduced into the existing generation network DDPM to guide the reconstruction of a specific EEG. By combining the conditional information obtained by the auxiliary network with the contaminated EEG samples, the long-term denoising network can better capture the potential representation of the EEG signal, reconstruct a clean EEG signal, and reduce the distortion caused by artifact removal. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] Figure 1 Schematic diagram of the implementation architecture of the method for removing EEG artifacts based on deep learning and decision denoising of the present invention;

[0073] Figure 2 (a) is a schematic diagram of the position encoding corresponding to the sample signal of the short-term distribution of the artifacts output by the segmentation network of the present invention;

[0074] Figure 2 (b) is a schematic diagram of position coding corresponding to the sample signal of the long-term distribution of artifacts output by the segmentation network of the present invention;

[0075] Figure 3 Schematic diagram of the network structure of the short-term denoising network (LWTCN) of the present invention;

[0076] Figure 4 Schematic diagram of the structure of the residual block in the TCN module of the present invention;

[0077] Figure 5 Schematic diagram of the network structure of the long-term denoising network (ADDPM) of the present invention;

[0078] Figure 6 (a) is a schematic diagram of the effect of the present invention on removing long-term distributed artifacts;

[0079] Figure 6 (b) is a schematic diagram of the effect of the present invention on removing short-term distributed artifacts;

[0080] Figure 7 This is a schematic diagram of the performance index comparison results between the present invention and other artifact removal methods. DETAILED DESCRIPTION

[0081] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0082] Example 1

[0083] like Figure 1 As shown, this embodiment provides a method for removing EEG artifacts based on deep learning and decision denoising, comprising the following steps:

[0084] S1: Construction of semi-simulated dataset;

[0085] In this embodiment, clean EEG signals, short-term distributed EOG in the time domain, and randomly distributed EMG are from the EEGDenoiseNet benchmark dataset. The short-term distributed and regular ECG comes from the MIT-BIH arrhythmia dataset, with a sampling rate of 360 Hz and a duration of 30 seconds for each time record. The above four signals are resampled to 256 Hz. Since ECG is very weak compared to other signals, it is easily interfered by various factors during the acquisition process. After processing with wavelet transform, a relatively pure ECG signal is obtained, and then all signals are standardized and synthesized. The contaminated EEG signal, in which EOG, EMG and ECG are introduced as artifacts into the clean EEG signal, is synthesized as follows:

[0086] X N =S+λN

[0087] Among them, X N is the synthesized contaminated EEG signal, S is the clean EEG signal, N is the artifact noise, and λ is the weight coefficient, which is calculated according to the signal-to-noise ratio formula and is used to control the degree of noise pollution on the clean EEG signal; at the same time, the value range of the signal-to-noise ratio (SNR) is set to -5dB—5dB, with an interval of 1dB. The definition formula of the signal-to-noise ratio is as follows:

[0088]

[0089] Among them, s i is the amplitude of the clean EEG signal, n i is the amplitude of the artifact noise, and λ is the weight coefficient.

[0090] According to the above formula, mixed EEG data with different signal-to-noise ratio levels can be generated. The number of sampling points of the synthetic contaminated EEG signal is 1280, the duration is 5s, it contains long-term artifacts and short-term artifacts, and there is aliasing between multiple artifacts. After the mixed data is subjected to 10-fold cross-validation, it is divided into training set (80%), test set (10%) and validation set (10%) to complete the construction of the semi-simulated data set.

[0091] S2: Construct an EEG artifact removal network model RLANET based on deep learning and decision denoising, which includes a segmentation network, a short-term denoising network and a long-term denoising network;

[0092] S21: Building a segmentation network;

[0093] In this embodiment, a one-dimensional residual U-type network (ResUNet1D) is used as the network structure of the segmentation network. ResUNet1D can fuse low-level features and high-level features, and use the residual learning and shortcut connection mechanism to obtain the artifact position encoding.

[0094] In this embodiment, the specific network architecture of the one-dimensional residual U-type network ResUNet1D is:

[0095] (1) Encoder part: For a contaminated EEG sample input sequence X = {x1, x2, ..., x N}, where N is the length of the sequence (N=1280), and a one-dimensional convolutional layer is used to extract features from the input sequence. The convolution operation slides the convolution kernel (kernel size is 3) on the input sequence to obtain a convolution feature map. A maximum pooling operation is performed on each convolution feature map (pooling window is 2). After each pooling operation, the output sequence length will be half of the input sequence length, reducing the spatial dimension of the feature map while retaining the most significant feature information. By stacking convolutional layers and pooling layers, the spatial dimension of the feature map gradually decreases, while the feature dimension increases, and finally a series of high-level abstract feature maps are obtained, representing different aspects and levels of abstraction in the input sequence.

[0096] (2) Skip connection: After each pooling operation, the encoder saves the feature map of the current layer and passes it directly to the decoder through the skip connection. These skip connections are spliced ​​with the feature map of the corresponding layer of the decoder after each upsampling operation of the decoder, providing fine-grained feature information and helping to restore the detailed information of the sequence. This embodiment integrates a self-attention module in the skip connection. After each upsampling, the self-attention module is applied to process the features of the skip connection. The utilization of the features of the encoder stage by the decoder stage is enhanced, so that the network can capture a wider range of contextual information during the upsampling process.

[0097] (3) Decoder part: The decoder first uses a deconvolution operation on the feature map extracted from the encoder to enlarge the size of the feature map and gradually restore it to the size of the original input (length 1280); at the same time, in each layer of the decoder, the feature map of the same layer as the encoder is merged through a skip connection. The skip connection will fuse the high-resolution features in the encoder with the features in the decoder, thereby providing richer information to restore the lost details. The merged feature map is input into the convolution layer of the decoder and performs a 1D convolution operation (kernel size 3) together with the original encoder features. The purpose of this step is to fuse the features extracted from the encoder and decoder and reconstruct the feature representation of the original input through a convolution operation. In addition, the outputs of the same layer of the encoder and decoder are directly added together through a residual connection to retain more original information.

[0098] In this embodiment, since the distribution characteristics of EOG and ECG are both short-term distributions, and the distribution characteristics of EMG are random, the role of the segmentation network is mainly to obtain the position code of the sample affected by long-term electromyographic artifacts. For the position code, 1 represents artifact interference, and 0 represents the opposite. Then, its distribution characteristics are further judged. If the position code value is all 1, it is a sample affected by long-term electromyographic artifacts, so that the distribution characteristics of the sample are long-term distribution, so as to determine the distribution characteristics of the sample signal.

[0099] like Figure 2 (a) and Figure 2 As shown in (b), the output results of the segmentation network are obtained, which are the sample signals of the short-term distribution of the artifacts and the sample signals of the long-term distribution of the artifacts and the corresponding position codes. Before constructing the semi-simulated data, this embodiment manually marks the position codes of the noise artifacts (EOG, EMG and ECG), and uses these manually marked position codes as the position code labels of the synthetic contaminated EEG samples. These labels and their corresponding contaminated EEG sequences are input into the segmentation network for training, and the network learns to extract the position codes corresponding to the artifacts from the contaminated EEG samples. Finally, for a contaminated EEG sample sequence, the segmentation network will obtain the position codes corresponding to the artifacts. The obtained position codes are discriminated, and samples with position code values ​​of all 1 are input into the long-term denoising network for denoising, and samples with other position code values ​​are input into the short-term denoising network for denoising.

[0100] S22: Construct a short-term denoising network;

[0101] In this embodiment, the short-term denoising network LWTCN includes three parts: LSTM block, weight initialization convolution layer (WS Conv) and TCN block. By introducing WS Conv, LSTM and TCN are better combined together. Figure 3 As shown in the figure, LWTCN combines the advantages of both LSTM and TCN time series processing models. While maintaining long-term memory capabilities, it can learn local complex features and short-term dynamic changes through TCN, which is conducive to the efficient removal of local artifacts.

[0102] In this example, the specific network architecture of LWTCN is:

[0103] (1) LSTM and connection layer: LSTM and connection layer are used to preprocess EEG noise signals and learn important EEG features. The input sequence of the LSTM layer is a sample sequence interfered by short-term artifacts. At the beginning of the sequence, the hidden state h0 and cell state C0 of the LSTM are initialized to zero vectors. For each time step t in the input sequences , LSTM receives the current input x t and the hidden state h at the previous moment t-1 As input, and output the hidden state h at the current moment t and cell status C t In this embodiment, the dimension of the hidden state is set to 50, and the hidden state h is used t As the features extracted by LSTM, they contain the long-term dependencies of the sequence and context information. Finally, through a linear connection layer (FC), the feature space output by LSTM is mapped to the same dimensional space as the WS Conv layer, reducing the computational complexity and improving the performance and generalization ability of the model.

[0104] (2) WS Conv layer: The weight standardization technology (WS) is introduced. Compared with WN and BN, WS only needs to standardize the weights of the convolution kernel, without additional calculation steps and additional learnable parameters. Moreover, WS is not affected by the batch size and has better convergence and stability, avoiding problems such as gradient disappearance or gradient explosion, thereby making the model loss smoother. The state features output by LSTM are input into the Ws Conv layer. Before weighting, the weight matrix of the input convolution kernel is obtained, the mean and variance var of the weight matrix are calculated, and then the weight matrix is ​​standardized. The standardization formula is as follows:

[0105]

[0106] Among them, w ij represents the i-th row and j-th column element in the weight matrix, ∈ is a small constant (usually added for numerical stability to prevent the denominator from being zero), which is normalized ij The input state features are used as new weight parameters for one-dimensional convolution operations, and the local time series features are output by combining long-term and short-term information. These features are then input into the TCN layer together.

[0107] (3)TCN layer: Figure 3 As shown in , TCN includes a residual module, a connection layer and a rectified linear unit, where the residual module contains three groups of residual layers. Figure 4As shown in the figure, in the structure of the residual layer, each residual layer is connected to the corresponding input stream and output stream. The first and last residual layers use a jump output method to retain the appropriate gradient flow. The middle residual layer mainly includes two parts: the dilated convolution layer and the 1×1 convolution layer. The dilated convolution layer (dilation factor d=2, convolution kernel 1×3) captures the characteristics of local artifacts according to the representative features and context information output by the WS Conv layer. The 1×1 convolution layer performs dimensionality reduction operations to improve the computational efficiency and speed of the model. At the same time, its output is regularized by WN and Dropout (p=0.1), and then the features of different layers are integrated through the connection layer and the high-dimensional features are mapped to the low-dimensional space, reducing the computational complexity while enhancing the feature expression ability. Finally, the nonlinear features are introduced by the modified linear unit to better fit the data distribution of the clean EEG signal after artifact removal, output the clean EEG signal, and achieve the removal of short-term artifacts.

[0108] S23: Building a long-term denoising network;

[0109] In this embodiment, the long-term denoising network ADDPM is used to remove long-term distributed artifacts, such as Figure 5 As shown, it is mainly composed of two parts: auxiliary network and generation network, which can reconstruct the EEG of sample signals to remove noise signals and distorted signals;

[0110] In this embodiment, the specific network architecture of ADDPM is:

[0111] (1) Auxiliary network: It adopts the same structure as the short-term denoising network (LWTCN). Its role is to guide the generative model to further reconstruct the denoised EEG. Although the separation of different samples by discriminative position coding can greatly reduce the mutual aliasing between artifacts and achieve efficient removal of short-term artifacts, the long-term distributed electromyographic artifacts overlap with the time-varying EEG, making it difficult for the short-term denoising network (LWTCN) to remove artifacts by combining the overall characteristics of the EEG signal, which may cause distortion of some EEG signals. Therefore, the noise signal with long-term distribution of artifacts is output through the auxiliary network to generate the conditional information required by the conditional attention layer in the network, that is, the sample signal for preliminary denoising by LWTCN, which achieves the reconstruction of specific EEG signals at the expense of the diversity of DDPM generation.

[0112] (2) Generating network: Based on the original structure of DDPM, the generating network reduces the number of sampling layers and only retains one upsampling layer and one downsampling layer, thereby reducing the inference time of the model. Figure 5As shown, its main structure includes a residual layer, a conditional attention layer, a downsampling layer, a time embedding layer and an upsampling layer. The generation network of this embodiment performs EEG reconstruction in two steps: forward diffusion and reverse denoising.

[0113] First, generate time step t s ~Uniform(0,n T ) and Gaussian random noise And carry out the forward diffusion process, that is, randomly generate Gaussian white noise at each time step and add it to the EEG sample, finally obtaining a data sequence of T time steps (X1, X2, ..., X T ), the expression of the forward diffusion process is as follows:

[0114] α t =1-β t

[0115]

[0116]

[0117] Among them, β t It refers to the interpolation rate used in the t-th step of the noise addition process, which is generated according to the cosine time table and changes with time. The value of the hyperparameter β is (8e -5 , 8e -1 ). t It can be seen as a linear combination of the original data X0 and random Gaussian white noise noise. and is its combination coefficient.

[0118] Each time step represents a time point in the data sequence, and as t increases, the data sample X t is getting closer and closer to Gaussian noise. s After normalization, we get T en , which represents the position of the current time step relative to the entire time series, and converts the 128-dimensional time vector T en The input is sent to the time embedding layer for time embedding encoding, which facilitates learning the relevant features of different time points. The specific encoding formula is as follows:

[0119]

[0120] Where d is half the dimension of the embedding vector, and i is the dimension index of the embedding vector. The reverse denoising process is to transform the T-th time step data X T Gradually denoise and restore to the original sample X0. The specific calculation process is as follows:

[0121]

[0122] in, μ θ and Σ θ Predicted by the Unet network, it represents the mean and covariance matrix of the posterior distribution of the network parameters θ.

[0123] For the prediction process of the Unet network, the EEG signal D1 affected by long-term artifacts is first extracted through the residual layer Resnet to extract high-dimensional feature representation, which includes a weighted normalized convolution layer (kernel size is 3), a normalization layer, and a parameterized rectified linear unit. The obtained features are input into the conditional attention layer together with the conditional information obtained by the auxiliary network. The attention mechanism is used to query and project the conditional information S to obtain Q s , project the key and value of the input feature to obtain K and V, and further calculate the attention weight. The attention formula is as follows:

[0124]

[0125] Among them, softmax is the activation function, The attention mechanism is used as the scaling factor to capture the key EEG features in the signal, filter out most of the long-term artifacts that do not match the conditional information, and help the model generate EEG signal data that matches the conditional information; at the same time, after reducing the data dimension through the downsampling layer (the data length is reduced by 2 times), it is aggregated with the time features obtained through the time embedding layer. By adding the time embedding layer, the network can capture the time-dependent characteristics and long-term distribution pattern of the signal, thereby further removing the remaining long-term distribution artifacts while reconstructing the distorted signal after denoising, and then restore the data dimension through the upsampling layer. Finally, the upsampled signal is further processed and refined through Resnet (kernel size is 3), and the low-level features of the input signal are retained through residual connections. At the same time, combined with the extracted high-level features, the detailed reconstruction of the EEG signal is realized, and finally the reconstructed EEG signal is output to achieve the removal of long-term distribution artifacts.

[0126] Step 4: Network pre-training and overall training;

[0127] In this embodiment, two loss functions are used to train the model, and the mean square error mse is used to optimize the parameters of the short-term denoising network (LWTCN), and the formula is as follows:

[0128]

[0129] in, is the denoised EEG signal, l is the clean EEG signal corresponding to the short-term distribution artifact, and n is the number of samples. For the long-term denoising network (ADDPM), the absolute value error L1_loss is used to optimize the parameters of the generative model, and the formula is as follows:

[0130]

[0131] in, is the denoised EEG signal, and g is the clean EEG signal corresponding to the long-term distributed artifact.

[0132] In this embodiment, the training process is divided into pre-training and overall training. For the pre-training process, the training model includes a segmentation network and an auxiliary network in the long-term denoising network. First, the segmentation network model ResUnet is trained, in which the trained position labels are manually marked, and then the position encoding is obtained by using the pre-trained segmentation network, and then further discrimination processing is performed to distinguish the semi-simulated data set samples into long-term artifact samples and short-term artifact samples. Finally, the long-term artifact samples are used alone for pre-training of the auxiliary network to complete the pre-training process. For the overall training process, the parameters of the segmentation network and the auxiliary network pre-training model are first obtained, and then the samples of the semi-simulated data set are input to complete the overall training of the EEG artifact removal network RLANET on the Pytorch deep learning framework.

[0133] In this embodiment, the contaminated EEG data test set is input into the trained RLANET network model, and the denoised signal is finally output. The contaminated EEG signal (input sample), the clean EEG signal (sample label) and the model denoised signal are visually compared, as shown in Figure 2. Figure 6 (a) Figure 6 (b), where Figure 6 (a) is the artifact removal result of the long-term denoising network. Figure 6 (b) is the artifact removal result of the short-term denoising network.

[0134] For the visualization results of short-term artifact removal, it can be clearly seen that the EMG artifacts are mainly distributed in the time periods of 1s-1.5s and 4s-5s, and they have local time-varying overlaps. The EGO artifacts are mainly distributed in the time period of 1.5s-3s, while the ECG artifacts are regularly distributed in the entire time period. RLANET can well restore clean EEG signals in time periods seriously disturbed by artifacts by capturing the local features of samples and long-term and short-term dependencies.

[0135] For the visualization results of long-term artifacts, it can be clearly seen that the time-varying overlap of EMG artifacts and EEG occurs in almost the entire time period, the aliasing of EO artifacts and EMG artifacts occurs in the time period of 0.5s-1.5s, and the aliasing of ECG artifacts and EMG artifacts also occurs in the time period where the ECG artifacts are located. It is not difficult to find that although the denoised signal reconstructed by the long-term denoising network will have slight Gaussian white noise, it can restore the clean EEG signal well at the artifact aliasing while solving the interference of the time-varying overlap of EMG artifacts and EEG.

[0136] In this embodiment, if Figure 7 As shown in the figure, the performance indicators of different artifact removal methods tested on a semi-simulated dataset are given, including traditional EEG denoising methods EEMD-ICA and EEMD-CCA, which can remove artifacts according to different time scales and frequency components, as well as deep learning-based EEG denoising methods SCNN, EEGDNET and RU-RNN. Figure 7 It can be found that compared with other artifact removal methods, the model constructed in this embodiment achieves the best denoising performance on the semi-simulated data set and can better restore the clean EEG signals in the contaminated EEG samples.

[0137] Example 2

[0138] This embodiment provides an EEG artifact removal system based on deep learning and decision denoising, which is used to implement the EEG artifact removal method based on deep learning and decision denoising of the above-mentioned embodiment 1, and the system includes: a data generation module, an EEG artifact removal network model construction module, a pre-training module, an EEG artifact removal network model training module, and a denoising signal output module;

[0139] In this embodiment, the data generation module is used to generate contaminated EEG signals containing long-term artifacts and short-term artifacts to construct a semi-simulated data set;

[0140] In this embodiment, the EEG artifact removal network model construction module is used to construct an EEG artifact removal network model, and the EEG artifact removal network model includes a segmentation network, a short-term denoising network and a long-term denoising network;

[0141] In this embodiment, the pre-training module is used to add the position coding label of the noise artifact to the contaminated EEG signal, and input the contaminated EEG signal into the segmentation network for pre-training to obtain the position coding corresponding to the EEG signal disturbed by the long-term artifact and the short-term artifact;

[0142] In this embodiment, the short-term denoising network includes an LSTM layer, a weight-initialized convolution layer and a TCN layer. The EEG signal disturbed by the short-term artifact is input into the LSTM layer to extract the state characteristics of the EEG signal, and the state characteristics of the EEG signal are input into the weight-initialized convolution layer. A one-dimensional convolution operation is performed on the state characteristics of the EEG signal based on the new weight parameters generated by the weight-initialized convolution layer, and a local time series feature is output. The TCN layer captures the characteristics of the short-term artifact according to the local time series feature and smoothes the short-term artifact.

[0143] In this embodiment, the long-term denoising network includes an auxiliary network and a generating network. The EEG signal disturbed by long-term artifacts is input into the auxiliary network to obtain a preliminary denoised EEG signal as condition information of the generating network. The generating network generates EEG signal data matching the condition information based on the attention mechanism, and aggregates the output with the time feature to reconstruct the EEG signal.

[0144] In this embodiment, the EEG artifact removal network model training module is used to train the EEG artifact removal network model based on the semi-simulated data set;

[0145] In this embodiment, the denoised signal output module is used to input the test set of contaminated EEG signals into the trained EEG artifact removal network model and output the denoised signal.

[0146] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.

Claims

1. A method for removing EEG artifacts based on deep learning and decision denoising, characterized in that: The steps include: Generate contaminated EEG signals containing long-term artifacts and short-term artifacts to construct a semi-simulated data set; Constructing an EEG artifact removal network model, wherein the EEG artifact removal network model includes a segmentation network, a short-term denoising network and a long-term denoising network; The position coding label of the noise artifact is added to the polluted EEG signal, and the label is input into the segmentation network for pre-training with the polluted EEG signal to obtain the position coding corresponding to the EEG signal disturbed by the long-term artifact and the short-term artifact; The short-term denoising network includes an LSTM layer, a weight-initialized convolution layer and a TCN layer. The EEG signal disturbed by the short-term artifact is input into the LSTM layer to extract the state characteristics of the EEG signal, and the state characteristics of the EEG signal are input into the weight-initialized convolution layer. A one-dimensional convolution operation is performed on the state characteristics of the EEG signal based on the new weight parameters generated by the weight-initialized convolution layer, and a local time series feature is output. The TCN layer captures the characteristics of the short-term artifact according to the local time series feature and smoothes the short-term artifact. The long-term denoising network includes an auxiliary network and a generating network. The EEG signal disturbed by long-term artifacts is input into the auxiliary network to obtain a preliminary denoised EEG signal as condition information of the generating network. The generating network generates EEG signal data matching the condition information based on the attention mechanism, and outputs the reconstructed EEG signal after aggregation with the time feature. Train the EEG artifact removal network model based on a semi-simulated dataset; The test set of contaminated EEG signals is input into the trained EEG artifact removal network model to output the denoised signal.

2. The method for removing EEG artifacts based on deep learning and decision denoising according to claim 1, characterized in that: Construct a semi-simulated data set. The specific steps include: Obtain clean EEG signals, short-term distributed EOG signals in the time domain, and randomly distributed EMG signals; Based on the wavelet transform to process ECG signals, all signals are standardized and the EOG, EMG and ECG signals are introduced into the clean EEG signals as artifacts to synthesize the contaminated EEG signals, which can be expressed as: X N =S+λN Among them, X N is the synthesized contaminated EEG signal, s is the clean EEG signal, N is the artifact noise, and λ is the weight coefficient; The signal-to-noise ratio is calculated and the weight coefficient is set based on the signal-to-noise ratio to control the degree of contamination of the clean EEG signal by the artifact noise. The calculation formula of the signal-to-noise ratio is expressed as: Among them, s i is the amplitude of the clean EEG signal, n i is the amplitude of the artifact noise.

3. The method for removing EEG artifacts based on deep learning and decision denoising according to claim 1, characterized in that: The segmentation network adopts a one-dimensional residual U-type network, including an encoder, a skip connection and a decoder; In the encoder, a one-dimensional convolutional layer is used to extract features from the contaminated EEG signal to obtain a convolutional feature map. A maximum pooling operation is performed on each convolutional feature map. By stacking convolutional layers and pooling layers, a feature map of high-dimensional features is obtained. Every time the encoder undergoes a pooling operation, the convolutional feature map of the current layer is saved and passed to the decoder through a skip connection; The decoder performs deconvolution on the convolution feature map. At the same time, in each layer of the decoder, the feature map of the same layer as the encoder is merged through jump connections. The merged feature map is input into the convolution layer of the decoder, and a one-dimensional convolution operation is performed with the features extracted by the original encoder. The outputs of the same layer of the encoder and decoder are added through residual connections.

4. The method for removing EEG artifacts based on deep learning and decision denoising according to claim 1, characterized in that: The short-term denoising network includes an LSTM layer, a weight-initialized convolutional layer, and a TCN layer. The specific processing process includes: The EEG signal affected by short-term artifacts is input into the LSTM layer to extract the state features of the EEG signal, and the hidden state and unit state of the LSTM layer are initialized to zero vectors. For each time step of the EEG signal affected by short-term artifacts, the LSTM layer receives the current input and the hidden state of the previous moment as input, and outputs the hidden state and unit state of the current moment. The hidden state is used as the state feature of the EEG signal extracted by the LSTM layer, including long-term dependencies and contextual information, and the feature space output by the LSTM layer is mapped to the same dimensional space as the weight-initialized convolutional layer through the linear connection layer.

5. The method for removing EEG artifacts based on deep learning and decision denoising according to claim 1, characterized in that: The new weight parameters generated by the weight-initialized convolutional layer are specifically expressed as: Among them, normalized ij represents the new weight parameter, mean represents the mean of the weight matrix, var represents the variance of the weight matrix, and w ij represents the i-th row and j-th column element in the weight matrix, and ∈ represents a constant.

6. The method for removing EEG artifacts based on deep learning and decision denoising according to claim 1, characterized in that: The TCN layer includes a residual module, a connection layer and a rectified linear unit. The residual module includes multiple groups of residual layers, each residual layer is connected to the corresponding input stream and output stream, and a jump output method is adopted in the first and last residual layers. The middle residual layer includes an expanded convolution layer and a 1×1 convolution layer. The expanded convolution layer captures the characteristics of short-term artifacts according to the local temporal characteristics of the output of the weight-initialized convolution layer, inserts a hole in the middle of the convolution kernel to increase the receptive field of the convolution kernel, and smoothes the short-term artifacts. The 1×1 convolution layer performs a dimensionality reduction operation and regularizes the output. The features of different layers are integrated through the connection layer and the high-dimensional features are mapped to the low-dimensional space. The rectified linear unit introduces nonlinear features, fits the data distribution of the clean EEG signal, and outputs a clean EEG signal.

7. The method for removing EEG artifacts based on deep learning and decision denoising according to claim 1, characterized in that: The generation network generates EEG signal data matching the conditional information based on the attention mechanism, and aggregates and outputs the reconstructed EEG signal with the time feature, specifically including: The generation network performs EEG reconstruction including forward diffusion and reverse denoising processes; The generation network includes a residual layer, a conditional attention layer, a downsampling layer, a temporal embedding layer and an upsampling layer; Generate time steps and Gaussian random noise, and perform a forward diffusion process to randomly generate Gaussian white noise at each time step and add it to the EEG signal to obtain a data sequence of T time steps; Normalize the time step to get the time vector T en , the time vector T en Input into the time embedding layer for time embedding encoding, which is specifically expressed as: Where d represents half the dimension of the embedding vector, and i represents the dimension index of the embedding vector; The reverse denoising process converts the T-th time step data X T Denoising restores the original sample X0, which is specifically expressed as: in, μ θ and Σ θ Respectively represent the mean and covariance matrix of the posterior distribution of the network parameter θ; The EEG signal affected by long-term artifacts is extracted through the residual layer to extract high-dimensional feature representation, and then input into the conditional attention layer together with the conditional information. The attention mechanism is used to query and project the conditional information S to obtain Q s , project the key and value of the input feature to obtain K and V, calculate the attention weight, and the attention calculation formula is expressed as: Among them, softmax is the activation function, is the scaling factor; The attention mechanism is used to filter out long-term artifacts that do not match the conditional information and generate EEG signal data that matches the conditional information. After reducing the data dimension through the downsampling layer, it is aggregated with the time features obtained through the time embedding layer, and the data dimension is restored through the upsampling layer. The upsampled signal passes through the residual layer, and the low-dimensional feature representation of the input signal is retained through the residual connection. The reconstructed EEG signal is obtained by combining the extracted high-dimensional feature representation.

8. The method for removing EEG artifacts based on deep learning and decision denoising according to claim 1, characterized in that: The forward diffusion process is expressed as: α t =1-β t Among them, β t represents the interpolation rate used in the t-th step of the noise addition process, β represents a hyperparameter, and X t Represents the original data X0 and random Gaussian white noise The linear combination of and Represents the corresponding combination coefficient.

9. The method for removing EEG artifacts based on deep learning and decision denoising according to claim 1, characterized in that: The test set of contaminated EEG signals is input into the trained EEG artifact removal network model, and the mean square error (mse) is used to optimize the parameters of the short-term denoising network, which is specifically expressed as: in, is the denoised EEG signal, l is the clean EEG signal corresponding to the short-term distribution artifact, and n is the number of samples; The absolute value error L1_loss is used to optimize the parameters of the long-term denoising network, which is specifically expressed as: in, is the denoised EEG signal, and g is the clean EEG signal corresponding to the long-term distributed artifact.

10. An EEG artifact removal system based on deep learning and decision denoising, characterized in that: include: Data generation module, EEG artifact removal network model construction module, pre-training module, EEG artifact removal network model training module, denoising signal output module; The data generation module is used to generate contaminated EEG signals containing long-term artifacts and short-term artifacts to construct a semi-simulated data set; The EEG artifact removal network model construction module is used to construct an EEG artifact removal network model, and the EEG artifact removal network model includes a segmentation network, a short-term denoising network and a long-term denoising network; The pre-training module is used to add the position coding label of the noise artifact to the contaminated EEG signal, and input it into the segmentation network for pre-training with the contaminated EEG signal to obtain the position coding corresponding to the EEG signal disturbed by the long-term artifact and the short-term artifact; The short-term denoising network includes an LSTM layer, a weight-initialized convolution layer and a TCN layer. The EEG signal disturbed by the short-term artifact is input into the LSTM layer to extract the state characteristics of the EEG signal, and the state characteristics of the EEG signal are input into the weight-initialized convolution layer. A one-dimensional convolution operation is performed on the state characteristics of the EEG signal based on the new weight parameters generated by the weight-initialized convolution layer, and a local time series feature is output. The TCN layer captures the characteristics of the short-term artifact according to the local time series feature and smoothes the short-term artifact. The long-term denoising network includes an auxiliary network and a generating network. The EEG signal disturbed by long-term artifacts is input into the auxiliary network to obtain a preliminary denoised EEG signal as condition information of the generating network. The generating network generates EEG signal data matching the condition information based on the attention mechanism, and outputs the reconstructed EEG signal after aggregation with the time feature. The EEG artifact removal network model training module is used to train the EEG artifact removal network model based on a semi-simulated data set; The denoising signal output module is used to input the test set of contaminated EEG signals into the trained EEG artifact removal network model and output a denoising signal.

Citation Information

Patent Citations

  • Electroencephalogram artifact removing method based on convolutional neural network

    CN116671933A

  • A hybrid system for the automatic removal of eye-blink artifacts from electroencephalogram signals

    DE202022100822U1

  • Method and system for reconstructing magnetic particle distribution model based on time-frequency spectrum enhancement

    US11816767B1

  • Image acquisition and transcoding system

    US20100309975A1

Cited By

  • Method for realizing functional near-infrared artifact removal of self-encoder based on long and short-term memory

    CN119357559A

  • Electroencephalogram signal super-resolution generation method and device, equipment and storage medium

    CN120983049A

  • Method and system for removing gradient artifacts of electrophysiological signals in magnetic resonance environment

    CN122049133A