An electroencephalogram signal time-frequency domain denoising method based on noise attention mechanism

By using a complex convolutional neural network based on a noise attention mechanism and combining time-frequency domain information, the shortcomings of existing EEG signal denoising methods in combining time and frequency domains are addressed, achieving efficient artifact removal and signal reconstruction, and improving the interpretability and denoising effect of the model.

CN120162529BActive Publication Date: 2025-11-18XI AN JIAOTONG UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510306166.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-14
Publication Date
2025-11-18
Estimated Expiration
2045-03-14

AI Technical Summary

Technical Problem

Existing EEG signal denoising methods fail to effectively combine time and frequency domains for denoising, resulting in poor denoising performance and poor model interpretability, making it difficult to effectively remove various artifacts in complex scenarios.

Method used

A complex convolutional neural network based on a noise attention mechanism is adopted. Through time-frequency domain segmentation and a complex C3k2Unet model with a two-stage noise attention mechanism, accurate artifact separation and signal reconstruction are achieved by combining time-frequency domain information. This includes the use of short-time Fourier transform, Unet1D model and DS-Natt-CCUNet model.

Benefits of technology

It achieves precise denoising of EEG signals in the time-frequency domain, improves the interpretability of the model and the denoising effect, effectively removes various artifacts, and identifies noise types through time-frequency plot analysis, providing optimization suggestions for the acquisition process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120162529B_ABST
    Figure CN120162529B_ABST
Patent Text Reader

Abstract

The application discloses a noise attention mechanism-based electroencephalogram time-frequency domain denoising method, which performs time-frequency transformation on a noisy electroencephalogram signal to generate a complex time-frequency feature; extracts a time domain and a frequency domain noise mask through a double-path neural network and fuses the time domain and the frequency domain noise mask; a double-stage complex convolutional network is constructed, a noise attention module of the double-stage complex convolutional network utilizes feature splitting and a spatial weight mechanism, a time-frequency distribution of noise is located in a first stage, and clean signal reservation and noise suppression are cooperatively optimized in a second stage; finally, a denoised signal is reconstructed through inverse transformation; the application simultaneously combines time domain and frequency domain information of the complex convolutional neural network electroencephalogram signal, and based on a noise attention mechanism of time-frequency domain segmentation, more accurately separates artifacts in the electroencephalogram signal and fully reserves useful electroencephalogram signals, while improving the interpretability of the model, and solves the problem that existing electroencephalogram signal denoising methods fail to consider time-frequency domain combination denoising; in addition, the application also includes a system, a device and a medium capable of storing and running the above method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of EEG signal denoising technology, and specifically relates to a time-frequency domain denoising method for EEG signals based on the noise attention mechanism. Background Technology

[0002] Electroencephalography (EEG) is a non-invasive technique that records the brain's electrical fields using scalp electrodes. Its signals originate from the spatial summation of postsynaptic potentials in a large population of neurons. Due to its safety, high temporal resolution, and hypersensitivity to dynamic changes in brain signals, EEG signals are widely used in medicine, psychology, neuroscience, and human-computer interaction. However, the low amplitude of EEG signals makes them susceptible to interference from other physiological and environmental noise, which can sometimes severely impact performance. Artifacts can mask or distort real brain electrical activity, making it difficult for researchers to accurately extract brainwave features. For example, in the medical field, artifacts may interfere with doctors' diagnosis of epilepsy, brain injury, or other diseases; in EEG studies based on machine learning or deep learning, artifacts can introduce noise, reducing model accuracy; and in real-time applications such as brain-computer interfaces, artifacts can lead to system response delays or malfunctions.

[0003] When acquiring EEG signals, interference from various artifacts is unavoidable. The main artifacts in EEG signals include: electrocardiogram (ECG), electromyogram (EMG), electrooculogram (EOG), and electromotion (EM). Among these, ECG, EMG, and EOG signals are physiological signals that are inevitably mixed in during the acquisition of EEG signals from patients. EM signals are artifacts introduced due to the relative movement of the scalp electrodes caused by the movement of the subject or the shaking of the lead wires during the acquisition process.

[0004] Currently, some research has been conducted on artifact removal for EEG signals. Traditional methods primarily rely on filtering techniques, blind source separation (BSS), and signal decomposition, or a combination of these three approaches. While these traditional methods demonstrate effectiveness in specific scenarios, their inherent limitations significantly restrict practical applications. For example, BSS techniques (such as ICA and CCA) rely on the assumption of multi-channel data (number of channels ≥ number of sources), making them difficult to adapt to single-channel portable scenarios. Hybrid methods (such as EEMD-CCA and SSA-ICA), while extending single-channel applicability through signal decomposition, require parameter adjustments tailored to specific artifact types and lack the ability to jointly process multiple artifacts. Filtering methods are prone to losing effective EEG frequency bands, while adaptive filtering (AF) and artifact subspace reconstruction (ASR) are limited by the difficulty of obtaining reference signals and parameter sensitivity. These shortcomings have prompted researchers to turn to data-driven deep learning frameworks to achieve end-to-end adaptive denoising and improve robustness in complex scenarios. In the field of deep learning technology, some scholars have proposed some denoising neural network frameworks. The more important research in the past five years includes: the NovelCL model based on CNN, the SDNet segmentation and denoising network based on ResNet, the DuoCL model based on the combination of multi-scale CNN and LSTM, the EEGIFNet based on the dual-branch structure, and the EEGDNet based on the Transformer self-attention mechanism. For example, patent CN119157556A discloses a method for denoising EEG signals based on a dual-path convolutional denoising network. It constructs a training set using EEG signal samples from a publicly available dataset; it constructs and trains a dual-path convolutional denoising network using the training set; it collects the original EEG signal and inputs it into the trained dual-path convolutional denoising network to obtain a denoised EEG signal; in the dual-path convolutional denoising network, the signal encoder encodes the original EEG signal into a feature vector; the mask generator converts the feature vector into a two-dimensional feature vector and extracts local and global information to generate a mask; the feature fusion unit multiplies the mask and the feature vector to obtain a denoised feature vector; and the signal decoder converts the denoised feature vector into a denoised EEG signal. Although it achieves a certain denoising effect in both single artifact removal and mixed artifact removal scenarios, it still has two major shortcomings: First, existing research focuses on processing the time domain of the signal, neglecting the influence of artifacts on the frequency domain. Secondly, existing deep learning model denoising research can be understood as using the powerful nonlinear problem-solving capabilities of neural networks to forcibly fit the model of EEG signal with artifacts into a clean EEG signal. The interpretability of the model is poor. Due to the lack of comprehensive analysis in the time and frequency domains, the model is difficult to explain "which frequencies are corrected" or "how artifacts are distributed in the frequency band", which limits the transparency and reliability of the denoising effect. Summary of the Invention

