Electroencephalogram distortion detection and recovery method and equipment based on wavelet domain energy modulation
Through the wavelet domain energy modulation method, the existing EEG signal denoising method lacks biological interpretation ability and the adequacy of using prior domain knowledge is solved, and intelligent adaptive detection and recovery of various EEG distortion conditions is achieved, and the accuracy and robustness of signal processing are improved.
Patent Information
- Application Number
- CN202510242390.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-03
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2045-03-03
AI Technical Summary
The existing EEG signal denoising methods lack biological interpretation ability and the adequacy of using prior domain knowledge, resulting in limitations in the denoising effect.
The EEG distortion detection and recovery method based on wavelet domain energy modulation is adopted, and the energy spectrum is obtained through time-frequency transformation, modulation is performed based on the preset intensity threshold, wavelet coefficients are extracted, and similarity calculation and weight assignment are performed according to the characteristics of the EEG type, and finally wavelet coefficient adjustment control command is generated for signal reconstruction.
It realizes intelligent adaptive detection and recovery of various EEG distortion conditions, makes full use of the time-frequency characteristics of EEG signals, improves the accuracy and robustness of distortion detection and recovery, and improves the system's adaptability and self-regulation capabilities.
Smart Images

Figure CN119719723A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of brain-computer interface technology, and in particular to a method and device for detecting and restoring electroencephalogram distortion based on wavelet domain energy modulation. Background Art
[0002] As an important means of directly measuring brain neural activity, electroencephalography (EEG) technology has broad application prospects in medical diagnosis, brain-computer interface (BCI), cognitive function analysis and other fields. Compared with other imaging techniques (such as functional magnetic resonance imaging (fMRI), EEG has the advantages of high temporal resolution, no radiation, and simple operation, and can reflect the bioelectric activity of brain neuron groups in real time. However, since the amplitude of the EEG signal itself is extremely weak (usually in the microvolt to millivolt range), it is easily interfered by various physiological and external noise sources. Therefore, removing the mixed noise components in EEG data has always been a major challenge in this field.
[0003] Traditional EEG denoising methods mainly include data-driven statistical modeling methods based on wavelet transform, independent component analysis (ICA), empirical mode decomposition (EMD), and probabilistic framework methods such as Bayesian estimation and particle filtering. These technologies perform well in simple laboratory environments, but in real scenarios, due to the lack of modeling constraints on complex noise sources and intrinsic brain mechanisms, their denoising performance is often unsatisfactory. In recent years, with the rapid development of deep learning technology, researchers have begun to try to automatically extract features from data and predict pure EEG signals based on methods such as convolutional neural networks, recursive neural networks, and generative adversarial networks, and have achieved certain results. However, these methods either lack sufficient biological explanation capabilities or cannot fully utilize prior domain knowledge, and the denoising effect has certain limitations.
[0004] Therefore, a method is urgently needed to solve at least one of the above problems. Summary of the invention
[0005] The embodiments of the present application provide a method and device for detecting and restoring EEG distortion based on wavelet domain energy modulation, aiming to solve the problem that existing methods either lack sufficient biological interpretation ability or cannot fully utilize prior domain knowledge, and the denoising effect has certain limitations.
[0006] In a first aspect, an embodiment of the present application provides a method for detecting and restoring EEG distortion based on wavelet domain energy modulation, comprising: Acquire original EEG data and perform time-frequency transformation to obtain an energy spectrum corresponding to the original EEG data, perform modulation processing based on components in the energy spectrum that do not meet a preset intensity threshold, and obtain modulated wavelet coefficients; Extracting wavelet coefficient data corresponding to each EEG type from the wavelet coefficients according to the wavelet coefficient parameter characteristics corresponding to each EEG type; Using a preset time window to perform spectrum weighted average calculation on the wavelet coefficient data, obtaining the spectrum centroid value and the corresponding frequency change state, so as to extract the wavelet feature data of each EEG type; Acquire a preset normal feature corresponding to the EEG data, perform similarity calculation between each of the wavelet feature data and the preset normal feature, and determine a target similarity calculation result and a distortion mode feature corresponding to the target similarity calculation result according to the similarity calculation result corresponding to each of the wavelet feature data; Acquire the current operation stage corresponding to the EEG data, determine the weight value corresponding to each of the distortion pattern features according to the current operation stage, acquire the feature vector of the distortion pattern feature, and generate a comprehensive distortion feature description according to a plurality of the feature vectors and the corresponding weight values; A wavelet coefficient adjustment control instruction corresponding to the comprehensive distortion feature is obtained, and the original EEG signal is reconstructed according to the wavelet coefficient adjustment control instruction to obtain a restored EEG signal.
[0007] In a second aspect, the present application also provides an EEG distortion detection and recovery device, comprising: A coefficient acquisition module is used to acquire the original EEG data and perform time-frequency transformation, acquire the energy spectrum corresponding to the original EEG data, perform modulation processing based on the components in the energy spectrum that do not meet the preset intensity threshold, and acquire the modulated wavelet coefficients; A data extraction module, used to extract wavelet coefficient data corresponding to each EEG type from the wavelet coefficients according to the wavelet coefficient parameter characteristics corresponding to each EEG type; A state acquisition module, used to perform spectrum weighted average calculation on the wavelet coefficient data using a preset time window, obtain the spectrum centroid value and the corresponding frequency change state, so as to extract the wavelet feature data of each EEG type; A feature acquisition module, used to acquire preset normal features corresponding to the EEG data, perform similarity calculation between each of the wavelet feature data and the preset normal features, and determine a target similarity calculation result and a distortion mode feature corresponding to the target similarity calculation result according to the similarity calculation result corresponding to each of the wavelet feature data; A stage acquisition module, used to acquire the current operation stage corresponding to the EEG data, determine the weight value corresponding to each of the distortion pattern features according to the current operation stage, acquire a feature vector of the distortion pattern feature, and generate a comprehensive distortion feature description according to a plurality of the feature vectors and the corresponding weight values; The signal acquisition module is used to obtain the wavelet coefficient adjustment control instruction corresponding to the comprehensive distortion feature, reconstruct the original EEG signal according to the wavelet coefficient adjustment control instruction, and obtain the restored EEG signal.
[0008] In a third aspect, the present application further provides a computer device, comprising a processor and a memory, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the method for detecting and restoring EEG distortion based on wavelet domain energy modulation as described in the first aspect is implemented.
[0009] In a fourth aspect, the present application further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the EEG distortion detection and restoration method based on wavelet domain energy modulation as described in the first aspect.
[0010] Compared with the prior art, this application has at least the following beneficial effects: 1. Achieved intelligent adaptive detection and restoration of various EEG distortion conditions Traditional EEG distortion detection and restoration methods usually only target specific types of distortion, such as baseline drift, electromyographic interference, etc., and lack the ability to comprehensively process complex and variable distortion situations. However, the method of the present invention can adaptively detect various possible distortion modes, including distortion caused by baseline drift, abnormal cognitive processing, and changes in emotional state, by modulating the time-frequency energy spectrum of the EEG signal.
[0011] Specifically, this method first divides the time-frequency energy spectrum of the EEG signal into multiple frequency domain segments, each of which corresponds to different modulation characteristics (such as a specific frequency range and energy intensity range). Then, for the frequency domain segments that meet the modulation characteristics, their energy values are retained; for the frequency domain segments that do not meet the modulation characteristics, their energy values are modulated, thereby achieving adaptive modulation of the energy spectrum. Through this modulation processing, the frequency and energy components related to specific distortion patterns will be selectively retained or removed, thereby achieving adaptive detection of multiple distortion conditions.
[0012] In addition, the method also merges the distortion detection results into a comprehensive distortion feature description, and matches it with the preset distortion attributes to determine the specific distortion attributes corresponding to the EEG data, thereby further improving the accuracy and pertinence of distortion detection. According to the distortion attributes obtained by matching, the method can also generate control instructions to control the change of wavelet coefficients, realize adaptive recovery of EEG signals, and effectively overcome the defect of existing technologies that only recover specific distortion types.
[0013] 2. Make full use of the time-frequency characteristics of EEG signals to improve the accuracy and robustness of distortion detection and recovery Most of the existing EEG distortion detection and restoration technologies mainly work on time domain signals, which makes it difficult to effectively capture and utilize the rich time-frequency feature information of EEG signals, resulting in certain limitations on detection accuracy and restoration effects. The method of the present invention is based on the wavelet domain characteristics of EEG signals and makes full use of its time-frequency information, so it has higher distortion detection accuracy and restoration capabilities.
[0014] Specifically, this method first performs wavelet transform on the original EEG data to obtain the initial state of the corresponding wavelet coefficients, and then performs time-frequency transform on the EEG data to calculate the energy spectrum corresponding to the frequency domain signal. Wavelet transform can decompose the signal in multiple scales in both time and frequency directions, thereby effectively capturing the time-frequency characteristics of the EEG signal; while time-frequency transform can map the EEG signal to the time-frequency two-dimensional plane, making its time-frequency structure more obvious.
[0015] On this basis, this method modulates the energy spectrum and obtains the modulation results of EEG wavelet coefficients. Through methods such as time-frequency inverse transform and template matching, this method can accurately extract wavelet coefficient data of different EEG types from the modulation results, and perform distortion detection and recovery based on these wavelet feature data, thereby making full use of the rich time-frequency information of EEG signals and significantly improving the accuracy and robustness of the entire detection and recovery process.
[0016] 3. Closely integrate distortion detection and recovery processes to improve the system's adaptability and self-adjustment capabilities The existing technology usually processes EEG distortion detection and distortion recovery separately, lacks an effective feedback adjustment mechanism, and often results in unsatisfactory recovery effects. The method of the present invention closely combines the distortion detection and recovery processes, constructs a highly adaptive and self-adjusting intelligent system, and can adjust the recovery strategy in real time according to the detection results, thereby significantly improving the overall adaptability and recovery effect.
[0017] Specifically, this method first matches the specific distortion attributes corresponding to the EEG data, such as baseline drift and cognitive processing abnormalities, based on the comprehensive distortion feature description. Then, based on these matched distortion attributes, this method generates control instructions to control the change of wavelet coefficients to achieve distortion recovery. These control instructions directly act on the wavelet coefficients of the original EEG data, adjusting them to new wavelet coefficients that can offset the distortion effect, and finally reconstructing the EEG signal after distortion recovery through inverse wavelet transform.
[0018] It can be seen that this method closely combines the distortion detection process (i.e., distortion attribute matching) and the distortion recovery process (i.e., wavelet coefficient adjustment) to form a closed-loop self-regulating system. If the distortion detection finds new distortion attributes, the system will generate new wavelet coefficient control instructions accordingly and adjust the recovery strategy in real time; conversely, if the recovery effect is not ideal, the system will re-optimize the distortion detection model based on the feedback information, thus always maintaining a dynamic balance between detection and recovery, and significantly improving the adaptability and self-regulating ability of the entire system.
[0019] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A schematic diagram of a flow chart of a method for detecting and restoring EEG distortion based on wavelet domain energy modulation according to an embodiment of the present application; Figure 2 This is a schematic diagram of the structure of an EEG distortion detection and restoration device shown in an embodiment of the present application; Figure 3 A schematic diagram of the structure of a computer device shown in an embodiment of the present application. DETAILED DESCRIPTION
[0021] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0022] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0023] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0024] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0025] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0026] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0027] The technical solution of the embodiment of the present application is introduced below.
[0028] Electroencephalogram (EEG) signals are key physiological indicators that reflect the collective electrical activity of brain neurons and are widely used in clinical diagnosis, cognitive science, human-computer interaction and other fields. However, in the actual acquisition and transmission process, EEG signals are easily affected by various interferences and distortions, such as baseline drift, electromyographic interference, environmental noise, etc. These distortions will seriously reduce the quality of EEG signals and affect subsequent signal processing and analysis. Therefore, effective distortion detection and recovery of EEG signals is a key link to ensure data quality and improve analysis accuracy.
[0029] Traditional EEG distortion detection and restoration methods mainly rely on manual experience and fixed template matching, and have the following disadvantages: 1) The detection and restoration process is highly dependent on the knowledge and experience of domain experts and lacks automation and intelligent processing capabilities; 2) The use of fixed distortion templates and processing strategies cannot effectively cope with complex and changeable distortion situations; 3) They only target specific types of distortion (such as baseline drift, electromyographic interference, etc.) and lack the ability to comprehensively process multiple distortions; 4) Most methods work on time domain signals, making it difficult to capture and utilize the time-frequency characteristics of EEG signals.
[0030] In recent years, with the development of wavelet analysis, machine learning and other technologies, people have begun to try to apply these emerging technologies to the field of EEG distortion detection and restoration. Wavelet transform can decompose the signal in two directions, time and frequency, to effectively capture the time-frequency characteristics of EEG signals, laying the foundation for distortion detection and restoration. Machine learning algorithms can automatically mine the characteristic patterns of EEG distortion from a large amount of data, and realize intelligent distortion detection and restoration.
[0031] However, the existing wavelet domain and machine learning methods still have some shortcomings when applied to EEG distortion detection and restoration: 1) Most methods are limited to detecting and restoring specific types of distortion (such as baseline drift, etc.) and lack the ability to comprehensively handle multiple distortion situations; 2) Some machine learning-based methods require a large amount of manually annotated training data and are usually only effective in specific scenarios; 3) Most methods process distortion detection and distortion restoration separately and lack an effective feedback regulation mechanism; 4) Most of the existing technologies do not fully utilize the time-frequency characteristics of EEG signals, resulting in insufficient accuracy and robustness in distortion detection and restoration.
[0032] Please refer to Figure 1 , Figure 1 A flowchart of a method for detecting and restoring EEG distortion based on wavelet domain energy modulation provided in an embodiment of the present application. The method for detecting and restoring EEG distortion based on wavelet domain energy modulation in an embodiment of the present application can be applied to computer devices, including but not limited to smart phones, laptops, tablet computers, desktop computers, physical servers, cloud servers and other devices. Figure 1 As shown, the EEG distortion detection and restoration method based on wavelet domain energy modulation in this embodiment includes steps S101 to S106, which are described in detail as follows: Step S101, obtaining original EEG data and performing time-frequency transformation, obtaining an energy spectrum corresponding to the original EEG data, performing modulation processing based on components in the energy spectrum that do not meet a preset intensity threshold, and obtaining modulated wavelet coefficients.
[0033] Specifically, EEG data is usually collected by multiple sensor arrays, and each sensor collects electrical activity signals from different areas of the brain. These raw EEG data are often mixed with noise and interference from various sources, and need to be properly preprocessed before they can be used for subsequent distortion detection and recovery analysis. The preprocessing steps mainly include filtering to remove high-frequency noise and baseline correction to eliminate drift.
[0034] Filtering to remove high-frequency noise means using digital filters to remove high-frequency noise components in EEG data. These high-frequency noises may come from muscle activity, equipment interference, etc. Commonly used filters include Butterworth bandpass filters and Chebyshev filters. For example, using a 4th-order Butterworth bandpass filter with a passband frequency range set to 1-40Hz can filter out most of the high-frequency noise. After filtering, the high-frequency noise in the EEG data is effectively removed.
[0035] Baseline drift correction refers to removing the baseline drift phenomenon in EEG data. Baseline drift refers to the slow change in the average value of the EEG signal over a period of time, which may be caused by factors such as electrode displacement and skin impedance change. Linear regression fitting is usually used to estimate and eliminate this drift trend, so that the baseline of the EEG data returns to an appropriate level.
[0036] After preprocessing such as filtering and baseline correction, the quality of EEG data is improved, and noise and interference are effectively removed, laying the foundation for subsequent analysis. The preprocessed EEG data can be represented as a matrix X, where each row corresponds to a time point and each column corresponds to a sensor channel, that is, X(t,c) represents the EEG amplitude value at time t and channel c.
[0037] At the same time, the application also needs to obtain the initial state W0 of the wavelet coefficients corresponding to the EEG data as a reference baseline for distortion detection. Wavelet transform is a time-frequency analysis tool that can decompose EEG signals into wavelet coefficients of different scales, which can well capture the mutation and slight distortion characteristics of EEG signals.
[0038] The basic idea of wavelet transform is to project the signal onto a set of wavelet basis functions to obtain the corresponding wavelet coefficients. Commonly used wavelet bases include Haar wavelet, Daubechies wavelet, Coiflet wavelet, etc. For discrete signals, this application uses discrete wavelet transform (DWT). Let the selected wavelet basis be ψ(t), and perform wavelet decomposition of scale s on the EEG data X(t), and we can get: W(s,t) = 1 / √s ∫X(τ)ψ((τ-t) / s)dτ.
[0039] Where W(s, t) is the wavelet coefficient at scale s and time t. Through wavelet decomposition of different scales s, the present application can obtain multi-scale wavelet coefficients W(s, t, c), where s is a discrete scale sequence, t is a time sequence, and c is a channel sequence. The wavelet coefficients of all scales are recorded as W0(s, t, c), which is the initial state of the wavelet coefficients corresponding to the EEG data.
[0040] Wavelet coefficients can well capture the mutation and slight distortion characteristics in EEG signals. This is because the wavelet basis function ψ(t) itself has a localized property and can effectively characterize the local characteristics of the signal. For example, when the EEG signal mutates, the wavelet coefficients will produce a large amplitude value at the corresponding time and scale, so that the abnormality of the signal can be detected. However, the traditional Fourier transform does not have a localized property because the basis function is the sine and cosine of the entire time domain, and cannot effectively capture the local abnormal characteristics of the signal. Therefore, the wavelet transform has unique advantages in processing non-stationary signals (such as EEG).
[0041] Next, this application needs to perform a time-frequency transform on the EEG data to obtain a frequency domain signal and calculate the energy spectrum corresponding to the frequency domain signal. Time-frequency transform is a method of converting a time domain signal to the frequency domain, and the short-time Fourier transform (STFT) is commonly used. STFT applies a sliding window function to the time domain signal and calculates the Fourier transform of the signal in each time segment, thereby obtaining a spectrum diagram on the time-frequency two-dimensional plane.
[0042] Specifically, the STFT transform includes the following steps: 1. Apply an appropriate window function w(t) to the time-domain EEG signal X(t) to obtain the windowed signal x(t)w(t-τ). The role of the window function is to divide the entire signal into overlapping small segments, each of which can be approximately regarded as stationary. Commonly used window functions include Gaussian window, Hamming window, etc.
[0043] 2. Calculate the Fourier transform of the windowed signal and obtain the value of the STFT at time τ and frequency f: STFT(τ, f) = ∫x(t)w(t-τ)e^(-j2πft)dt.
[0044] 3. Slide the window w(t) and repeat steps 1) and 2) to obtain all the values of STFT at time t and frequency f, STFT(t,f).
[0045] Through STFT transformation, the present application can obtain the energy distribution of EEG data in the time-frequency domain, namely, the energy spectrum. The energy spectrum can be used to reflect the energy intensity of EEG signals in different frequency bands, which is of great significance for detecting and classifying different types of brain electrical activities. Assuming that the energy spectrum of EEG data X is E(t,f), then: E(t,f) = |STFT(X)(t,f)|^2 = |∫X(τ)w(τ-t)e^(-j2πfτ)dτ|^2.
[0046] That is, the energy spectrum E(t,f) is the square modulus of the STFT coefficient, which reflects the energy of the EEG signal at time t and frequency f. The calculation of the energy spectrum is affected by the window function w(t), and different window functions will lead to differences in time resolution and frequency resolution. For example, a narrower Gaussian window can obtain better time resolution, but poorer frequency resolution; a wider window function has poorer time resolution and better frequency resolution. Therefore, the choice of window function needs to balance the requirements of time resolution and frequency resolution according to the specific application scenario. Generally speaking, for applications that need to capture instantaneous EEG activity, a narrower window function is more suitable.
[0047] The so-called modulation features refer to some characteristics that can reflect the distortion or abnormality of EEG signals, which are usually closely related to the energy intensity of the energy spectrum.
[0048] In some embodiments, the modulation processing is performed on the components that do not meet the preset intensity threshold in the energy spectrum to obtain the modulated wavelet coefficients, including: dividing the high-energy intensity frequency domain segments corresponding to the first modulation feature and the medium-energy intensity frequency domain segments corresponding to the second modulation feature based on the energy spectrum; modulating the components that do not meet the preset intensity threshold in the high-energy intensity frequency domain segments and the medium-energy intensity frequency domain segments to obtain the modulated wavelet coefficients.
[0049] This application defines two modulation features. The first modulation feature corresponds to alpha waves (8-13Hz) and high energy intensity areas, and the second modulation feature corresponds to beta waves (13-30Hz) and medium energy intensity areas. The specific frequency range and energy intensity range need to be set according to the actual application scenario and prior knowledge. The purpose of setting the modulation feature is to selectively retain or remove the frequency and energy components related to specific EEG abnormalities in subsequent modulation processing. For each modulation feature, this application needs to divide the corresponding frequency domain segment on the energy spectrum E(t,f).
[0050] Exemplarily, the modulation processing of the components in the high-energy intensity frequency domain segment and the medium-energy intensity frequency domain segment that do not meet the preset intensity threshold includes: performing a first modulation processing on the components in the high-energy intensity frequency domain segment that do not meet the preset intensity threshold; and performing a second modulation processing on the components in the medium-energy intensity frequency domain segment that do not meet the preset intensity threshold.
[0051] Assuming that the frequency range corresponding to the first modulation feature is [f1_min, f1_max], and the energy intensity range is [E1_min, E1_max]. The present application can traverse the entire energy spectrum E(t,f), find all (t,f) points that satisfy f1_min ≤ f ≤ f1_max and E1_min ≤ E(t,f) ≤ E1_max, and classify them as the first high energy intensity frequency domain segment S1 corresponding to the first modulation feature. Similarly, assuming that the frequency range corresponding to the second modulation feature is [f2_min, f2_max], and the energy intensity range is [E2_min, E2_max], the present application can find all (t,f) points that satisfy f2_min ≤ f ≤ f2_max and E2_min ≤ E(t,f) ≤ E2_max, and classify them as the second medium energy intensity frequency domain segment S2 corresponding to the second modulation feature. In this way, the present application divides the energy spectrum E(t, f) into two non-overlapping frequency domain segments S1 and S2, which correspond to the first modulation feature and the second modulation feature, respectively.
[0052] For the point (t, f) in the first high energy intensity frequency domain segment S1, if E(t, f) does not meet the preset energy intensity threshold T1, the energy value of the point is set to 0, that is, the first modulation process is performed. For the point (t, f) in the second medium energy intensity frequency domain segment S2, if E(t, f) does not meet the preset energy intensity threshold T2, the energy value of the point is set to 0, that is, the second modulation process is performed. Assuming that the energy intensity threshold of the first modulation feature is T1 and the energy intensity threshold of the second modulation feature is T2, the modulation process can be expressed as: For (t,f) belongs to S1: if E(t,f) ≥ T1, then E'(t,f) = E(t,f); otherwise E'(t,f) = 0; For (t,f) belongs to S2: if E(t,f) ≥ T2, then E'(t,f) = E(t,f); Otherwise E'(t,f) = 0; Among them, E'(t,f) is the energy spectrum after modulation processing. Through the above modulation processing, the present application can selectively retain or remove the frequency and energy components related to specific EEG abnormalities, thereby facilitating the subsequent wavelet coefficient feature extraction and distortion detection.
[0053] It should be noted that the parameters of the modulation processing, including the frequency range and energy intensity range of the modulation feature, and the corresponding energy intensity thresholds T1 and T2, need to be set and adjusted according to the specific application scenario and prior knowledge. Generally speaking, these parameters can be obtained by statistical analysis and cross-validation of a large amount of training data. In addition, the above modulation processing describes the situation of two modulation features. In practical applications, this application can also introduce more types of modulation features as needed, so as to perform more refined processing of EEG data.
[0054] After the above modulation processing, the present application obtains the modulated energy spectrum E'(t,f). Next, the present application needs to convert E'(t,f) back to the time domain to obtain the modulation result of the wavelet coefficients corresponding to the EEG data. This step can be achieved by performing an inverse STFT transform on E'(t,f), and the specific process is as follows: 1. Calculate the analytical signal of E'(t,f) Z(t,f) = E'(t,f) + jH(E'(t,f)) where H(·) represents the Hilbert transform.
[0055] 2. Perform an inverse STFT transform on Z(t,f) to obtain the time domain signal z(t): z(t) = ∫Z(t,f)e^(j2πft)df.
[0056] 3. Apply the original window function w(t) to z(t), that is, x'(t) = z(t)w(t).
[0057] 4. Perform wavelet transform on x'(t) to obtain the modulation result W'(s, t, c) of the wavelet coefficients corresponding to the EEG data.
[0058] Through the above steps, the present application completes the entire energy spectrum modulation processing, and maps the modulation result back to the wavelet coefficient domain, thereby obtaining the modulation result W'(s, t, c) of the EEG wavelet coefficients.
[0059] Step S102: extracting wavelet coefficient data corresponding to each EEG type from the wavelet coefficients according to the wavelet coefficient parameter features corresponding to each EEG type.
[0060] Specifically, for each scale s, the present application performs an inverse wavelet transform on W'(s, t, c) at time t and channel c to obtain the reconstruction coefficient C(s, t) at scale s, where C(s, t) = ∑cW'(s, t, c) ψc(t), ψc(t) is the wavelet basis function corresponding to channel c. Next, the reconstruction coefficients C(s, t) of all scales s are subjected to an inverse wavelet transform to obtain the time domain signal x'(t), that is, x'(t) = ∑s∑kC(s, k)φ(t-k2^s), where φ(t) is the scale function. In this way, the present application converts the wavelet coefficient modulation result W'(s, t, c) back to the time domain signal x'(t).
[0061] In some embodiments, the wavelet coefficient data corresponding to each EEG type is extracted from the wavelet coefficients according to the wavelet coefficient parameter characteristics corresponding to each EEG type, including: performing an inverse time-frequency transform on the wavelet coefficients; obtaining the wavelet coefficient parameter characteristics corresponding to each EEG type; and extracting the corresponding wavelet coefficient data from the inversely transformed wavelet coefficients according to each of the wavelet coefficient parameter characteristics.
[0062] After having the time domain signal x'(t), the present application can extract the wavelet coefficient data of different EEG types from x'(t) based on the wavelet coefficient parameter characteristics corresponding to various EEG types. Different types of EEG often correspond to different parameter characteristics such as frequency range, energy distribution and time pattern, which can be obtained by performing time-frequency analysis on x'(t). For example, the present application can perform a short-time Fourier transform (STFT) on x'(t) to obtain a time-frequency spectrum STFT(t,f); or perform a wavelet transform on x'(t) to obtain wavelet coefficients W(s,t) of different scales. According to prior knowledge, different types of EEG will show characteristic patterns on STFT(t,f) or W(s,t), so the present application can classify EEG types based on these patterns.
[0063] Assuming that this application needs to divide EEG into K categories, namely EEG1, EEG2, ..., EEGK, then this application can first construct K template features, each template feature corresponds to an EEG type, for subsequent matching and classification. Suppose the template feature of the kth category EEG is Tk(t,f) or Tk(s,t), which can be obtained by statistical learning of a large amount of labeled EEG data, or it can be manually designed based on prior knowledge. With these template features, this application can calculate the similarity between x'(t) and each template feature, and classify x'(t) as the EEG type that is most similar to it. The calculation of similarity can use a variety of methods such as Euclidean distance, correlation coefficient, mutual information, etc. For example, if this application uses STFT as a feature, the similarity calculation can be expressed as: sim(k) = ∑t∑f|STFT(x')(t,f) - Tk(t,f)|^2.
[0064] Then x'(t) will be classified as the EEG type with the smallest sim(k) value. Similarly, if the present application uses wavelet coefficients as features, the similarity calculation can be changed to: sim(k) = ∑s∑t|W(x')(s,t) - Tk(s,t)|^2.
[0065] Through the above method, the present application can classify the time domain signal x'(t) into K different EEG types. For each type of EEG, the present application can extract the wavelet coefficient data of this type of EEG from x'(t) based on its corresponding template feature Tk(t,f) or Tk(s,t). For example, for the kth type of EEG, the present application can construct a mask Mk(t,f) or Mk(s,t), where Mk(t,f)=1 when the similarity between the point (t,f) and Tk(t,f) is high enough, otherwise it is 0; the definition of Mk(s,t) is similar. Then, the present application can obtain the wavelet coefficient data Wk(s,t,c) of the kth type of EEG by multiplying the STFT or wavelet coefficient of x'(t) with Mk(t,f) or Mk(s,t): Wk(s,t,c) = W(x')(s,t,c) * Mk(s,t) (using wavelet coefficients as features) or Wk(s,t,c) = STFT^-1(STFT(x')(t,f) * Mk(t,f)) (using STFT as features).
[0066] Where STFT^-1 represents the inverse transformation of the STFT result to obtain the data in the wavelet coefficient domain. In this way, the present application successfully extracts the wavelet coefficient data Wk(s, t, c) corresponding to different EEG types from the modulation result x'(t), and obtains the classified wavelet coefficient data of each EEG type.
[0067] Step S103, using a preset time window to perform spectrum weighted average calculation on the wavelet coefficient data, obtaining the spectrum centroid value and the corresponding frequency change state, so as to extract the wavelet feature data of each EEG type.
[0068] Specifically, the frequency change state of the wavelet coefficients of each EEG type is analyzed by the method of spectral centroid, and the wavelet feature data is extracted based on this. First, this application needs to set a time window tw for local analysis of the wavelet coefficient data. The length of the time window tw can be set according to the specific application scenario, and usually needs to meet two conditions: one is that it is long enough to capture the important time pattern of the EEG signal; the other is that it cannot be too long, so as to avoid the signal in the window from losing stability. A common practice is to use a sliding window method, that is, to analyze a time segment of length tw each time, and then slide the window to the next time segment, and so on, so as to achieve full coverage analysis of the entire time series.
[0069] In some embodiments, the method of using a preset time window to perform spectral weighted averaging calculation on the wavelet coefficient data to obtain a spectral centroid value and a corresponding frequency change state to extract wavelet feature data of each EEG type includes: performing the weighted averaging calculation on each wavelet coefficient data according to the preset time window to obtain the spectral centroid value; obtaining the frequency change state corresponding to each spectral centroid value; and extracting the wavelet feature data in the frequency change state.
[0070] For each wavelet coefficient data Wk(s, t, c) in each time window tw, the present application can calculate its spectral center of gravity at each scale s, namely: Ck(s) = ∑t∑c|Wk(s,t,c)|^2 * f(s) / ∑t∑c|Wk(s,t,c)|^2.
[0071] Where f(s) is the frequency corresponding to scale s, and |Wk(s,t,c)|^2 is the energy of the wavelet coefficient. This formula actually performs a weighted average of each frequency component, with the weight being the energy of the frequency component, to obtain a "center of gravity" value Ck(s) representing the overall frequency distribution. It should be noted that the scale-frequency mapping relationship f(s) corresponding to different wavelet basis functions is different, so a specific mapping formula needs to be used in actual calculations. For example, for the Morlet wavelet, f(s) = Fc / (s*dt), where Fc is the center frequency of the wavelet and dt is the sampling interval.
[0072] After obtaining the spectral center of gravity Ck(s) at each scale s, the present application can further calculate the comprehensive spectral center of gravity within the entire time window tw, that is: Qk = ∑s∑t∑c|Wk(s,t,c)|^2 * Ck(s) / ∑s∑t∑c|Wk(s,t,c)|^2.
[0073] The center of gravity Qk of the integrated spectrum reflects the overall frequency distribution of the EEG type k in the current time window tw, and its size is closely related to the frequency change state of the EEG. Generally speaking, if the Qk value is large, it means that the frequency component of the EEG type tends to be high frequency; otherwise, it tends to be low frequency. By tracking the change trend of Qk, the present application can monitor the rise or fall of the EEG frequency, and then infer potential abnormalities or distortions. For example, the present application can set a threshold interval [Q_min, Q_max]. If Qk is outside this interval for a long time, it may mean that the EEG frequency has changed abnormally.
[0074] According to the above spectrum centroid analysis results, this application can extract the wavelet feature data corresponding to each EEG type. One method is to use the comprehensive spectrum centroid Qk, the spectrum centroid of each scale Ck(s), the wavelet coefficient energy ∑t∑c|Wk(s,t,c)|^2, etc. as features for each time window tw to construct a feature vector Fk: Fk = [Qk, Ck(1), Ck(2), ..., Ck(S), Ek(1), Ek(2), ..., Ek(S)].
[0075] Where Ek(s) = ∑t∑c|Wk(s,t,c)|^2 represents the total energy of the wavelet coefficients on scale s. In this way, the present application can capture the frequency distribution characteristics, energy characteristics and other important features of EEG type k in the current time window tw, thereby comprehensively describing its frequency change state. By cascading the feature vectors Fk in multiple consecutive time windows tw, the wavelet feature data sequence corresponding to the EEG type k can be obtained for subsequent distortion detection and recovery.
[0076] Step S104, obtaining the preset normal features corresponding to the EEG data, performing similarity calculation between each wavelet feature data and the preset normal features, and determining the target similarity calculation results and the distortion mode features corresponding to the target similarity calculation results according to the similarity calculation results corresponding to each wavelet feature data.
[0077] Specifically, before performing distortion detection and recovery, this application needs to first clarify the application scenario corresponding to the current EEG data, including the type of application and the specific mode of data processing. This is because different application scenarios have different requirements for EEG signals, and the same EEG signal may be judged as normal or abnormal in different scenarios. For example, in sleep monitoring applications, alfa waves (8-13Hz) are a normal phenomenon; but in tasks that require concentration, the appearance of alfa waves may mean that attention is distracted. Therefore, this application needs to perform targeted distortion detection and recovery processing on EEG signals based on specific application scenarios.
[0078] In some embodiments, obtaining the preset normal features corresponding to the EEG data includes: obtaining the application type and data processing method corresponding to the EEG data; and obtaining the preset normal features according to the application type and data processing method.
[0079] Assume that the system of the present application supports N different applications, such as sleep monitoring, attention detection, emotion analysis, etc., and each application may have multiple data processing modes, such as real-time mode, offline mode, etc. The present application can configure a unique ID for each application and mode, such as (app_id, mode_id), and maintain a lookup table to match the (app_id, mode_id) corresponding to the current EEG data with the pre-set normal EEG mode. A possible matching strategy is that the present application can collect a large number of labeled normal EEG data samples, train a normal EEG mode for each (app_id, mode_id) situation, and store it in the lookup table. In actual application, the present application can search for the corresponding (app_id, mode_id) according to the metadata of the current EEG data (such as acquisition time, device information, etc.), and then take out the corresponding normal EEG mode from the lookup table as a reference for distortion detection.
[0080] Assume that the application and mode corresponding to the current EEG data are (app_id_curr, mode_id_curr), and the present application takes out the corresponding normal EEG mode N_curr from the lookup table. The normal EEG mode N_curr can be a wavelet feature sequence, which contains the wavelet feature data of the normal EEG in different time windows tw, and is used to characterize its frequency distribution and change trend and other characteristics. In the step, the present application has extracted the wavelet feature data F1, F2, ..., FK corresponding to K different EEG types in each time window tw of the current EEG data. Next, the present application needs to calculate the similarity between each EEG type wavelet feature data and the normal EEG mode N_curr, so as to determine whether the current EEG data is distorted or abnormal.
[0081] In this similarity calculation method, the present application first needs to select a suitable kernel function k(x,y) for Fk(tw) and N_curr(tw) to measure the similarity between two vectors x and y. Common kernel functions include Gaussian kernel, polynomial kernel, Laplace kernel, etc., each of which has different properties and advantages and disadvantages. Considering the nonlinear and non-stationary characteristics of EEG data, the present application recommends the use of Gaussian kernel function, which is defined as k(x,y) = exp(-||xy||_2^2 / (2*sigma^2)), where sigma is the kernel bandwidth parameter, which controls the smoothness of the kernel function. Smaller sigma values will make the kernel function sharper and more localized, reflecting the subtle differences in the data; while larger sigma values will make the kernel function smoother, reflecting the general trend of the data. In practical applications, the value of sigma often needs to be optimized through methods such as cross-validation to obtain the best similarity calculation performance. Once the kernel function k(x,y) is determined, the application can calculate the kernel similarity between Fk(tw_i) at time window tw_i and N_curr(tw_j) at time tw_j, that is, K_kn(i,j) = k(Fk(tw_i), N_curr(tw_j)). In this way, the application obtains a kernel matrix K_kn, in which each element K_kn(i,j) reflects the similarity between Fk and N_curr at different time points.
[0082] Next, this application needs to normalize K_kn to obtain the comprehensive similarity between Fk and N_curr over the entire time series. Assuming that this application adopts the linear kernel normalization method, the idea is to first calculate the column vector and row vector of K_kn, and then use these vectors to normalize K_kn so that the sum of the elements in each column or row is 1. Specifically, let the sum of the column vectors of K_kn be n and the sum of the row vectors be m, then the normalized kernel matrix is K_kn' = D_n^(-1 / 2) * K_kn * D_m^(-1 / 2), where D_n and D_m are diagonal matrices with diagonal elements n and m, respectively. After this normalization process, each element of K_kn' is in the interval [0,1], reflecting the relative similarity between Fk and N_curr at different time points. In order to obtain the comprehensive similarity between Fk and N_curr over the entire time series, the application can calculate the Frobenius norm of K_kn', that is, sim = ||K_kn'||_F = sqrt(sum(sum(K_kn'.^2))). Obviously, when Fk is completely consistent with N_curr, sim will reach the minimum value of 0; conversely, when the two are very different, the sim value will become larger.
[0083] According to this similarity value, the present application can determine whether the current EEG type k is distorted or abnormal. Generally speaking, if the sim value is small, it means that the energy distribution of Fk is very similar to that of the normal mode N_curr, and the EEG type is considered to be in a normal state; on the contrary, if the sim value is large, it means that the energy distribution of the two is very different, which may mean that the EEG type is distorted or abnormal.
[0084] In the above steps, the present application has calculated the similarity sim_k between each EEG type wavelet feature data Fk and the preset normal mode N_curr, and obtained a similarity sequence sim_1, sim_2, ..., sim_K, where K is the total number of EEG types. Next, the present application needs to determine whether the current EEG data is distorted or abnormal based on these similarity results. If so, it is necessary to further match the corresponding specific distortion pattern characteristics. To this end, the present application first needs to set a similarity threshold thresh_k for each EEG type k. When sim_k>thresh_k, it is considered that the type of EEG is distorted or abnormal. The setting of the threshold thresh_k needs to be based on the specific application scenario and the characteristics of the EEG type, and can be obtained by statistical analysis of a large amount of labeled data. Generally speaking, for those EEG types that are more sensitive to distortion, the present application will set a smaller threshold to improve the sensitivity of distortion detection; for those EEG types that are not very sensitive to distortion, the present application can appropriately relax the threshold to reduce the false alarm rate. For example, in a sleep monitoring application, the present application may set a larger threshold for slow-wave sleep (0.5-4Hz) because this type of EEG is not very sensitive to some slight distortions; while for rapid eye movement sleep (12-16Hz), the present application needs to set a smaller threshold because it is often more sensitive to distortions.
[0085] After determining the threshold thresh_k for each EEG type k, the present application can traverse the entire similarity sequence sim_1, sim_2, ..., sim_K, and select those similarity results that meet the condition sim_k>thresh_k. Assuming that there are M EEG types of similarity results that meet this condition, the present application records their corresponding EEG type indexes idx_1, idx_2, ..., idx_M, and the corresponding similarity values sim_idx_1, sim_idx_2, ..., sim_idx_M. Next, the present application needs to match the corresponding distortion pattern features based on these selected similarity results. The so-called distortion pattern feature refers to the frequency, energy, time pattern and other features that can reflect the EEG signal under specific distortion conditions. It is the key basis for distortion detection and recovery. In practical applications, the present application usually needs to collect and annotate a large number of distorted EEG data samples in advance for different application scenarios, and then perform feature extraction and modeling on these samples to obtain a series of distortion pattern feature templates. These distortion pattern feature templates can be based on different feature representation methods, such as wavelet features, spectral features, nonlinear features, etc., or they can be a fusion representation of multiple features. Regardless of the feature representation method used, the key is to ensure that these distortion pattern feature templates can accurately depict the characteristics of EEG signals under different distortion conditions, and there is a certain degree of distinction between them for subsequent matching and classification.
[0086] Assume that the present application has already constructed a template library containing L distortion mode feature templates in advance for the current application scenario, denoted as {T_1, T_2, ..., T_L}. Each template T_i is a vector with the same dimension as the EEG type wavelet feature data Fk, which is used to describe the characteristic pattern of the EEG signal under the i-th distortion mode. Next, the present application needs to match the selected M similarity results sim_idx_1, sim_idx_2, ..., sim_idx_M with these distortion mode feature templates to determine which distortion mode feature each of them corresponds to. The matching method can be the nearest neighbor matching based on the distance metric, or the classifier matching based on the kernel function or probability model, or other more complex matching algorithms. Here, the present application takes the support vector machine (SVM) classifier based on the kernel function as an example to introduce a possible matching scheme.
[0087] First, the application needs to extract the corresponding EEG type wavelet feature data from the M similarity results, namely F_idx_1, F_idx_2,..., F_idx_M. Then, the application constructs a new feature matrix X containing these M feature data and L distortion pattern feature templates, where each row of X represents a feature vector. Next, the application needs to construct a binary classification SVM model for each distortion pattern feature template T_i, namely SVM_i, and take X as input to train each SVM_i. During the training process, the application needs to select a suitable kernel function, such as a Gaussian kernel, a polynomial kernel, etc., and adjust the corresponding kernel parameters to obtain the best classification performance. After training, the application can use these SVM_i models to classify F_idx_1, F_idx_2,..., F_idx_M to determine which distortion pattern feature they each belong to. Specifically, for each F_idx_j (j=1,2,...,M), the present application inputs it into L SVM_i models to obtain L classification results y_ij, where y_ij represents the probability value of F_idx_j being classified as the i-th type of distortion pattern feature by SVM_i. The present application selects the distortion pattern feature category corresponding to the maximum value of y_ij as the matching result of F_idx_j. In other words, if there is a certain k such that y_kj = max{y_ij}, then the distortion pattern feature corresponding to F_idx_j is considered to be T_k.
[0088] Step S105, obtaining EEG data corresponding to the current operation stage, determining the weight value corresponding to each distortion pattern feature according to the current operation stage, obtaining a feature vector of the distortion pattern feature, and generating a comprehensive distortion feature description according to multiple feature vectors and corresponding weight values.
[0089] Specifically, the present application has determined the distortion pattern feature category existing in the current EEG data based on the matching results between the EEG type wavelet feature data and the distortion pattern feature template. However, in different application scenarios and data processing modes, the influence of the same distortion pattern feature on the EEG signal may be different. Therefore, the present application needs to assign a suitable weight value to each distortion pattern feature according to the specific application scenario and processing mode to reflect its importance in the current operation stage. Assuming that the application corresponding to the current EEG data is app_curr and the data processing mode is mode_curr, the present application can query a pre-established weight lookup table and determine the operation stage stage_curr of the current EEG data processing according to (app_curr, mode_curr). This operation stage stage_curr reflects the specific links of EEG data processing, such as data acquisition, preprocessing, feature extraction, classification and recognition, etc. Different operation stages have different requirements for EEG signals, so the influence of the same distortion pattern feature in different operation stages is also different.
[0090] Exemplarily, the acquiring of the EEG data corresponding to the current operation stage includes: acquiring the current operation stage according to the application type and the data processing method.
[0091] In order to quantify the importance of each distortion pattern feature in the current operation stage, the present application can pre-set a weight value w_ij for each distortion pattern feature category i and each operation stage j, which is used to indicate the importance of the i-th type of distortion pattern feature in the j-th operation stage. These weight values w_ij can be obtained by statistical analysis of a large amount of training data, or can be set based on the experience and knowledge of experts. Generally speaking, if a certain distortion pattern feature has a greater impact on the EEG signal in a certain operation stage, the present application will assign a larger weight value to it; conversely, if the distortion pattern feature has a smaller impact on the current operation stage, the present application will assign a smaller weight value. For example, in the EEG data collection stage, the present application may assign a larger weight value to those distortion pattern features related to baseline drift, electromyographic interference, etc., because these distortion pattern features will seriously affect the data quality; while for those distortion pattern features related to cognitive processing or emotional state, the present application can assign a smaller weight value, because their impact in the data collection stage is not significant. On the contrary, in the EEG classification and recognition stage, the present application may need to assign larger weight values to distortion pattern features related to cognitive processing or emotional state, because these distortion pattern features will directly affect the accuracy of the classification results.
[0092] Assume that the present application has pre-set a series of weight values w_ij for the current (app_curr, mode_curr) scenario, where i is the distortion mode feature category index and j is the operation stage index. In the step, the present application matches M distortion mode feature categories idx_1, idx_2, ..., idx_M, corresponding to M EEG type wavelet feature data F_idx_1, F_idx_2, ..., F_idx_M. Next, the present application needs to determine the corresponding distortion detection weight values for these M distortion mode feature categories according to the current operation stage stage_curr. Specifically, for the mth distortion mode feature category idx_m (m=1,2,...,M), the present application can query the weight table and take out w_idx_m, stage_curr as its corresponding distortion detection weight value, recorded as weight_m. In this way, the present application obtains M distortion detection weight values weight_1, weight_2, ..., weight_M, corresponding to F_idx_1, F_idx_2, ..., F_idx_M respectively. Obviously, these weight values reflect the importance of different distortion mode features in the current operation stage. The larger the weight_m value, the greater the influence of the mth distortion mode feature on the current EEG data processing, and the more attention and concern the present application needs to pay to it.
[0093] First, for the m-th distortion mode feature F_idx_m, the present application can normalize it to obtain a standardized feature vector F'_idx_m = F_idx_m / ||F_idx_m||. Where ||·|| represents the Euclidean norm. Then, the present application uses the weight value weight_m determined in the step to calculate the new feature vector P_idx_m = weight_m * F'_idx_m of the m-th distortion mode feature in the current operation stage stage_curr. Through this weighted processing, the present application realizes the distinction of the importance of different distortion mode features in the current operation stage. The larger the weight value, the greater the influence of the distortion mode feature on the current operation stage, and the larger the component value in the corresponding new feature vector P_idx_m. Repeating the above process, the present application can obtain M new feature vectors P_idx_1, P_idx_2, ..., P_idx_M, which respectively correspond to the weighted feature representations of the M distortion mode features in the current operation stage stage_curr. Next, the present application needs to fuse these M new feature vectors to obtain a comprehensive distortion feature description F_final. The fusion method can be a simple vector cascade or a more complex nonlinear fusion method, such as a kernel method, a deep neural network, etc. Here, the present application adopts a nonlinear fusion method based on a kernel function, and the specific steps are as follows: First, the present application selects a suitable kernel function k(x,y), such as a Gaussian kernel k(x,y) = exp(-||xy||^2 / (2sigma^2)). Where sigma is the kernel bandwidth parameter, which controls the smoothness of the kernel function. Generally, sigma needs to be optimized through methods such as cross-validation to obtain the best fusion performance. Next, the present application constructs a MM kernel matrix K, where K(i,j) = k(P_idx_i, P_idx_j). Obviously, K is a symmetric semi-positive definite matrix that can better characterize the similarity between P_idx_i and P_idx_j. In order to obtain the fused comprehensive distortion feature description F_final, the present application can perform feature decomposition on K, extract the feature vectors corresponding to its largest d eigenvalues, and concatenate them into a new feature vector, namely F_final = [v_1, v_2, ..., v_d]^T. Where v_i is the feature vector corresponding to the i-th largest eigenvalue of K, and d is the feature dimension selected by the present application, which needs to be set according to the specific application scenario. Through this kernel feature extraction method, the present application realizes the nonlinear fusion of M new feature vectors P_idx_1, P_idx_2, ..., P_idx_M, and obtains the comprehensive distortion feature description F_final that reflects the EEG distortion state in the current operation stage stage_curr.It should be noted that when constructing the kernel matrix K, the present application can also introduce other prior knowledge, such as the correlation and hierarchical structure between the distortion pattern features, so as to obtain a more reasonable kernel function and improve the fusion effect. For example, the present application can construct a weighted kernel matrix K_w, where K_w(i,j) = w_ij * k(P_idx_i, P_idx_j). Where w_ij is the correlation weight between the i-th and j-th distortion pattern features, reflecting the degree of correlation between them. Obviously, when w_ij is large, the value of K_w(i,j) is also large, indicating that P_idx_i and P_idx_j should be given a larger weight when fused; conversely, when w_ij is small, the value of K_w(i,j) is also small, indicating that P_idx_i and P_idx_j have a lower weight when fused. In this way, the present application introduces the correlation between the distortion pattern features into the construction of the kernel matrix, thereby obtaining a more reasonable comprehensive distortion feature description F_final.
[0094] Step S106, obtaining a wavelet coefficient adjustment control instruction corresponding to the comprehensive distortion feature, reconstructing the original EEG signal according to the wavelet coefficient adjustment control instruction, and obtaining a restored EEG signal.
[0095] Specifically, the present application needs to construct a distortion attribute model for mapping the comprehensive distortion feature description F_final to a set of predefined distortion attribute labels. Assume that the present application predefines L possible distortion attributes, denoted as {A_1, A_2, ..., A_L}, where each A_i is a vector representing the characteristic pattern corresponding to the i-th distortion attribute. These distortion attributes can cover various factors that may cause EEG signal distortion, such as baseline drift, electromyographic interference, abnormal cognitive processing, changes in emotional state, etc.
[0096] In some embodiments, the obtaining of the wavelet coefficient adjustment control instruction corresponding to the comprehensive distortion feature includes: obtaining a distortion attribute corresponding to the comprehensive distortion feature; and generating the wavelet coefficient adjustment control instruction according to the distortion attribute.
[0097] For each distortion attribute A_i, the present application can obtain its corresponding feature pattern vector representation by training a large amount of annotated distorted EEG data. Next, the present application needs to match the comprehensive distortion feature description F_final with these distortion attribute feature patterns {A_1, A_2, ..., A_L} to determine which distortion attributes F_final corresponds to. The matching method can be the nearest neighbor matching based on the distance metric, or the classifier matching based on the kernel function or probability model, or other more complex pattern recognition algorithms. Here, the present application takes the support vector machine (SVM) classifier based on the kernel function as an example to introduce a possible matching scheme. First, the present application constructs a new feature matrix X containing F_final and all distortion attribute feature patterns {A_1, A_2, ..., A_L}, where each row of X represents a feature vector. Next, the present application constructs a binary classification SVM model for each distortion attribute feature pattern A_i, namely SVM_i, and takes X as input to train each SVM_i. During the training process, the present application needs to select a suitable kernel function, such as a Gaussian kernel, a polynomial kernel, etc., and adjust the corresponding kernel parameters to obtain the best classification performance. After training, the present application can use these SVM_i models to classify F_final and determine which distortion attributes it belongs to. Specifically, the present application inputs F_final into L SVM_i models to obtain L classification results y_i, where y_i represents the probability value of F_final being classified as the i-th type of distortion attribute by SVM_i. The present application selects all indexes i whose y_i values are greater than a certain threshold theta, and the corresponding distortion attribute A_i is the distortion attribute corresponding to F_final matched by the present application. In other words, if there is a set of indexes i_1, i_2, ..., i_k, such that y_i_1>theta, y_i_2>theta, ..., y_i_k>theta, then the present application considers that the distortion attribute corresponding to F_final is {A_i_1, A_i_2, ..., A_i_k}. The setting of the threshold theta needs to be based on the specific application scenario, which reflects the confidence requirement of this application for the distortion attribute matching. Generally speaking, the larger the theta value is, the higher the confidence requirement of this application for the distortion attribute matching result is, but it may also cause underreporting; conversely, the smaller the theta value is, the lower the confidence requirement of this application for the distortion attribute matching is, but it may increase the risk of false alarms. In practical applications, this application can determine a reasonable theta value by cross-validating a large amount of verification data to balance the relationship between underreporting and false alarms. Through the above steps, this application completes the process of matching the distortion attributes corresponding to the EEG data according to the comprehensive distortion feature description F_final.Next, the present application needs to generate control instructions for controlling the change of wavelet coefficients to achieve distortion recovery based on these matched distortion attributes. Assuming that the distortion attributes matched by the present application are {A_i_1, A_i_2, ..., A_i_k}, the present application can pre-design a corresponding wavelet coefficient control strategy C_i_j for each distortion attribute A_i_j to guide how to adjust the wavelet coefficients to achieve distortion recovery. These wavelet coefficient control strategies can be manually designed by experts or automatically learned from data through machine learning and other methods. Each control strategy C_i_j is essentially a function, whose input is the current wavelet coefficient W(s, t, c) and whose output is the adjusted wavelet coefficient W'(s, t, c). For example, for the distortion attribute A_i_j related to baseline drift, its corresponding wavelet coefficient control strategy C_i_j can be: W'(s, t, c) = W(s, t, c) -mean(W(s, t, c)), that is, by subtracting the mean of the wavelet coefficients, the influence of baseline drift is eliminated. For the distortion attribute A_i_j related to abnormal cognitive processing, the corresponding wavelet coefficient control strategy C_i_j can be: W'(s,t,c) = W(s,t,c) * g(s,t,c), where g(s,t,c) is a modulation function designed based on prior knowledge, which is used to enhance or suppress specific time-scale components related to cognitive processing.
[0098] Once the present application determines the corresponding wavelet coefficient control strategy {C_i_1, C_i_2, ..., C_i_k} for each matched distortion attribute {A_i_1, A_i_2, ..., A_i_k}, the present application can fuse these control strategies to obtain the final comprehensive wavelet coefficient control strategy C_final, which is used to guide the adjustment of the wavelet coefficient. The fusion method can be a simple linear weighting or a more complex nonlinear fusion, depending on the correlation and constraints between different control strategies. For example, the present application can adopt a linear weighted fusion method, that is, C_final = sum(w_i* C_i_j), where w_i is the weight coefficient corresponding to the i-th distortion attribute A_i_j, reflecting the importance of the distortion attribute in the current operation stage stage_curr. Obviously, the larger the w_i value, the greater the impact of the i-th distortion attribute on the EEG signal, and the corresponding wavelet coefficient control strategy C_i_j should be given a larger weight when fusion. These weight coefficients w_i can be set according to the distortion detection weight value weight_i determined in step 1, for example, w_i = weight_i / sum(weight_i). In this way, the present application incorporates the difference in the degree of influence of different distortion attributes on the EEG signal into the final comprehensive wavelet coefficient control strategy C_final. In some embodiments, the obtaining of the wavelet coefficient adjustment control instruction corresponding to the comprehensive distortion feature includes: obtaining the distortion attribute corresponding to the comprehensive distortion feature; generating the wavelet coefficient adjustment control instruction according to the distortion attribute.
[0099] In some embodiments, reconstructing the original EEG signal according to the wavelet coefficient adjustment control instruction to obtain a restored EEG signal includes: obtaining the original wavelet coefficients corresponding to the original EEG signal; adjusting the parameters corresponding to the original wavelet coefficients according to the wavelet coefficient adjustment control instruction; reconstructing the original EEG signal according to the adjusted original wavelet coefficients to obtain the restored EEG signal.
[0100] First, the present application substitutes the original wavelet coefficients W_0(s,t,c) into the control strategy C_final, and obtains W'(s,t,c)= C_final(W_0(s,t,c)). Wherein C_final(·) represents the process of adjusting the wavelet coefficients by applying the comprehensive control strategy C_final. It should be noted that in practical applications, the present application does not need to explicitly construct a closed-form expression of C_final, but only needs to make corresponding adjustments to the original wavelet coefficients W_0(s,t,c) according to the different control strategies {C_i_1, C_i_2, ..., C_i_k} contained in C_final. For example, if C_final includes a control strategy C_i_j related to baseline drift, which is expressed as W'(s,t,c) = W(s,t,c) - mean(W(s,t,c)), then the present application only needs to subtract the mean value of W_0(s,t,c) at each scale s, time t and channel c from the mean value at the scale and channel to achieve the wavelet coefficient adjustment required by the control strategy. Similarly, if C_final also includes a control strategy C_i_j related to cognitive processing abnormalities, which is expressed as W'(s,t,c) = W(s,t,c) * g(s,t,c), then the present application only needs to multiply W_0(s,t,c) by the corresponding modulation function g(s,t,c). Through this decomposition method, the present application can effectively avoid explicitly constructing a complex comprehensive control strategy C_final, thereby reducing the computational complexity. Once the adjusted wavelet coefficients W'(s, t, c) are obtained, the present application can use the inverse wavelet transform method to reconstruct it into a time domain signal x'(t). Specifically, the inverse wavelet transform process includes the following steps: 1. Calculate the reconstruction coefficient C'(s, t) at each scale s, where C'(s, t) = sum_c W'(s, t, c) * ψ_c(t). ψ_c(t) is the wavelet basis function corresponding to channel c, and sum_c means summing all channels c.
[0101] 2. Perform inverse wavelet transform on the reconstruction coefficients C'(s, t) of all scales s to obtain the time domain signal x'(t), that is, x'(t) = sum_s sum_k C'(s, k) * phi(tk*2^s). Where phi(t) is the scale function, corresponding to the reconstruction of the lowest frequency component.
[0102] 3. Perform post-processing such as denoising filtering on x'(t) to obtain the final EEG signal x_final(t) after distortion recovery.
[0103] The various wavelet functions ψ_c(t) and phi(t) involved in the above formula need to be determined according to the wavelet basis actually used. For example, if the present application uses Haar wavelet as the wavelet basis, then ψ_c(t) = ψ(t) = 1(0≤t<1 / 2) - 1(1 / 2≤t<1), phi(t) = 1(0≤t<1). If the Daubechies wavelet basis is used, then ψ_c(t) and phi(t) need to use the corresponding Daubechies wavelet function expression. In this way, the present application reconstructs the adjusted wavelet coefficients W'(s, t, c) into the time domain signal x'(t). It should be noted that due to the rounding error and truncation error in the process of inverse wavelet transform, x'(t) may contain some high-frequency noise components. Therefore, after obtaining x'(t), the present application also needs to perform appropriate post-processing on it, such as bandpass filtering, smoothing filtering, etc., to obtain the final EEG signal x_final(t) after distortion recovery.
[0104] In order to implement the EEG distortion detection and restoration method based on wavelet domain energy modulation corresponding to the above method embodiment, so as to achieve the corresponding functions and technical effects. Figure 2 , Figure 2 The structural block diagram of an EEG distortion detection and restoration device 200 provided in an embodiment of the present application is shown. For the convenience of description, only the parts related to the present embodiment are shown. The EEG distortion detection and restoration device 200 provided in an embodiment of the present application includes: The coefficient acquisition module 201 is used to acquire the original EEG data and perform time-frequency transformation, acquire the energy spectrum corresponding to the original EEG data, perform modulation processing based on the components in the energy spectrum that do not meet the preset intensity threshold, and acquire the modulated wavelet coefficients; A data extraction module 202 is used to extract wavelet coefficient data corresponding to each EEG type from the wavelet coefficients according to the wavelet coefficient parameter characteristics corresponding to each EEG type; The state acquisition module 203 is used to perform spectrum weighted average calculation on the wavelet coefficient data using a preset time window to obtain the spectrum centroid value and the corresponding frequency change state to extract the wavelet feature data of each EEG type; The feature acquisition module 204 is used to acquire the preset normal features corresponding to the EEG data, perform similarity calculation between each of the wavelet feature data and the preset normal features, and determine the target similarity calculation result and the distortion mode feature corresponding to the target similarity calculation result according to the similarity calculation result corresponding to each of the wavelet feature data; The stage acquisition module 205 is used to acquire the current operation stage corresponding to the EEG data, determine the weight value corresponding to each of the distortion pattern features according to the current operation stage, acquire the feature vector of the distortion pattern feature, and generate a comprehensive distortion feature description according to a plurality of the feature vectors and the corresponding weight values; The signal acquisition module 206 is used to acquire the wavelet coefficient adjustment control instruction corresponding to the comprehensive distortion feature, reconstruct the original EEG signal according to the wavelet coefficient adjustment control instruction, and acquire the restored EEG signal.
[0105] The above-mentioned EEG distortion detection and restoration device 200 can implement the EEG distortion detection and restoration method based on wavelet domain energy modulation of the above-mentioned method embodiment. The options in the above-mentioned method embodiment are also applicable to this embodiment and will not be described in detail here. The rest of the contents of the embodiment of the present application can refer to the contents of the above-mentioned method embodiment, and will not be repeated in this embodiment.
[0106] Figure 3 This is a schematic diagram of the structure of a computer device provided in one embodiment of the present application. Figure 3 As shown, the computer device 3 of this embodiment includes: at least one processor 30 ( Figure 3 Only one is shown in the figure), a memory 31 and a computer program 32 stored in the memory 31 and executable on the at least one processor 30, wherein the processor 30 implements the steps of any of the above method embodiments when executing the computer program 32.
[0107] The computer device 3 may be a computing device such as a smart phone, a tablet computer, a desktop computer, a cloud server, etc. The computer device may include but is not limited to a processor 30 and a memory 31. Those skilled in the art will understand that Figure 3 It is only an example of computer device 3 and does not constitute a limitation on computer device 3. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.
[0108] The processor 30 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0109] In some embodiments, the memory 31 may be an internal storage unit of the computer device 3, such as a hard disk or memory of the computer device 3. In other embodiments, the memory 31 may also be an external storage device of the computer device 3, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 3. Further, the memory 31 may also include both an internal storage unit and an external storage device of the computer device 3. The memory 31 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory 31 may also be used to temporarily store data that has been output or is to be output.
[0110] In addition, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0111] An embodiment of the present application provides a computer program product. When the computer program product is run on a computer device, the computer device implements the steps in the above-mentioned method embodiments when executing the computer device.
[0112] In several embodiments provided in the present application, it is understood that each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved.
[0113] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
[0114] The specific embodiments described above further describe the purpose, technical solutions and beneficial effects of the present application in detail. It should be understood that the above description is only a specific embodiment of the present application and is not intended to limit the scope of protection of the present application. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of protection of the present application.
Claims
1. A method for detecting and restoring EEG distortion based on wavelet domain energy modulation, characterized in that: include: Acquire original EEG data and perform time-frequency transformation to obtain an energy spectrum corresponding to the original EEG data, perform modulation processing based on components in the energy spectrum that do not meet a preset intensity threshold, and obtain modulated wavelet coefficients; Extracting wavelet coefficient data corresponding to each EEG type from the wavelet coefficients according to the wavelet coefficient parameter characteristics corresponding to each EEG type; Using a preset time window to perform spectrum weighted average calculation on the wavelet coefficient data, obtaining the spectrum centroid value and the corresponding frequency change state, so as to extract the wavelet feature data of each EEG type; Acquire a preset normal feature corresponding to the EEG data, perform similarity calculation between each of the wavelet feature data and the preset normal feature, and determine a target similarity calculation result and a distortion mode feature corresponding to the target similarity calculation result according to the similarity calculation result corresponding to each of the wavelet feature data; Acquire the current operation stage corresponding to the EEG data, determine the weight value corresponding to each of the distortion pattern features according to the current operation stage, acquire the feature vector of the distortion pattern feature, and generate a comprehensive distortion feature description according to a plurality of the feature vectors and the corresponding weight values; A wavelet coefficient adjustment control instruction corresponding to the comprehensive distortion feature is obtained, and the original EEG signal is reconstructed according to the wavelet coefficient adjustment control instruction to obtain a restored EEG signal.
2. The method according to claim 1, characterized in that The step of performing modulation processing on the components in the energy spectrum that do not meet the preset intensity threshold to obtain modulated wavelet coefficients includes: Divide the high energy intensity frequency domain segment corresponding to the first modulation feature into the medium energy intensity frequency domain segment corresponding to the second modulation feature based on the energy spectrum; Modulation processing is performed on the components in the high-energy intensity frequency domain segment and the medium-energy intensity frequency domain segment that do not meet the preset intensity threshold, and the modulated wavelet coefficients are obtained.
3. The method according to claim 2, characterized in that The modulating process of the components in the high energy intensity frequency domain segment and the medium energy intensity frequency domain segment that do not meet the preset intensity threshold comprises: Performing a first modulation process on the component in the high energy intensity frequency domain segment that does not meet a preset intensity threshold; A second modulation process is performed on the component in the medium energy intensity frequency domain segment that does not meet the preset intensity threshold.
4. The method according to claim 1, characterized in that: The step of extracting wavelet coefficient data corresponding to each EEG type from the wavelet coefficients according to the wavelet coefficient parameter characteristics corresponding to each EEG type comprises: Performing an inverse time-frequency transform on the wavelet coefficients; Obtain the wavelet coefficient parameter characteristics corresponding to each EEG type; Corresponding wavelet coefficient data is extracted from the inversely transformed wavelet coefficients according to each of the wavelet coefficient parameter features.
5. The method according to claim 1, characterized in that The method of using a preset time window to perform spectrum weighted average calculation on the wavelet coefficient data to obtain a spectrum centroid value and a corresponding frequency change state to extract wavelet feature data of each EEG type includes: Performing the weighted average calculation on each of the wavelet coefficient data according to the preset time window to obtain the spectrum centroid value; Obtaining the frequency change state corresponding to each of the frequency spectrum centroid values; The wavelet characteristic data is extracted in the frequency change state.
6. The method according to claim 1, characterized in that The step of obtaining the wavelet coefficient adjustment control instruction corresponding to the comprehensive distortion feature includes: Obtaining a distortion attribute corresponding to the comprehensive distortion feature; The wavelet coefficient adjustment control instruction is generated according to the distortion attribute.
7. The method according to claim 1, characterized in that The reconstructing the original EEG signal according to the wavelet coefficient adjustment control instruction to obtain the restored EEG signal includes: Obtaining original wavelet coefficients corresponding to the original EEG signal; Adjust the parameters corresponding to the original wavelet coefficients according to the wavelet coefficient adjustment control instruction; The original EEG signal is reconstructed according to the adjusted original wavelet coefficients to obtain the restored EEG signal.
8. The method according to claim 1, characterized in that: The obtaining of the preset normal features corresponding to the EEG data includes: Obtaining the application type and data processing method corresponding to the EEG data; The preset normal features are obtained according to the application type and the data processing method.
9. The method according to claim 8, characterized in that The obtaining of the EEG data corresponding to the current operation stage includes: The current operation stage is obtained according to the application type and the data processing method.
10. A computer device, characterized in that: The method comprises a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and implement the method according to any one of claims 1 to 9 when executing the computer program.
Citation Information
Patent Citations
Electroencephalogram abnormal signal detection device and method
CN111528838A
Method for removing ocular artifacts in single-channel electroencephalogram signals
CN114403896A
Cross-subject electroencephalogram signal alignment method based on time-frequency analysis and related equipment
CN118044826A
Electroencephalogram signal processing method, device and equipment based on fractal dimension enhancement
CN118296306A
Human-computer interaction method, device and equipment based on electroencephalogram signal probability coding
CN118426594A
Cited By
Human-computer interaction virtual keyboard input method, device and equipment based on electroencephalogram signals
CN120066284A
Human-computer interaction virtual keyboard input method, device and equipment based on electroencephalogram signals
CN120066284B