Method for automatically identifying and removing eeg artifacts of multi-lead eeg signals based on cyclegan model
Through adversarial training of the generator and discriminator of the CycleGAN model, combined with cycle consistency loss and adversarial loss, eye movement artifacts in EEG signals are identified and removed, solving the problems of insufficient generalization ability and noise interference in existing technologies, and achieving efficient eye movement artifact removal and EEG signal preservation.
Patent Information
- Application Number
- CN202411633749.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-11-15
AI Technical Summary
Existing methods for removing oculoculographic artifacts from EEG signals have insufficient generalization capabilities, are highly dependent on specific conditions, and are susceptible to noise interference, resulting in insufficient accuracy and reliability of EEG data.
The CycleGAN model is used to automatically identify and remove oculoculographic artifacts from multi-lead EEG signals. Through adversarial training of the generator and discriminator, combined with cycle consistency loss and adversarial loss, oculoculographic artifacts are identified and removed. The spatial attention mechanism and residual network are added to enhance feature extraction capabilities.
It achieves efficient identification and removal of eye artifacts in complex and changeable EEG data, has strong generalization ability, strong resistance to noise interference, retains effective information of EEG signals, and is suitable for multi-lead EEG signal analysis.
Smart Images

Figure CN119564227B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of bioelectric signal processing based on generative adversarial networks, and relates to an electrooculogram artifact automatic identification and removal method for multi-lead electroencephalogram signals based on a CycleGAN model. BACKGROUND
[0002] Electroencephalogram (EEG) as an important means of monitoring brain electrical activity has immeasurable value for neuroscience research, clinical diagnosis and cognitive function assessment. However, the collection of EEG signals is easily disturbed by various endogenous and exogenous factors, which are collectively referred to as artifacts, and they significantly increase the difficulty and accuracy of data analysis. EEG artifacts include two major categories: exogenous artifacts and endogenous artifacts.
[0003] Among them, the exogenous artifacts mainly include environmental noise (such as power line interference, electromagnetic radiation), equipment factors (such as poor electrode contact, amplifier drift) and physical motion artifacts (such as head movement, electrode line shaking). Among them, power line interference usually exists in the form of 50 / 60Hz and its harmonics, which can be effectively filtered out by a specific frequency notch filter; and the artifacts caused by physical motion can be reduced by improving the fixation device and signal processing technology.
[0004] Endogenous artifacts are generated by the physiological activities of the subject, including eye movement (such as blinking, saccade), muscle activity (such as facial muscle tension, chewing), heart activity (electrocardiogram interference) and respiration, etc. Among the endogenous artifacts, electrooculogram artifacts (EOG artifacts) are particularly prominent, because the movement of the eyes will produce significant potential changes, which are particularly evident in the EEG recordings of the frontal lobe and the frontal region, seriously interfering with the interpretation of the true electrical activity of the brain.
[0005] To effectively remove EOG artifacts from EEG signals, researchers have developed a variety of methods. For example, regression-based methods attempt to regress and remove artifact components from the EEG by establishing a mathematical model between EOG artifacts and EEG signals. These methods rely on accurate artifact templates and high-quality reference signals, but obtaining these conditions is often challenging in practical applications. Adaptive filter-based methods, such as the minimum mean square error (LMS) adaptive filter, can dynamically adjust filter parameters based on the input signal to minimize artifact components in the output signal. However, the performance of adaptive filters is highly dependent on initial conditions and parameter settings, and their effectiveness in removing nonlinear and nonstationary EOG artifacts is limited. Blind source separation (BSS)-based methods, such as independent component analysis (ICA), can decompose EEG signals into multiple independent components, some of which may correspond to artifacts. By identifying and removing these artifact components, a relatively pure EEG signal can be reconstructed. However, ICA is ineffective when processing single-channel data or when artifacts overlap heavily with the EEG signal, and requires additional auxiliary channel information. Deep learning-based methods have shown great potential in recent years for EEG artifact removal due to their powerful feature extraction and pattern recognition capabilities. By training deep neural networks (such as convolutional neural networks (CNNs) and recurrent neural networks (RNNs), they can automatically learn to separate clean signals from artifact components in raw EEG signals. However, deep learning models are susceptible to adversarial examples and are sensitive to noise and small perturbations, which can lead to unstable denoising performance, especially when faced with complex and variable real-world EEG data.
[0006] Therefore, although existing methods can effectively deal with electrooculogram (EOG) artifacts under specific conditions, they generally suffer from problems such as insufficient generalization, strong dependence on specific conditions, or susceptibility to noise. Therefore, developing a method that can automatically identify and efficiently remove EOG artifacts is of great significance for improving the accuracy and reliability of EEG data. Summary of the Invention
[0007] In view of this, the purpose of the present invention is to provide a method for automatic identification and removal of electrooculogram artifacts in multi-lead EEG signals based on the CycleGAN (cyclic generative adversarial network) model, which fully learns the data distribution of processed EEG signals, identifies the corresponding EEG artifact data part, retains the useful EEG signal information in the EEG data, and effectively removes or suppresses the EEG artifacts.
[0008] In order to achieve the above object, the present invention provides the following technical solutions:
[0009] A method for automatically identifying and removing eye artifacts from multi-lead EEG signals based on a CycleGAN model, comprising the following steps:
[0010] S1. Collect the EEG signal data of the subjects and perform preprocessing;
[0011] S2. Determine whether there is an EEG signal containing eye contact artifacts in the preprocessed EEG signal data based on the distribution characteristics of eye contact artifacts in the EEG signal; extract the eye contact artifacts from the EEG signal containing the eye contact artifacts and add them to the eye contact artifact signal library; and add the EEG signal from which the eye contact artifacts have been removed to the clean EEG signal library;
[0012] S3. Randomly select an EEG signal from the clean EEG signal library, randomly select an EEG artifact from the EEG artifact signal library, add the EEG artifact to the selected EEG signal to obtain a noisy EEG signal, input the selected EEG signal and the noisy EEG signal into a CycleGAN model, and train the model;
[0013] The model includes generators G and F, as well as discriminators D_X and D_Y. Generator G is used to convert EEG signals from domain X to domain Y, and generator F is used to convert EEG signals from domain Y to domain X. Discriminator D_X is used to discriminate whether the input EEG signal is a real EEG signal from domain X or an EEG signal generated by generator F, and discriminator D_Y is used to discriminate whether the input EEG signal is a real EEG signal from domain Y or an EEG signal generated by generator G. The CycleGAN model uses a cycle consistency loss function to ensure that the EEG signals converted between domains are consistent with the original EEG signals, and uses an adversarial loss to ensure that the generated EEG signals are as close to the real EEG signals as possible.
[0014] S4. Preprocess the collected multi-lead EEG signal data and then input it into the trained CycleGAN model to remove eye artifacts from the multi-lead EEG signals.
[0015] Furthermore, step S1 specifically involves collecting EEG signals of the subject under emotion induction and EEG signals of the subject's left and right hand movement imagination.
[0016] Furthermore, in step S1, the collected EEG signals of the subjects are preprocessed, including: performing baseline correction on each collected data segment to eliminate baseline drift; performing average re-reference processing on each data segment to reduce common noise; performing detrending processing on each data segment to remove linear trends; performing band-pass filtering on each data segment to remove noise outside a specific frequency range; performing band-stop filtering on each data segment to remove power frequency noise; and extracting cleaned signal features from the EEG signal data.
[0017] Further, in step S2, according to the distribution characteristics of the eye blink artifact in the electroencephalogram signal, i.e. the eye blink artifact has obvious large amplitude potential change in time domain and short duration, whether the electroencephalogram signal contains the eye blink artifact is detected, and the process includes: setting a threshold x thre , setting the window size as N, finding the maximum value x max and the minimum value x min of the electroencephalogram signal x(t) in the window [t-N+1, t]:
[0018] x max = max{x(t-N+1), x(t-N+1), …, x(t)}
[0019] x min = min{x(t-N+1), x(t-N+1), …, x(t)}
[0020] If x max -x min >x thre , the electroencephalogram signal x(t) contains the eye blink artifact.
[0021] Further, in step S2, extracting the eye blink artifact from the electroencephalogram signal containing the eye blink artifact includes: finding the signal peak in the electroencephalogram signal as the eye blink artifact peak t peak , S(t) represents the electroencephalogram signal; finding the point from the peak to a certain signal value minimum in the eye blink duration range forward as the starting position t start , finding the point from the peak to a certain signal value minimum in the eye blink duration range backward as the ending position t end , extracting all sampling points between t start and t end and their corresponding signal values S(t i ) to obtain the eye blink artifact.
[0022] Further, in step S3, adding the eye blink artifact to the selected electroencephalogram signal to obtain the noisy electroencephalogram signal includes: calculating the mean value μ of the clean electroencephalogram signal:
[0023]
[0024] In the formula, T represents the signal length, S clean (t) represents the clean electroencephalogram signal;
[0025] calculating the minimum value E min of the eye blink artifact E(t):
[0026]
[0027] Calculate the difference Δ=μ-E min , and add the difference to the electrooculogram artifact signal to adjust the amplitude of the electrooculogram artifact signal so as to match the clean EEG signal S clean (t) matches; randomly select the insertion position t in the clean EEG signal insert , and ensure that the inserted electrooculogram artifact does not exceed the signal boundary, that is, t insert ∈[0,TL], L is the length of the electrooculogram artifact signal; after selecting the insertion position, the electrooculogram artifact is inserted into the clean EEG signal to obtain the noisy EEG signal S new (t) = S clean (t)+E adjusted (tt insert ).
[0028] Furthermore, a spatial attention mechanism module and a residual network are added to the CycleGAN model. The spatial attention mechanism module is used to enhance the feature extraction capability of the generator, and the residual network is used to more effectively train the deep neural network.
[0029] The beneficial effects of the present invention are as follows: by inputting clean EEG signals and noisy EEG signals corresponding to the clean EEG signals into the CycleGAN model for training, the model can retain the effective information in the EEG signals for other EEG signal analysis or applications, can effectively identify and remove eye artifacts in multi-lead EEG signals, and has strong generalization ability, is independent of specific conditions, and has strong resistance to noise interference.
[0030] Other advantages, objects, and features of the present invention will be described in part in the following description and, in part, will be apparent to those skilled in the art upon examination of the following description or may be learned from practice of the present invention. The objects and other advantages of the present invention may be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below with reference to the accompanying drawings, in which:
[0032] Figure 1 A schematic diagram of the CycleGAN model training and working principles provided by one embodiment of the present invention.
[0033] Figure 2 A flowchart of a method for automatically identifying and removing oculoculographic artifacts from multi-lead EEG signals using a CycleGAN model according to an embodiment of the present invention.
[0034] Figure 3A schematic diagram of the process of identifying and removing electrooculogram artifacts provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0035] The following describes the embodiments of the present invention by means of specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0036] like Figure 1 Figure 2 shows the CycleGAN model for EOG artifact recognition and removal, proposed in one embodiment of the present invention. This model is a generative adversarial network for image translation. Its core concept is to leverage adversarial training of generative adversarial networks to achieve unsupervised image-to-image translation. CycleGAN is particularly adept at image translation tasks without paired data, such as converting an image from one domain to another.
[0037] CycleGAN consists of two generators (G and F) and two discriminators (D_X and D_Y). Generator G is used to convert EEG signals from domain X to domain Y, and generator F is used to convert EEG signals from domain Y to domain X. Discriminator D_X is used to distinguish whether the input EEG signal is a real EEG signal from domain X or an EEG signal generated by generator F, while discriminator D_Y is used to distinguish whether the input EEG signal is a real EEG signal from domain Y or an EEG signal generated by generator G.
[0038] The key to CycleGAN lies in the cycle consistency loss. This loss ensures that the signals obtained when converting EEG signals from domain X to domain Y and then back to domain X are identical to the original EEG signals. For an EEG signal x from domain X, generator G generates an EEG signal G(x) from domain Y. Generator F then converts G(x) back to domain X, i.e., F(G(x)). The cycle consistency loss ensures that x and F(G(x)) are as similar as possible. Similarly, for an EEG signal y from domain Y, generator F generates an EEG signal F(y) from domain X. Generator G then converts F(y) back to domain Y, i.e., G(F(y)). The cycle consistency loss ensures that y and G(F(y)) are as similar as possible. Domain X can be considered the domain of noisy EEG signals, and domain Y can be considered the domain of noise-free EEG signals. The task of generator G is to convert noisy EEG signals into noise-free EEG signals, while the task of generator F is to convert noise-free EEG signals into noisy EEG signals. Through adversarial training, generator G learns to remove noise, while generator F learns to add noise similar to that in domain X.
[0039] CycleGAN also includes an adversarial loss, which ensures that the generated EEG signals are as realistic as possible. The discriminator D_Y is used to distinguish between real noise-free EEG signals and those generated by the generator G. The discriminator D_X is used to distinguish between real noisy EEG signals and those generated by the generator F. Generators G and F improve the quality of their generated EEG signals by competing against the discriminators D_Y and D_X, respectively.
[0040] By combining adversarial loss and cycle consistency loss, CycleGAN can effectively convert noisy EEG signals into noise-free EEG signals, that is, achieve the effect of EEG signal denoising. It can be trained without paired data, and the cycle consistency loss ensures that the generated EEG signals and the original EEG signals remain consistent after domain conversion, thereby effectively removing noise.
[0041] like Figure 2 and Figure 3 As shown in FIG, a method for identifying and removing electrooculogram artifacts in EEG signals based on a CycleGAN model is provided in one embodiment of the present invention. The method can be applied to automatically identify and remove electrooculogram artifacts in multi-lead EEG signals. The method includes the following steps:
[0042] Step 110 collects EEG signal data from the subjects, such as emotion-induced EEG signals and EEG signal data from left and right hand movement imagery; and performs unified preprocessing on the EEG signals, including baseline correction, average re-referencing, detrending, bandpass filtering, and 50 Hz notch processing. The collected data includes EEG signals recorded from multiple subjects while they watched emotion-induced videos. These videos were designed to induce different emotional states, including positive, neutral, and negative emotions. The collected EEG signals are uniformly preprocessed to facilitate subsequent processing.
[0043] The preprocessing is performed in the following order: baseline correction is performed on each data segment to eliminate baseline drift. Average re-reference processing is performed on each data segment to reduce common noise. Detrending processing is performed on each data segment to remove linear trends. Bandpass filtering is performed on each data segment to remove noise outside a specific frequency range. Band-stop filtering is performed on each data segment to remove power frequency noise. Cleaned signal features are extracted from the EEG data according to the preset preprocessing algorithm. Where C is the number of channels and N is the number of data points per channel.
[0044] 1) Baseline correction includes: calculating the average value of each channel according to the baseline correction algorithm,
[0045]
[0046] Subtract the mean value from the data of each channel to remove baseline drift:
[0047]
[0048] 2) Average re-reference includes: calculating the average value of each time point, for each time point j, calculating the average value of all channels
[0049]
[0050] The data at each time point are averaged and re-referenced. For each time point j, each channel i, the mean value of that time point is subtracted.
[0051]
[0052] 3) Detrending involves applying linear detrending methods to remove linear trends in the data to prevent long-term drift from affecting the analysis. The steps of linear detrending are:
[0053] Linear fitting: For each row x i, fit a linear model:
[0054]
[0055] Among them, t is the time index, a i and b i are the coefficients of the linear model.
[0056] Remove the fitted linear trend and obtain the detrended data:
[0057]
[0058] 4) Bandpass filtering includes setting the filter order, low-frequency and high-frequency cutoff frequencies, and sampling frequency, designing a Butterworth bandpass filter, and applying it to the data to remove noise outside a specific frequency range.
[0059] 5) Band-stop filtering includes setting the filter center frequency, quality factor, and sampling frequency, designing an IIR band-stop filter, and applying it to the data to remove power-frequency noise (usually 50 Hz).
[0060] Step 120: The processed EEG data is then used to determine whether there are electrooculogram (EOG) artifacts in the EEG signal based on their distribution characteristics (usually manifested as some obvious features that can be distinguished from EEG signals). Common electrooculogram (EOG) artifact characteristics are as follows:
[0061] ① Large amplitude changes: Electrooculogram artifacts often manifest as large amplitude changes. Compared with normal EEG activity, these changes are often more dramatic. This is because eye movements and blinking generate stronger electrical signals. Large amplitude changes can be expressed as |E(t)|>>|X(t)|, where E(t) is the electrooculogram artifact and X(t) is the EEG signal.
[0062] ② Transient events: Blink artifacts usually appear as transient spikes that last about 200-400 milliseconds. These spikes have large amplitudes and are easily identified in EEG recordings. Transient events can be represented as:
[0063]
[0064] Where Δt is the blink duration (usually 200-400 ms) and A is the amplitude of the blink artifact.
[0065] ③ Symmetry: Electrooculogram artifacts usually appear simultaneously in two electrooculogram channels (such as the electrodes around the left and right eyes) and exhibit symmetrical characteristics. This is because eye movements and blinking activities affect both eyes at the same time.
[0066] E left (t)≈Eright (t)
[0067] ④ Eye movement-related: The appearance of electrooculographic artifacts is often highly correlated with the subject's eye movements and blinking behavior. If eye movement data can be recorded synchronously, these artifacts can be easily distinguished from actual EEG signals.
[0068] Specifically, the step is to set the extreme point in the EEG signal x(t) as t i , then the extreme point is expressed as:
[0069] x(t i )=max{x(t-1),x(t),x(t+1)}or x(t i ) = min{x(t-1),x(t),x(t+1)}
[0070] Determine whether the amplitude of the extreme point is greater than the threshold x thre , if it is greater than , then there are electrooculographic artifacts in the EEG signal.
[0071] For an EEG signal x(t) within a time window [t-N+1,t], find its maximum and minimum values within the window:
[0072] x max =max{x(t-N+1),x(t-N+1),…,x(t)}
[0073] x min =min{x(t-N+1),x(t-N+1),…,x(t)}
[0074] If x max -x min >x thre , then the EEG signal x(t) contains eye artifacts.
[0075] Step 121: Extract the signal containing the electrooculogram artifacts as an electrooculogram artifact signal library. The electrooculogram artifacts mainly appear in the frontal lobe leads of the signal acquisition device. Take the electrooculogram artifact signals of the leads where the frontal lobe is located, and remove the electroencephalogram artifacts as the clean electroencephalogram signal library.
[0076] The starting and ending positions of the electrooculogram artifact can be determined by determining the maximum value in the EEG signal as the peak of the electrooculogram artifact, and then finding the minimum value of the signal before and after the peak to determine the starting and ending positions of the electrooculogram artifact. In the electrooculogram artifact signal set, the sampling point range of the electrooculogram artifact is found in the time domain, and these points are intercepted to extract the electrooculogram artifact signal. In which, let the peak position be t peak , then the peak position is through Find the point from the peak to the minimum signal value within the duration of the electrooculogram, and use it as the starting position of the electrooculogram artifact.start , then the starting position is through Find the point from the peak to the minimum signal value within the duration of the electrooculogram, and use it as the end position of the electrooculogram artifact. end , then the end position is through get.
[0077] After obtaining the starting and ending points of the electrooculogram, extract start to t end All sampling points between and their corresponding signal values S(t i ):
[0078] {t i}={t|t start ≤t≤t end}
[0079] {S(t i )}={S(t)|t start ≤t≤t end}
[0080] The corresponding electrooculogram artifact fragment is cut out from the EEG data of the electrooculogram artifact, and then the electrooculogram artifact is added to the signal of the clean EEG signal at the lead where the frontal lobe is located according to the blinking frequency. In this way, the noisy EEG signal corresponding to the clean signal is obtained. Specifically, the amplitude of the electrooculogram artifact is adjusted to match the average value of the clean EEG signal, and then random insertion is performed. Let the clean EEG signal be S clean (t), the average value μ is calculated as follows:
[0081]
[0082] Adjust the electrooculogram artifact segment, set the electrooculogram artifact segment to E(t), length to L, and calculate the minimum value E of the electrooculogram artifact min :
[0083]
[0084] Calculate the difference Δ, Δ = μ - E min , adjust the electrooculogram artifact segment to add the difference Δ:
[0085] E adjusted (t)=E(t)+Δ
[0086] Select a random insertion position, set the length of the clean EEG signal to T, and randomly select an insertion position t insert , so that the inserted fragment does not exceed the signal boundary:
[0087] t insert ∈[0,TL]
[0088] After selecting the insertion position, insert the electrooculogram artifact segment. insert ,t insert +L], there are:
[0089] S new (t) = S clean (t)+E adjusted (tt insert )
[0090] Step 130: Two one-to-one corresponding EEG signals are input into the CycleGAN model for training. The generator G of the CycleGAN model generates a de-artifacted EEG signal (domain Y) from the EEG signal containing electrooculogram artifacts (domain X), and the generator F generates an EEG signal containing electrooculogram artifacts (domain X) from the de-artifacted EEG signal (domain Y). The discriminator D_X distinguishes between the real EEG signal containing electrooculogram artifacts and the signal generated by the generator F, and the discriminator D_Y distinguishes between the real de-artifacted EEG signal and the signal generated by the generator G.
[0091] Step 131: The encoder portion of the CycleGAN model is used for feature extraction, using multiple convolutional layers to progressively extract features from the EEG signal. The generator network first extracts features from the input EEG signal. The encoder portion then downsamples these features and extracts high-level features. The residual block portion learns complex feature mappings. Finally, the decoder portion maps the features back to the EEG signal space, generating an EEG signal in the target domain. The generator network must not only transform the style of the EEG signal but also maintain the consistency of its content. When transforming a noisy signal into a clean signal, the transformed noisy signal must retain the identity characteristics of the other components of the signal. The generator network uses adversarial training to ensure that the generated EEG signal appears as realistic as possible in the target domain. The generator output is evaluated by the discriminator network to ensure the quality of the generated EEG signal. The generator network works with its corresponding generators (e.g., G and F) using a cycle consistency loss to ensure that the source domain EEG signal can be reconstructed back to the original EEG signal after two transformations (from the source domain to the target domain and then back to the source domain). This property helps preserve the structure and content of the source EEG signal. The generator network competes with the discriminator network through an adversarial loss. The generator attempts to generate realistic target domain EEG signals, making it difficult for the discriminator to distinguish between real and fake, thereby improving the quality of the generated EEG signals. The generator network is optimized by minimizing the adversarial loss and the cycle consistency loss. During training, the generator continuously adjusts its parameters to generate higher-quality EEG signals while preserving the structure and content of the source EEG signals.
[0092] Step 132: The discriminator network of the CycleGAN model is mainly used to evaluate the authenticity of the generated electroencephalogram signals, and helps the generator to improve the quality of the generated electroencephalogram signals through adversarial training. CycleGAN contains two discriminator networks, which are used to evaluate the authenticity of the source domain electroencephalogram signals and the target domain electroencephalogram signals respectively. The main task of the discriminator network is to distinguish between real electroencephalogram signals and generated electroencephalogram signals (fake electroencephalogram signals). The discriminator receives an electroencephalogram signal as input and outputs a probability value representing the probability that the input electroencephalogram signal is real. Through adversarial training, the discriminator network constantly improves its discrimination ability, which forces the generator network to constantly improve to generate more realistic electroencephalogram signals. The game between the discriminator and the generator promotes the generator to generate high-quality electroencephalogram signals.
[0093] The discriminator network is usually composed of a series of convolutional layers for extracting features of the input electroencephalogram signals. These convolutional layers help the discriminator to identify the authenticity of the electroencephalogram signals by extracting spatial features and texture information layer by layer. The last few layers of the discriminator usually include fully connected layers or convolutional layers to integrate the features extracted by the previous layers and output a binary classification result indicating whether the electroencephalogram signal is real (labeled as 1) or generated (labeled as 0). The discriminator network is trained through adversarial loss (such as binary cross-entropy loss or least squares loss). The classification accuracy of the discriminator for real electroencephalogram signals and generated electroencephalogram signals is measured through adversarial loss, and used to update the weights of the discriminator.
[0094] Step 133: The loss function of CycleGAN includes: adversarial loss (Adversarial Loss), cycle consistency loss (Cycle Consistency Loss), and identity loss (Identity Loss).
[0095] ① The adversarial loss includes generator loss (Generator Loss) and discriminator loss (Discriminator Loss). The generator loss uses the cross-entropy loss of logistic regression to measure the difference between the generated fake samples and the true labels:
[0096]
[0097] where z i is the input of the generator, and N is the number of samples.
[0098] The discriminator loss includes two parts: the loss for real samples and the loss for fake samples, which uses the cross-entropy loss of logistic regression to measure:
[0099]
[0100] where xi For real samples.
[0101] ② Cycle consistency loss is used to ensure that the image remains unchanged when mapping from one domain to another and back. This loss consists of two parts: the loss from domain A to domain B and back, and the loss from domain B to domain A and back:
[0102]
[0103] Among them, generator G is used to map from domain A to domain B, generator F is used to map from domain B to domain A, x i is a sample of domain A, y i is a sample of domain B.
[0104] ③ Identity loss is used to ensure that the input image maintains its own characteristics when passing through the generator. This loss also consists of two parts: the identity loss of domain A and domain B:
[0105]
[0106] Step 134: Incorporating an attention mechanism and residual network into the CycleGAN generator can further improve model performance, especially when processing complex EEG signals. Residual networks, by introducing residual blocks, can more efficiently train deep neural networks. The spatial attention module in the CycleGAN model primarily enhances the generator's feature extraction capabilities, thereby more effectively removing electrooculographic artifacts from EEG signals.
[0107] A typical residual block consists of the following parts:
[0108] Skip Connection: Adds the input directly to the output, forming a short-circuit path.
[0109] Convolutional layer: Usually contains two convolutional layers, each followed by batch normalization (BatchNormalization) and activation function (such as ReLU).
[0110] In the CycleGAN model, the complexity and depth of the model can be adjusted by stacking multiple residual blocks, so as to flexibly meet the needs of different tasks and data sets. The output of the residual block can be expressed as:
[0111]
[0112] Where x is the input, is the feature extracted by the convolution layer and activation function, {W i} are the weight parameters of the convolutional layer. The skip connection adds the input directly to the output, ensuring that the gradient can propagate back unhindered.
[0113] The spatial attention module in the CycleGAN model primarily enhances the generator's feature extraction capabilities, thereby more effectively removing electrooculographic artifacts from EEG signals. Spatial attention focuses on the spatial locations of feature maps. For each spatial location (H, W) in the feature map, an attention weight is generated and used to adjust the feature strength at each location. This mechanism enhances the model's focus on important locations in the image while ignoring irrelevant background information.
[0114] Through the attention mechanism, the generator can better focus on the important features in the input EEG signal and reduce the interference of irrelevant or noisy features, which helps the generator to more accurately convert EEG signals containing electrooculographic artifacts into clean EEG signals and enhance the artifact removal effect. In addition, the combination of the attention mechanism and the residual network can improve the performance of the generator and enable it to better learn complex signal conversion tasks.
[0115] In step 140, the model obtained through training in steps 130 to 134 is used to directly remove oculoculographic artifacts from the collected multi-lead data. Specifically, the collected EEG data is preprocessed in the same way and then input into the trained model to directly obtain a clean EEG signal with oculoculographic artifacts removed. Moreover, the model can retain effective information in the EEG signal for other EEG signal analysis or applications, thereby realizing end-to-end multi-lead automatic recognition and removal of oculoculographic artifacts.
[0116] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solutions, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for automatically identifying and removing eye artifacts from multi-lead EEG signals based on the CycleGAN model, characterized in that: The method comprises: collecting EEG signal data of a subject and performing preprocessing; Based on the distribution characteristics of electrooculogram artifacts in EEG signals, determine whether there are EEG signals containing electrooculogram artifacts in the preprocessed EEG signal data; extract the electrooculogram artifacts from the EEG signals containing electrooculogram artifacts and add them to the electrooculogram artifact signal library, and add the EEG signals with the electrooculogram artifacts removed to the clean EEG signal library; Among them, according to the distribution characteristics of electrooculogram artifacts in EEG signals, that is, the electrooculogram artifacts have obvious large amplitude potential changes and short duration in the time domain, the process of detecting whether the EEG signal contains electrooculogram artifacts includes: setting a threshold , set the window size to , in the window Find EEG signals The maximum value and minimum value : like , then the EEG signal Contains electrooculographic artifacts; Randomly selecting an EEG signal from the clean EEG signal library, randomly selecting an EEG artifact from the EEG artifact signal library, adding the EEG artifact to the selected EEG signal to obtain a noisy EEG signal, inputting the selected EEG signal and the noisy EEG signal into a CycleGAN model, and training the model; Adding eye artifacts to the selected EEG signal to obtain a noisy EEG signal includes: calculating the average value of the clean EEG signal : Where, Indicates the signal length, Indicates clean EEG signal; Calculating electrooculogram artifacts Minimum value of : Calculate the difference , and add the difference to the electrooculogram artifact signal to adjust the amplitude of the electrooculogram artifact signal so as to match the clean EEG signal Match; randomly select the insertion position in the clean EEG signal , and ensure that the inserted electrooculogram artifact does not exceed the signal boundary, that is , L is the length of the electrooculogram artifact signal; after selecting the insertion position, the electrooculogram artifact is inserted into the clean EEG signal to obtain the noisy EEG signal ; The model includes generators G and F, as well as discriminators D_X and D_Y. Generator G is used to convert EEG signals from domain X to domain Y, and generator F is used to convert EEG signals from domain Y to domain X. Discriminator D_X is used to discriminate whether the input EEG signal is a real EEG signal from domain X or an EEG signal generated by generator F, and discriminator D_Y is used to discriminate whether the input EEG signal is a real EEG signal from domain Y or an EEG signal generated by generator G. The CycleGAN model uses a cycle consistency loss function to ensure that the EEG signals converted between domains are consistent with the original EEG signals, and uses an adversarial loss to ensure that the generated EEG signals are as close to the real EEG signals as possible. The collected multi-lead EEG signal data is preprocessed and then input into the trained CycleGAN model to remove eye artifacts from the multi-lead EEG signals.
2. The method according to claim 1, characterized in that The collecting of the subject's EEG signal data includes collecting the subject's EEG signals under emotion induction and the subject's EEG signals of left and right hand movement imagination.
3. The method according to claim 1 or 2, characterized in that The collected EEG signals of the subjects were preprocessed, including: baseline correction for each segment of collected data to eliminate baseline drift; average re-reference processing for each segment of data to reduce common noise; detrending processing for each segment of data to remove linear trends; band-pass filtering for each segment of data to remove noise outside a specific frequency range; band-stop filtering for each segment of data to remove power frequency noise; and extracting cleaned signal features from the EEG signal data.
4. The method according to claim 1, wherein Extracting electrooculogram artifacts from an EEG signal containing electrooculogram artifacts includes: finding the signal peak in the EEG signal as the electrooculogram artifact peak , , Represents the EEG signal; find the point from the peak to the minimum signal value within the duration of the EEG signal, which is the starting position of the EEG artifact , Find the point from the peak to the minimum signal value within the duration of the electrooculogram (EOG) as the end point of the EOG artifact. , ;extract arrive All sampling points between and their corresponding signal values , and get electrooculographic artifacts.
5. The method according to claim 1, wherein A spatial attention mechanism module and a residual network are added to the CycleGAN model. The spatial attention mechanism module is used to enhance the feature extraction capability of the generator, and the residual network is used to more effectively train the deep neural network.
Citation Information
Patent Citations
SSDA-based electroencephalogram signal ocular artifact removal method
CN111543984A
Electroencephalogram data amplification method and system based on generative adversarial network model
CN116010848A