[0005] To address the shortcomings of existing technologies, the present invention aims to provide a time-frequency domain denoising method for EEG signals based on a noise attention mechanism. This method combines the time and frequency domain information of complex convolutional neural network EEG signals and innovatively proposes a noise attention mechanism based on time-frequency domain segmentation to more accurately separate artifacts in EEG signals while fully preserving useful EEG signals. It also improves the interpretability of the model and solves the problem that existing EEG signal denoising methods fail to consider the combination of time and frequency domain denoising.

[0006] To achieve the above objectives, the technical solution of the present invention is as follows:

[0007] A time-frequency domain denoising method for EEG signals based on a noise attention mechanism includes the following steps:

[0008] Step 1: Obtain the EEG signal with artifacts and use short-time Fourier transform to convert it into a time-frequency map for subsequent noise reduction from the perspective of combining the time and frequency domains;

[0009] Step 2: Use a one-dimensional Unet1D model to obtain the time mask of the EEG signal with artifacts, which is the region of noise in the time domain; use Fourier transform and a one-dimensional Unet1D model with the same structure to obtain the frequency mask of the EEG signal with artifacts, which is the region of noise in the frequency domain; then combine the two to obtain the time-frequency mask of the noise, which is the approximate region of noise in the frequency domain.

[0010] Step 3: Input the time-frequency map of the EEG signal with artifacts obtained in Step 1 into the noise attention module of the complex C3k2Unet model (DS-Natt-CCUNet model) with a two-stage noise attention mechanism. Also input the noise time-frequency mask obtained in Step 2 into the noise attention module to help the C3k2Unet model locate the noise region. Finally, the C3k2Unet model outputs an accurate noise time-frequency map.

[0011] Step 4: After obtaining the accurate noise time-frequency plot, input it into the noise attention module. The input is still the time-frequency plot of the EEG signal with artifacts. The DS-Natt-CCUNet model performs accurate denoising and outputs a clean time-frequency plot of the EEG signal.

[0012] Step 5: Perform an inverse short-time Fourier transform on the time-frequency plot of the clean EEG signal to obtain the final clean EEG signal.

[0013] The artifact-laden EEG signal in step one is transformed using the Hann window as the window function. The specific formula for the Discrete Short-Time Fourier Transform is as follows:

[0014]

[0015] Where X[m,k] are the complex spectral coefficients of time frame m and frequency k, x[n] is the original discrete signal, w[n] is a window function of length L (such as a Hann window), H is the frame shift (step size), N is the number of FFT points, j is the imaginary unit, and π is pi; the original signal can be reconstructed by the inverse short-time Fourier transform (ISTFT), and its formula is:

[0016]

[0017] Where A is the normalization factor (usually A = Σ) m ω 2 [n-mH]), where w[n-mH] is the window function used in the inverse transform, and its position is determined by the mH offset. Other properties are consistent with the STFT formula.

[0018] Step two specifically involves generating a time mask and a frequency mask using parallel time-domain Unet1D networks and frequency-domain Unet1D networks, respectively, and then multiplying the time mask and frequency mask element by element to generate a time-frequency joint noise mask.

[0019] The DS-Natt-CCUNet model in step three is based on the Unet framework. It combines a complex-valued CNN with the C3k2 feature extraction module in YOLOv11 to construct an encoder capable of processing the time-frequency map of EEG signals. It combines CSPNet (Cross Stage Partial Network) with a spatial attention mechanism and uses the time-frequency mask / map of noise as input to construct a noise attention mechanism.

[0020] The complex neural network comprises four parts:

[0021] (1) Complex Convolution (CConv)

[0022] The convolution kernel of a complex convolutional layer consists of two sets of learnable parameters: a real part and an imaginary part. The input data is also represented in complex form. During the calculation process, complex convolution follows the complex multiplication rule. Specifically, the result of the convolution of the real part of the weights and the real part of the input is subtracted from the result of the convolution of the imaginary part of the weights and the imaginary part of the input, which is the real part of the output. The result of the convolution of the imaginary part of the weights and the real part of the input is added to the result of the convolution of the imaginary part of the weights and the imaginary part of the input, which is the imaginary part of the output, thus obtaining the result of the complex convolution.

[0023] The detailed calculation process is as follows:

[0024] 1) Define the complex convolution kernel W = W real +iW imagInputting complex numbers X = X real +X imag W real and W imag Let X be the real and imaginary parts of the complex convolution kernel. real and X imag The real and imaginary parts of a complex number are input.

[0025] 2) Calculate the real part of the output: in The real part of the output is represented by , * represents the convolution operation, and Conv(·) is the real number convolution function;

[0026] 3) Calculate the imaginary part of the output: in This is the imaginary part of the output;

[0027] (2) Complex Pooling

[0028] Complex pooling layers are divided into two types: max pooling and average pooling. They are also applied to the complex domain. For max pooling, the maximum value of the modulus of the complex number in the local region is selected. For average pooling, the average value of the real and imaginary parts of the complex number in the local region is calculated as the real and imaginary parts of the result. Based on the actual performance of the two pooling methods, complex max pooling is finally selected as the feature dimensionality reduction method.

[0029] (3) Complex Batch Normalization (CBN) layer

[0030] Complex batch normalization (CBN) layers are an extension of batch normalization in the complex domain, designed to handle the normalization of complex numerical data. By normalizing the statistical characteristics of small batches of data, the distribution of complex numerical features is stabilized, thereby accelerating training and improving model performance. Since complex data contains both real and imaginary parts, the design of CBN needs to consider complex number operations. The specific calculation formula is as follows:

[0031]

[0032] in, Let x be the normalized complex value, E[x] be the input complex value data, E[x] be the mean of the complex input x, and V be the covariance matrix of the complex input, defined as shown in formula (6). In order for V to have a solution, V must satisfy positive definiteness or positive semi-definiteness. The condition for V to be positive semi-definite is the mean μ, covariance Γ, and pseudovariance C, as shown in formula (7):

[0033]

[0034] Among them, V rrV is the covariance between the real parts and the real parts. ri V is the covariance between the real and imaginary parts. ir V is the covariance between the imaginary and real parts. ii Let be the covariance between the imaginary parts, and Con(a,b) be the covariance calculation function.

[0035]

[0036] Finally, two learnable adjustment parameters, γ and β, are introduced to adjust the feature distribution, and their calculation formulas are as follows:

[0037]

[0038] in, It is a positive semi-definite matrix containing four parameters, where β is a complex vector with the same dimension as a complex number. This is used for ease of training and batch normalization. Satisfying a standard Gaussian distribution, γ rr and γ ii Initialize to γ ri γ ir Both the real and imaginary parts of β are initialized to 0;

[0039] (4) Complex Activation Function Layer

[0040] The activation function used in the complex activation function layer is the ReLU activation function, which is defined as f(x) = max(0,x), that is, retaining the positive part of the input value and truncating the negative value to zero. The calculation process of its complex domain is shown in formula (9), which calculates the real part of the input data respectively. and the virtual part The real and imaginary parts of the result are obtained by applying the ReLU activation function respectively. Similarly, the complex Sigmoid activation function is shown in formula (10):

[0041]

[0042] Where CReLU(x) is the complex ReLU activation function and ReLU(x) is the real ReLU activation function.

[0043]

[0044] Where CSigmoid(x) is the complex Sigmoid activation function, and Sigmoid(x) is the real Sigmoid activation function.

[0045] The method for denoising the noise attention module in the DS-Natt-CCUNet model in step three or four to obtain a clean time-frequency image is as follows:

[0046] The input complex time-frequency image is first processed by CConv to extract preliminary complex features, and then split along the channel dimension. Inheriting the architecture of CSPNet, the features are divided into two branches: branch 1 directly retains the original complex features to maintain information integrity, while branch 2 dynamically generates a weight map through a spatial attention mechanism. In the attention branch, the features undergo double pooling operations of max pooling and average pooling to generate two types of spatial statistical descriptors. Then, the double pooling results are fused by complex convolution (CConv), and the feature distribution is dynamically adjusted by complex batch normalization (CBN) to adapt to different noise scenarios. Finally, the fused features are compressed into a spatial weight map in the range of [0,1] by complex sigmoid (CSigmoid). This weight map is multiplied point by point with the original complex features of branch 1, and finally the clean time-frequency image of the EEG signal is output.

[0047] The present invention also includes a system capable of running the above-described time-frequency domain denoising method for EEG signals based on a noise attention mechanism.

[0048] The present invention also includes an apparatus comprising:

[0049] Memory: Used to store the computer program that implements the above-mentioned method for time-frequency domain denoising of EEG signals based on a noise attention mechanism;

[0050] Processor: Used to implement the above-mentioned time-frequency domain denoising method for EEG signals based on a noise attention mechanism when executing the computer program.

[0051] The present invention also includes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for time-frequency domain denoising of EEG signals based on a noise attention mechanism.

[0052] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0053] 1. Steps one and two of this invention are preprocessing stages, which employ time-domain-frequency domain joint masking segmentation technology and achieve accurate positioning of signal features through a multi-modal collaborative processing mechanism, thus possessing dual-domain feature enhancement characteristics.

[0054] 2. Steps three and four of this invention are the core processing stages. The DS-Natt-CCUNet deep learning model is innovatively introduced to construct a noise attention architecture, which can realize noise feature extraction and pure EEG signal reconstruction, forming a unique dual feature decoupling learning capability.

[0055] 3. Steps five and six of this invention are the processing stage, which realizes signal reconstruction through inverse transformation of time-frequency matrix and generates an optimized acquisition parameter scheme based on feature analysis results. It has dual application value of high signal restoration fidelity and strong clinical adaptability.

[0056] In summary, this invention addresses the problem of existing EEG signal denoising methods failing to comprehensively denoise EEG signals by simultaneously combining time and frequency domains, resulting in poor denoising performance and poor model interpretability. It achieves both maximum artifact removal in the time and frequency domains and maximum preservation of the original components of the EEG signal. In real-world scenarios (with mixed EMG and ECG artifacts), the time-frequency plot of this invention more closely approximates that of a clean EEG signal, effectively denoising in both the time and frequency domains. Furthermore, it can analyze the noise's time-frequency plot to identify the type of noise mixed into the original EEG signal, helping EEG signal acquisition personnel prevent noise intrusion at its source. Therefore, this invention not only effectively removes various artifacts from EEG signals but also provides specific suggestions for reducing artifact intrusion during actual EEG signal acquisition. Attached Figure Description

[0057] Figure 1 This is an overall flowchart of a time-frequency domain denoising method for EEG signals based on a noise attention mechanism.

[0058] Figure 2 This is a detailed block diagram of the complex C3k2Unet model (DS-Natt-CCUNet) with a two-stage noise attention mechanism.

[0059] Figure 3 Example diagrams of a single signal and an EEG signal with artifacts.

[0060] Figure 4 The average experimental results of this method compared with other methods are used to remove a single artifact.

[0061] Figure 5 A comparison of experimental results between this method and other methods when removing a single artifact.

[0062] Figure 6 The average experimental results of this method compared with other methods are presented in a real-world scenario (with mixed artifacts of electromyography and electrocardiography removed).

[0063] Figure 7 The image shows a time-domain comparison of EEG signals between this method and other methods in a real-world scenario (with mixed EMG and ECG artifacts removed).

[0064] Figure 8 This is a comparison of the time-frequency plots of EEG signals from this method and other methods in a real-world scenario (with mixed EMG and ECG artifacts removed) (the values ​​have been logarithmized for easier comparison).

[0065] Figure 9 The image shows the time-frequency plot labels for the noise, a comparison of the noise time-frequency mask and the noise time-frequency plot output by the model.

[0066] Figure 10 The figure shows the ablation experiment results of the DS-Natt-CCUNet model. Detailed Implementation

[0067] The process and advantages of the present invention will now be described in detail with reference to the accompanying drawings.

[0068] like Figure 1 As shown, a time-frequency domain denoising method for EEG signals based on a noise attention mechanism includes the following steps:

[0069] Step 1: Obtain the EEG signal with artifacts and use short-time Fourier transform to convert it into a time-frequency map for subsequent noise reduction from the perspective of combining the time and frequency domains;

[0070] Step 2: Use a one-dimensional Unet1D model to obtain the time mask of the EEG signal with artifacts, which is the region of noise in the time domain; use Fourier transform and a one-dimensional Unet1D model with the same structure to obtain the frequency mask of the EEG signal with artifacts, which is the region of noise in the frequency domain; then combine the two to obtain the time-frequency mask of the noise, which is the approximate region of noise in the frequency domain.

[0071] Step 3: Input the time-frequency map of the EEG signal with artifacts obtained in Step 1 into the noise attention module of the complex C3k2Unet model (DS-Natt-CCUNet model) with a two-stage noise attention mechanism. Also input the noise time-frequency mask obtained in Step 2 into the noise attention module to help the C3k2Unet model locate the noise region. Finally, the C3k2Unet model outputs an accurate noise time-frequency map.

[0072] Step 4: After obtaining the accurate noise time-frequency map, input it into the noise attention module to assist the model in accurate denoising. The input of the DS-Natt-CCUNet model is still the time-frequency map of the EEG signal with artifacts. At this time, the model outputs a clean time-frequency map of the EEG signal.

[0073] Step 5: Perform an inverse short-time Fourier transform on the time-frequency plot of the clean EEG signal to obtain the final clean EEG signal.

[0074] By combining the noise time-frequency diagram obtained in step three, artifacts mixed in with the original EEG signal can be analyzed, and corresponding optimization suggestions can be given for the EEG signal acquisition process. The optimization suggestions include:

[0075] (1) When EMG artifacts are detected, it is recommended to reduce facial muscle activity;

[0076] (2) When ECG artifacts are detected, it is recommended to adjust the position of the ECG interference electrode;

[0077] (3) When EOG artifacts are detected, it is recommended to reduce eye movements.

[0078] The artifact-laden EEG signal in step one has a sampling rate of 256 Hz and a duration of 2 seconds. The window function used in the Discrete Short-Time Fourier Transform (DSFT) is the Hann window with a window size of 126 and a step size of 8. The specific formula for the DFT is as follows:

[0079]

[0080] Where x[n] is the discrete signal, w[n] is a window function of length L (such as a Hann window), m is the time frame index, H is the frame shift (step size), k is the frequency index, and N is the number of FFT points; the original signal can be reconstructed by the inverse short-time Fourier transform (ISTFT), and its formula is:

[0081]

[0082] Where A is the normalization factor (usually A = Σ) m ω 2 [n-mH]), where w[n-mH] is the window function used in the inverse transform, and its position is determined by the mH offset. Other properties are consistent with the STFT formula.

[0083] The Unet1D model used in step two includes an encoder consisting of convolutional layers, batch normalization layers, and ReLU activation functions. The purpose is to roughly locate the noise region in the time and frequency domains. This paper is based on the classic Unet model and adapts and adjusts its structural parameters according to the characteristics of one-dimensional EEG signals, such as their length. The encoding layer mainly consists of convolutional layers, batch normalization layers, and ReLU activation function layers.

[0084] The second step is specifically as follows: a time mask and a frequency mask are generated by using parallel time-domain Unet1D networks and frequency-domain Unet1D networks respectively, and the time mask and the frequency mask are multiplied element by element to generate a time-frequency joint noise mask.

[0085] The structures of time-domain Unet1D networks and frequency-domain Unet1D networks include:

[0086] (1) The encoder consists of 5 downsampling modules, each of which contains a one-dimensional convolutional layer, a batch normalization layer and a ReLU activation function;

[0087] (2) The decoder consists of 4 upsampling modules and uses transposed convolution to restore features;

[0088] (3) Skip connections are achieved by splicing cross-layer features.

[0089] The DS-Natt-CCUNet model in step three has the following model structure diagram: Figure 1 and Figure 2 As shown, the basic framework of this model is still Unet. In order to enable it to process time-frequency map features (complex numbers, including real and imaginary parts) and improve its feature mining performance, this paper combines a complex-valued CNN with the C3k2 feature extraction module in YOLOv11 to construct an encoder that can efficiently process the time-frequency map of EEG signals. The paper also combines CSPNet (CrossStage Partial Network) and spatial attention mechanism, and constructs a noise attention mechanism with a time-frequency mask / map of noise as input.

[0090] The complex neural network module comprises four parts:

[0091] (1) Complex Convolution (CConv)

[0092] Complex convolutional layers are an extension of real convolutional layers. Their core function is to extend the kernel parameters and input data from the real domain to the complex domain, thereby simultaneously modeling the amplitude and phase information of the signal during feature extraction. Specifically, the convolution kernel of a complex convolutional layer consists of two sets of learnable parameters: real and imaginary parts. The input data is also represented in complex form. During computation, complex convolution follows the complex multiplication rule. Assuming the kernel parameters W = W... real +iW imag Input data X = X real +X imag The convolution process is shown in formula (3):

[0093] W * X = (W real * X real - W imag * X imag ) + i(W imag * X real + W real * X imag (3)

[0094] Among them, W real and W imag Let X be the real and imaginary parts of the complex convolution kernel. real and X imagrepresents the real and imaginary parts of the complex number input, and * represents the convolution operation.

[0095] The above formula can be transformed into matrix form, as shown in formula (4):

[0096]

[0097] in, The real part of the output. This is the imaginary part of the output.

[0098] As can be seen from the two formulas above, the calculation process is as follows:

[0099] 1) Define the complex convolution kernel W = W real +iW imag Inputting complex numbers X = X real +X imag ;

[0100] 2) Calculate the real part of the output:

[0101] 3) Calculate the imaginary part of the output:

[0102] Where Conv(·) represents the real number convolution function.

[0103] The process of complex convolution is broken down into four real-number convolution operations, which are then combined to form a complex number. Specifically, the real part of the output is obtained by subtracting the imaginary part of the input from the real part of the weights convolved with the real part of the input; the imaginary part of the output is obtained by adding the imaginary part of the weights convolved with the real part of the input to the imaginary part of the input. This process yields the result of complex convolution.

[0104] (2) Complex Pooling

[0105] Complex pooling layers are also divided into max pooling and average pooling, applying the maximization and averaging operations to the complex domain. For max pooling, the maximum value of the modulus of the complex number in the local region is selected. For average pooling, the average of the real and imaginary parts of the complex number in the local region is calculated as the real and imaginary parts of the result. Based on the actual performance of the two pooling methods, complex max pooling is finally selected as the feature dimensionality reduction method.

[0106] (3) Complex Batch Normalization (CBN) layer

[0107] Complex batch normalization (CBN) is an extension of batch normalization in the complex domain, designed to handle the normalization of complex numerical data. Its core idea is similar to real batch normalization (BN): by normalizing the statistical characteristics of small batches of data, the distribution of complex numerical features is stabilized, thereby accelerating training and improving model performance. However, since complex data contains both real and imaginary parts, CBN design needs to consider the special properties of complex operations. Simply relying on translation and scaling in the real domain cannot ensure that the mean and variance of the real and imaginary parts of complex numbers remain consistent, and the normalized input may exhibit a significant bias. Complex domain normalization can overcome these problems and improve model performance by utilizing the overall mean and complex domain covariance matrix of the input data x to effectively standardize the input. The specific calculation formula is as follows:

[0108]

[0109] in, Let x be the normalized complex value, E[x] be the input complex value data, E[x] be the mean of the complex input x, and V be the covariance matrix of the complex input. V is the covariance matrix of the complex input, and its definition is shown in formula (6). It should be noted that in order for V to have a solution, V must satisfy positive definiteness or positive semi-definiteness. The condition for V to be positive semi-definite is the mean μ, the covariance Γ, and the pseudovariance C, as shown in formula (7).

[0110]

[0111] Among them, V rr V is the covariance between the real parts and the real parts. ri V is the covariance between the real and imaginary parts. ir V is the covariance between the imaginary and real parts. ii Let be the covariance between the imaginary parts, and Con(a,b) be the covariance calculation function.

[0112]

[0113] Finally, two learnable adjustment parameters, γ and β, are introduced to adjust the feature distribution, and their calculation formulas are as follows:

[0114]

[0115] in, It is a positive semi-definite matrix containing four parameters, where β is a complex vector with the same dimension as a complex number. This is used for ease of training and batch normalization. Satisfying a standard Gaussian distribution, γ rr and γ ii Initialize to γ ri γ irBoth the real and imaginary parts of β are initialized to 0.

[0116] Through the above operations, we can obtain the result of batch normalization of complex numbers.

[0117] (4) Complex Activation Function Layer

[0118] Activation functions are important components in neural networks that introduce nonlinear characteristics. Their role is to perform nonlinear transformations on the output of neurons, thereby giving the model the ability to express complex mapping relationships. Among many activation functions, ReLU (Rectified Linear Unit) has become one of the most widely used activation functions in modern deep learning due to its simplicity and efficiency. Using ReLU as the activation function, ReLU is defined as f(x) = max(0,x), which means retaining the positive part of the input value and truncating the negative value to zero. This design is not only computationally efficient, but also effectively alleviates the gradient vanishing problem, especially in deep networks. Therefore, this paper will use its complex domain expression based on the ReLU activation function. The calculation process is shown in formula (9), which calculates the real part of the input data. and the virtual part The real and imaginary parts of the result are obtained by applying the ReLU activation function separately. Similarly, the CSigmoid activation function is shown in formula (10):

[0119]

[0120] Where CReLU(x) is the complex ReLU activation function and ReLU(x) is the real ReLU activation function.

[0121]

[0122] Where CSigmoid(x) is the complex Sigmoid activation function, and Sigmoid(x) is the real Sigmoid activation function.

[0123] The method for denoising the noise attention module in the DS-Natt-CCUNet model in step three or four to obtain a clean time-frequency image is as follows:

[0124] like Figure 2As shown, the noise attention module in this paper processes complex-form noise time-frequency maps (generated via STFT, etc.) based on modules such as complex convolution. Its core design combines spatial attention mechanism with the efficient feature processing idea of ​​CSPNet. Specifically, the input complex time-frequency map first extracts preliminary complex features through CConv, and then splits along the channel dimension. Inheriting the architecture of CSPNet, the features are divided into two branches: branch 1 directly retains the original complex features to maintain information integrity, while branch 2 dynamically generates a weight map through spatial attention mechanism. In the attention branch, the features undergo double pooling operations of max pooling (highlighting significant noise or signal regions) and average pooling (capturing global energy distribution) to generate two types of spatial statistical descriptors. Then, the double pooling results are fused through complex convolution (CConv), and the feature distribution is dynamically adjusted by complex batch normalization (CBN) to adapt to different noise scenarios. Finally, the fused features are compressed into a spatial weight map in the range of [0,1] through complex sigmoid (CSigmoid). The weighted graph is multiplied pointwise with the original complex features of branch 1 to focus on noisy regions. In the second stage, this helps the model learn the time-frequency graph of noise better, and in the third stage, it helps the model denoise better. CSPNet's feature splitting strategy significantly reduces computational redundancy, while the spatial attention mechanism, through the combination of dual pooling, can more accurately focus on key regions in the time-frequency graph, ultimately outputting a clean time-frequency graph of the EEG signal with features carrying adaptive weights.

[0125] The processing flow of the noise attention module includes:

[0126] (1) Split the input complex features into a main branch and an attention branch;

[0127] (2) In the attention branch:

[0128] 1) Perform complex max pooling and complex average pooling in parallel on the input features. The complex max pooling selects the maximum value of the complex modulus in a local region, and the complex average pooling calculates the average value of the real part and the imaginary part, respectively.

[0129] 2) The results of dual pooling are fused through complex convolutional layers;

[0130] 3) Perform complex batch normalization on the fused features;

[0131] 4) Generate a spatial weight map using the complex sigmoid activation function (CSigmoid);

[0132] (3) Perform complex element-wise multiplication between the spatial weight graph and the main branch features.

[0133] The parameters of the inverse short-time Fourier transform in step five are strictly matched with those in step (1), including:

[0134] (1) Use the same Hann window function;

[0135] (2) Window length: 126 sampling points;

[0136] (3) Overlap rate 84.13% (calculated from step size 8 and window length 126).

[0137] In addition to achieving noise reduction, this method can also identify artifacts mixed in EEG signals, such as:

[0138] (1) When the high frequency component of the noise time-frequency graph is relatively high, it is determined to be an electromyography artifact (EMG).

[0139] (2) When the noise time-frequency graph shows a low-frequency periodic waveform, it is determined to be an ECG artifact;

[0140] (3) When the energy of the noise time-frequency graph is concentrated in the δ / θ frequency band (0.5-8Hz), it is determined to be an electrooculography artifact (EOG).

[0141] The present invention also includes a system capable of running the above-described time-frequency domain denoising method for EEG signals based on a noise attention mechanism.

[0142] The present invention also includes an apparatus comprising:

[0143] Memory: Used to store the computer program that implements the above-mentioned method for time-frequency domain denoising of EEG signals based on a noise attention mechanism;

[0144] Processor: Used to implement the above-mentioned time-frequency domain denoising method for EEG signals based on a noise attention mechanism when executing the computer program.

[0145] The present invention also includes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for time-frequency domain denoising of EEG signals based on a noise attention mechanism.

[0146] Experiments verify the performance of the present invention

[0147] To fully verify the denoising performance of this invention, this paper verifies the denoising effects of single artifacts and mixed artifacts under the following conditions: the signal-to-noise ratio (SNR) of the EEG signal and the artifact is -5, -3, -1, 0, 1, 3, and 5, respectively. Specific EEG, EMG, ECG, EOG, EM signals, and EEG signals with artifacts are as follows: Figure 3As shown. The experiment used three metrics to quantify the denoising effect: signal-to-noise ratio (SNR), relative root mean square error (RRMSE), and correlation coefficient (CC). A thorough comparison was made with mainstream denoising models from the past five years. The calculation formulas for these three metrics will be explained below:

[0148] RRMSE evaluates the deviation between the reconstructed EEG signal and the clean EEG signal. A lower RRMSE indicates better reconstruction performance. The formula for calculating RRMSE is as follows:

[0149]

[0150] Where y represents a clean EEG signal, The output of the model is represented by N, which is the denoised EEG signal. N represents the number of sampling points of the signal.

[0151] To measure the similarity between two variables, the correlation coefficient (CC) is commonly used, and its calculation formula is as follows:

[0152]

[0153] in, Representing the real signal y and the model output signal covariance, σ y and These are the standard deviations of the two values, respectively.

[0154] Signal-to-noise ratio (SNR) represents the ratio of signal power to noise power, and its calculation formula is as follows:

[0155]

[0156] For the denoising effect of a single artifact, such as Figure 4 and Figure 5 As shown, Figure 4 The model's average performance under seven different experimental conditions for four different artifacts (ECG, EMG, EEG, and motion artifacts) shows that this invention outperforms other comparative models in denoising all four artifacts, with significant improvements. The best denoising effect is observed for ECG signals, with an average RRMSE of 0.2042, an average CC of 0.9779, and an average SNR of 14.039. In contrast, the denoising effect for EMG, EEG, and motion artifacts is not as good as that for ECG signals. This is related to their frequency and amplitude characteristics, especially for EEG signals, which are the most difficult to denoise due to significant overlap in frequency band with EEG signals. Figure 5The results show the performance of various models under different signal-to-noise ratios. It can be seen that as the signal-to-noise ratio increases, the denoising effect of the model is better. This is consistent with the actual understanding that the higher the signal-to-noise ratio, the fewer artifacts in the original EEG signal, so the better the denoising performance of the model.

[0157] For real-world scenarios (mixed artifacts from EMG and ECG), the model's denoising performance is as follows: Figure 6 , Figure 7 and Figure 8 As shown. Figure 6 The average performance of the model under seven different experimental conditions shows that, in terms of mixed artifact removal, this invention significantly outperforms other comparative methods. We can also see that removing mixed artifacts is more difficult than removing single artifacts because mixed artifacts contain more complex signal components and noise frequency bands. Figure 7 It can be seen that the denoised EEG signal of this invention fits best with the clean EEG signal, combined with Figure 8 As can be seen from the time-frequency plot, although the DuoCL model has a good fitting effect, it differs significantly from the time-frequency plot of a clean EEG signal in the time-frequency domain. This also reflects the advantage of the present invention: it can simultaneously achieve denoising in the time-frequency domain, thereby achieving a better denoising effect and improving the interpretability of the model.

[0158] from Figure 9 It can also be seen that, compared to other methods that simply denoise, this invention can also identify the time-frequency regions of artifacts mixed in the original EEG signal, thus helping to solve the problem of artifact intrusion at its source. For example, this invention can obtain the time-frequency mask of noise through two Unet1D models, thereby knowing the approximate region of noise in the original signal; it can also obtain a more accurate noise time-frequency map by inputting the noise time-frequency mask into the noise attention mechanism of the DS-Natt-CCUnet model. This is very useful in practical applications. For example, if a large number of high-frequency components are found in the noise time-frequency map, it can be inferred that there may be electromyographic artifacts, thereby regulating the EEG signal acquisition process, paying particular attention to keeping facial muscles relaxed to prevent the intrusion of electromyographic signals. This provides important targeted suggestions for actual EEG signal acquisition.

[0159] In addition, from Figure 10The ablation experiment results show that the model performance significantly improves with the gradual addition of module functions. Taking ECG signals as an example, CCUnet, through the deep feature extraction capability of the CC3k2 module, reduced the RRMSE from 0.2445 to 0.2302, while increasing the CC value to 0.9705, verifying the enhancing effect of the CC3k2 module on time-frequency feature learning. Further introducing the noise attention mechanism, i.e., using a noise time-frequency mask to guide the Natt-CCUnet model for denoising, resulted in an increase in the CC value of the EMG signal from 0.9410 to 0.9493, and a 0.65dB improvement in the SNR of mixed artifacts. This indicates that the noise attention mechanism can guide the model to better learn time-frequency features and suppress noise components. The complete DS-Natt-CCUnet model integrates the above advantages and uses a more accurate noise time-frequency matrix to guide denoising. The results show a CC value of 0.9113 in mixed artifact scenarios, a 5.1% improvement over the base model, and the lowest RRMSE (0.3108) and highest SNR (10.1932) for single artifacts (such as EOG). This result demonstrates that the synergistic design of the CC3k2 module and the noise attention mechanism can both enhance feature representation capabilities and dynamically optimize the noise suppression process, thereby achieving robust denoising in various noise scenarios.

[0160] Finally, in practical applications of this invention, simply deploying the involved model and its pre-trained parameters to the target device achieves end-to-end automatic removal of EEG signal artifacts. This method is not only simple to operate but also significantly improves the efficiency and accuracy of EEG signal preprocessing. Compared to traditional manual processing or complex multi-step preprocessing procedures, this method greatly reduces the need for human intervention and lowers the possibility of errors introduced due to improper operation or inaccurate parameter adjustment. Furthermore, because the model is pre-trained, its performance exhibits strong robustness across various scenarios, adapting to different types of EEG signal data, thus providing a more reliable foundation for subsequent signal analysis and feature extraction. This efficient automated processing method is particularly suitable for applications requiring rapid, real-time processing of large-scale EEG data, such as clinical diagnosis, brain-computer interface development, and neuroscience research.

[0161] In summary, the time-frequency domain denoising method for EEG signals based on the noise attention mechanism proposed in this invention has three major advantages: First, it can simultaneously denoise multiple artifacts in EEG signals from a time-frequency domain perspective, resulting in strong model performance and interpretability; second, by analyzing the noise time-frequency map obtained from the model, the types of artifacts mixed into the original EEG signal can be identified, thus providing specific suggestions for reducing artifact mixing during actual EEG signal acquisition; third, the model in this invention can be easily deployed to target devices, enabling end-to-end automatic removal of EEG signal artifacts.

Claims

1. A time-frequency domain denoising method for EEG signals based on a noise attention mechanism, characterized in that, Includes the following steps: Step 1: Obtain the EEG signal with artifacts and use short-time Fourier transform to convert it into a time-frequency map for subsequent noise reduction from the perspective of combining the time and frequency domains; Step 2: Use a one-dimensional Unet1D model to obtain the time mask of the EEG signal with artifacts, which is the region of noise in the time domain; The frequency mask of the EEG signal with artifacts is obtained by using Fourier transform and a one-dimensional Unet1D model with the same structure, which is the region of noise in the frequency domain; then the two are combined to obtain the time-frequency mask of the noise, which is the approximate region of noise in the time-frequency domain. Step 3: Input the time-frequency map of the EEG signal with artifacts obtained in Step 1 into the noise attention module of the DS-Natt-CCUNet model with a two-stage noise attention mechanism. Also input the noise time-frequency mask obtained in Step 2 into the noise attention module to help the DS-Natt-CCUNet model locate the noise region. Finally, the DS-Natt-CCUNet model outputs an accurate noise time-frequency map. Step 4: After obtaining the accurate noise time-frequency plot, input it into the noise attention module. The input is still the time-frequency plot of the EEG signal with artifacts. The DS-Natt-CCUNet model performs accurate denoising and outputs a clean time-frequency plot of the EEG signal. Step 5: Perform an inverse short-time Fourier transform on the time-frequency plot of the clean EEG signal to obtain the final clean EEG signal; The DS-Natt-CCUNet model mentioned in step three is based on the Unet framework. It combines a complex-valued CNN with the C3k2 feature extraction module in YOLOv11 to construct an encoder capable of processing time-frequency maps of EEG signals. It combines CSPNet (Cross Stage Partial Network) with a spatial attention mechanism and uses a time-frequency mask / map of noise as input to construct a noise attention mechanism.

2. The time-frequency domain denoising method for EEG signals based on a noise attention mechanism according to claim 1, characterized in that, The artifact-laden EEG signal in step one is transformed using the Hann window as the window function. The specific formula for the Discrete Short-Time Fourier Transform is as follows: Where X[m,k] are the complex spectral coefficients of time frame m and frequency k, x[n] is the original discrete signal, w[n] is a window function of length L (such as a Hann window), H is the frame shift (step size), N is the number of FFT points, j is the imaginary unit, and π is pi; the original signal can be reconstructed by the inverse short-time Fourier transform (ISTFT), and its formula is: Where A is the normalization factor (usually A = ∑ m ω 2 [n-mH]), where w[n-mH] is the window function used in the inverse transform, and its position is determined by the mH offset. Other properties are consistent with the STFT formula.

3. The time-frequency domain denoising method for EEG signals based on a noise attention mechanism according to claim 1, characterized in that, Step two specifically involves generating a time mask and a frequency mask using parallel time-domain Unet1D networks and frequency-domain Unet1D networks, respectively, and then multiplying the time mask and frequency mask element by element to generate a time-frequency joint noise mask.

4. The time-frequency domain denoising method for EEG signals based on a noise attention mechanism according to claim 1, characterized in that, The complex neural network comprises four parts: (1) Complex Convolution (CConv) The convolution kernel of a complex convolutional layer consists of two sets of learnable parameters: a real part and an imaginary part. The input data is also represented in complex form. During the calculation process, complex convolution follows the complex multiplication rule. Specifically, the result of the convolution of the real part of the weights and the real part of the input is subtracted from the result of the convolution of the imaginary part of the weights and the imaginary part of the input, which is the real part of the output. The result of the convolution of the imaginary part of the weights and the real part of the input is added to the result of the convolution of the imaginary part of the weights and the imaginary part of the input, which is the imaginary part of the output, thus obtaining the result of the complex convolution. The detailed calculation process is as follows: 1) Define the complex convolution kernel W = W real +iW imag Inputting complex numbers X = X real +X imag W real and W imag Let X be the real and imaginary parts of the complex convolution kernel. real and X imag The real and imaginary parts of a complex number are input. 2) Calculate the real part of the output: in The real part of the output is represented by , * represents the convolution operation, and Conv(·) is the real number convolution function; 3) Calculate the imaginary part of the output: in This is the imaginary part of the output; (2) Complex Pooling Complex pooling layers are divided into two types: max pooling and average pooling. They are also applied to the complex domain. For max pooling, the maximum value of the modulus of the complex number in the local region is selected. For average pooling, the average value of the real and imaginary parts of the complex number in the local region is calculated as the real and imaginary parts of the result. Based on the actual performance of the two pooling methods, complex max pooling is finally selected as the feature dimensionality reduction method. (3) Complex Batch Normalization (CBN) layer Complex batch normalization (CBN) layers are an extension of batch normalization in the complex domain, designed to handle the normalization of complex numerical data. By normalizing the statistical characteristics of small batches of data, the distribution of complex numerical features is stabilized, thereby accelerating training and improving model performance. Since complex data contains both real and imaginary parts, the design of CBN needs to consider complex number operations. The specific calculation formula is as follows: in, Let x be the normalized complex value, E[x] be the input complex value data, E[x] be the mean of the complex input x, and V be the covariance matrix of the complex input, defined as shown in formula (6). In order for V to have a solution, V must satisfy positive definiteness or positive semi-definiteness. The condition for V to be positive semi-definite is the mean μ, covariance Γ, and pseudovariance C, as shown in formula (7): Among them, V rr V is the covariance between the real parts and the real parts. ri V is the covariance between the real and imaginary parts. ir V is the covariance between the imaginary and real parts. ii Let be the covariance between the imaginary parts, and Con(a,b) be the covariance calculation function. Finally, two learnable adjustment parameters, γ and β, are introduced to adjust the feature distribution, and their calculation formulas are as follows: in, It is a positive semi-definite matrix containing four parameters, where β is a complex vector with the same dimension as the complex number. This is used for ease of training and batch normalization. Satisfying a standard Gaussian distribution, γ rr and γ ii Initialize to γ ri γ ir Both the real and imaginary parts of β are initialized to 0; (4) Complex Activation Function Layer The activation function used in the complex activation function layer is the ReLU activation function, which is defined as f(x) = max(0,x), that is, retaining the positive part of the input value and truncating the negative value to zero. The calculation process of its complex domain is shown in formula (9), which calculates the real part of the input data respectively. and the virtual part The real and imaginary parts of the result are obtained by applying the ReLU activation function separately. Similarly, the CSigmoid activation function is shown in formula (10): Where CReLU(x) is the complex ReLU activation function, and ReLU(x) is the real ReLU activation function; Where CSigmoid(x) is the complex Sigmoid activation function, and Sigmoid(x) is the real Sigmoid activation function.

5. The time-frequency domain denoising method for EEG signals based on a noise attention mechanism according to claim 1, characterized in that, The method for denoising the noise attention module in the DS-Natt-CCUNet model in step three or four to obtain a clean time-frequency image is as follows: The input complex time-frequency image is first processed by CConv to extract preliminary complex features, and then split along the channel dimension. Inheriting the architecture of CSPNet, the features are divided into two branches: branch 1 directly retains the original complex features to maintain information integrity, while branch 2 dynamically generates a weight map through a spatial attention mechanism. In the attention branch, the features undergo double pooling operations of max pooling and average pooling to generate two types of spatial statistical descriptors. Then, the double pooling results are fused by complex convolution (CConv), and the feature distribution is dynamically adjusted by complex batch normalization (CBN) to adapt to different noise scenarios. Finally, the fused features are compressed into a spatial weight map in the range of [0,1] by complex sigmoid (CSigmoid). This weight map is multiplied point by point with the original complex features of branch 1, and finally the clean time-frequency image of the EEG signal is output.

6. A system, characterized in that, It is capable of running any of the time-frequency domain denoising methods for EEG signals based on a noise attention mechanism as described in claims 1-5.

7. A device, characterized in that, include: Memory: Used to store computer programs for implementing any of the time-frequency domain denoising methods for EEG signals based on a noise attention mechanism as described in claims 1-5; Processor: Used to implement any of the time-frequency domain denoising methods for EEG signals based on a noise attention mechanism as described in claims 1-5 when executing the computer program.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements any of the time-frequency domain denoising methods for EEG signals based on a noise attention mechanism as described in claims 1-5.

Citation Information

Patent Citations

  • Electroencephalogram signal denoising method based on double-path convolution denoising network

    CN119157556A

  • Electroencephalogram signal denoising method based on one-dimensional residual convolutional neural network

    CN109784242A

  • Feature extraction method and apparatus based on time domain and frequency domain of speech signal, and echo cancellation method and apparatus

    WO2023044962A1