Real-time encoding method and device for virtual reality cognitive state based on EEG signals

Through deep neural network and wavelet reconstruction technology, EEG signals are automatically processed, cognitive state features are extracted and virtual reality systems are adjusted, which solves the problems of EEG signal feature extraction and VR adjustment in the existing technology, and achieves efficient and accurate Personalized experience.

CN118427763BActive Publication Date: 2024-09-06XIAOZHOU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410886346.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-09-06
Estimated Expiration
2044-07-03

AI Technical Summary

Technical Problem

Existing technology is difficult to efficiently extract characteristic parameters closely related to cognitive status from EEG signals, and the recognition accuracy is low, making it impossible to effectively adjust the virtual reality system to provide a personalized experience.

Method used

A deep neural network is used for end-to-end automated processing. By obtaining the current pattern and feature vector of the EEG signal, mapping it to a high-dimensional discriminant feature space, extracting the key features of the abnormal pattern, and using wavelet reconstruction and encoding and decoding networks for modulation, it is achieved Real-time encoding of cognitive states.

Benefits of technology

No manual participation is required, which improves work efficiency, the coding effect is accurate, the degree of personalization is high, the adjustment is flexible, and the dynamic response is good, ensuring the smooth output of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118427763B
    Figure CN118427763B
Patent Text Reader

Abstract

The present application discloses a real-time encoding method and device for virtual reality cognitive state based on EEG signals. The method comprises the following steps: obtaining a current EEG pattern and corresponding EEG parameters corresponding to an original EEG signal to obtain a current EEG feature vector and a corresponding mapped EEG feature graph; extracting EEG attributes from the mapped EEG feature graph to obtain the current EEG feature, comparing it with a plurality of reference EEG features, confirming abnormal EEG features in the reference EEG features according to the obtained comparison results, extracting local signals and local key points corresponding to the abnormal EEG features, extracting a plurality of sampling feature points from the display vector corresponding to the local key points to determine valid feature points, and obtaining current signal display features; obtaining current EEG parameters according to the current EEG features and the current signal display features, determining the EEG modulation values ​​corresponding to the current EEG parameters to adjust the original EEG signal, obtaining the cognitive state encoding output signal, and completing the real-time encoding of the cognitive state.
Need to check novelty before this filing date? Find Prior Art

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 real-time encoding of virtual reality cognitive states based on electroencephalogram signals. Background Art

[0002] With the continuous development of virtual reality (VR) technology, the mode of human-computer interaction is evolving from traditional peripheral input such as keyboard, mouse and controller to a more intuitive and natural brain-computer interaction. Among them, the interaction technology based on electroencephalogram (EEG) signals has received great attention because of its characteristics of directly reflecting the cognitive activities of the brain. By collecting and analyzing the user's EEG signals in real time, the system can perceive the user's current cognitive state, such as concentration, relaxation, stress, etc., and make personalized adjustments to the virtual scene and content presentation according to the detection results, providing users with a more immersive and natural virtual reality experience.

[0003] However, there are many technical challenges in achieving personalized virtual reality based on EEG signals. The first is how to analyze and extract characteristic parameters closely related to cognitive states from raw EEG data, which is an extremely difficult problem. EEG signals have the characteristics of nonlinearity, instability, and high noise. The characteristic patterns corresponding to different cognitive states are often very weak and difficult to separate and extract directly. Traditional methods usually require a lot of manual analysis and labeling work, which is inefficient and costly.

[0004] Secondly, even if the characteristic parameters are successfully extracted, how to use these parameters to efficiently and accurately identify and decode the current cognitive state is also a technical challenge. Since the characteristic parameter patterns corresponding to different cognitive states are not obviously different, complex pattern recognition and classification techniques are required, and the recognition accuracy is difficult to guarantee. In addition, after a certain cognitive state is identified, how to adjust and optimize the virtual reality system in a targeted manner to provide users with personalized optimal virtual reality experience feedback is also a key issue that needs to be solved urgently. Summary of the invention

[0005] The embodiment of the present application provides a method and device for real-time encoding of virtual reality cognitive states based on EEG signals, which can solve the problems that EEG signals have nonlinearity, instability, high noise, etc., and the characteristic patterns corresponding to different cognitive states are often very weak and difficult to separate and extract directly. Traditional methods usually require a lot of manual analysis and labeling work, which is inefficient and costly. And after identifying a certain cognitive state, how to adjust and optimize the virtual reality system in a targeted manner to provide users with personalized optimal virtual reality experience feedback is also a key problem that needs to be solved urgently.

[0006] In a first aspect, an embodiment of the present application provides a method for real-time encoding of virtual reality cognitive state based on EEG signals, the method comprising:

[0007] Obtaining the original EEG signal to be encoded, obtaining the current EEG pattern corresponding to the original EEG signal, and extracting EEG parameters corresponding to the current EEG pattern;

[0008] According to the original EEG signal and the EEG parameters, a current EEG feature vector corresponding to the original EEG signal is obtained, and a mapped EEG feature graph corresponding to the current EEG feature vector is obtained;

[0009] Extracting EEG attributes from the mapped EEG feature graph, obtaining the current EEG feature corresponding to the current EEG pattern, comparing the current EEG feature with multiple reference EEG features, and obtaining the comparison result corresponding to each reference EEG feature;

[0010] According to the comparison result, the abnormal EEG feature is confirmed in the multiple reference EEG features, the local signal corresponding to the abnormal EEG feature and the local key point in the local signal are extracted from the original EEG signal, and the display vector corresponding to the local key point is obtained;

[0011] Extract multiple sampling feature points from the display vector, determine valid feature points among the multiple sampling feature points, perform wavelet reconstruction on the valid feature points, and obtain current signal display features;

[0012] According to the current EEG characteristics and the current signal display characteristics, the current EEG parameters are obtained, the EEG modulation values ​​corresponding to the current EEG parameters are determined, the original EEG signals are adjusted according to the EEG modulation values, the cognitive state encoding output signal is obtained, and the real-time encoding of the cognitive state of the original EEG signals is completed.

[0013] In a second aspect, the present application also provides a virtual reality cognitive state real-time encoding device, comprising:

[0014] A parameter extraction module is used to obtain the original EEG signal to be encoded, obtain the current EEG pattern corresponding to the original EEG signal, and extract the EEG parameters corresponding to the current EEG pattern;

[0015] A feature mapping module, used to obtain a current EEG feature vector corresponding to the original EEG signal and a mapped EEG feature map corresponding to the current EEG feature vector according to the original EEG signal and the EEG parameters;

[0016] A result acquisition module is used to extract EEG attributes from the mapped EEG feature graph, obtain the current EEG feature corresponding to the current EEG pattern, compare the current EEG feature with a plurality of reference EEG features, and obtain a comparison result corresponding to each reference EEG feature;

[0017] A vector acquisition module, used to confirm an abnormal EEG feature in the plurality of reference EEG features according to the comparison result, extract a local signal corresponding to the abnormal EEG feature and a local key point in the local signal from the original EEG signal, and acquire a display vector corresponding to the local key point;

[0018] A display acquisition module, used to extract multiple sampling feature points from the display vector, determine effective feature points among the multiple sampling feature points, perform wavelet reconstruction on the effective feature points, and obtain current signal display features;

[0019] The encoding completion module is used to obtain the current EEG parameters according to the current EEG characteristics and the current signal display characteristics, determine the EEG modulation values ​​corresponding to the current EEG parameters, adjust the original EEG signal according to the EEG modulation values, obtain the cognitive state encoding output signal, and complete the real-time encoding of the cognitive state of the original EEG signal.

[0020] 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 real-time encoding method of virtual reality cognitive state based on EEG signals as described in the first aspect is implemented.

[0021] 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 real-time encoding method of virtual reality cognitive state based on EEG signals as described in the first aspect.

[0022] Compared with the prior art, this application has at least the following beneficial effects:

[0023] 1. The current cognitive state can be automatically analyzed and encoded without human intervention. Traditional methods require professionals to perform complex processing and analysis of EEG data, which is labor-intensive and inefficient. The method of the present invention realizes an end-to-end automated processing flow by constructing a deep neural network without any human intervention, which will greatly improve work efficiency and reduce labor costs.

[0024] 2. Accurate coding effect and high degree of personalization. The method of the present invention maps the original EEG signal to a high-dimensional discriminant feature space, in which the difference between abnormal and normal states is greatly amplified. At the same time, the method uses a local reconstruction method to extract the overall differential features corresponding to the significant difference points, thereby effectively describing the core abnormal mode of the abnormal state. The above optimization makes the key features of the abnormal state stand out, thereby ensuring the accuracy of the coding effect and a high degree of personalization.

[0025] 3. Flexible adjustment and dynamic response. The method of the present invention adaptively converts the parameter difference between the current state and the normal state into a hierarchical modulation value, and generates a corresponding modulated output signal based on the codec network. This modular hierarchical modulation mechanism has good flexibility and can quickly and accurately respond to and adjust a variety of abnormal cognitive states. At the same time, the moving average and adaptive gain adjustment are introduced to ensure that the output signal is smooth and the amplitude is reasonable, ensuring the dynamic response effect of the system.

[0026] 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

[0027] Figure 1 A flowchart of a method for real-time encoding of virtual reality cognitive states based on EEG signals according to an embodiment of the present application;

[0028] Figure 2 This is a schematic diagram of the structure of a real-time encoding device for virtual reality cognitive state according to an embodiment of the present application;

[0029] Figure 3 A schematic diagram of the structure of a computer device shown in an embodiment of the present application. DETAILED DESCRIPTION

[0030] 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.

[0031] 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.

[0032] 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.

[0033] 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.

[0034] 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.

[0035] 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.

[0036] The technical solution of the embodiment of the present application is introduced below.

[0037] With the continuous development of virtual reality (VR) technology, the mode of human-computer interaction is evolving from traditional peripheral input such as keyboard, mouse and controller to a more intuitive and natural brain-computer interaction. Among them, the interaction technology based on electroencephalogram (EEG) signals has received great attention because of its characteristics of directly reflecting the cognitive activities of the brain. By collecting and analyzing the user's EEG signals in real time, the system can perceive the user's current cognitive state, such as concentration, relaxation, stress, etc., and make personalized adjustments to the virtual scene and content presentation according to the detection results, providing users with a more immersive and natural virtual reality experience.

[0038] However, there are many technical challenges in achieving personalized virtual reality based on EEG signals. The first is how to analyze and extract characteristic parameters closely related to cognitive states from raw EEG data, which is an extremely difficult problem. EEG signals have the characteristics of nonlinearity, instability, and high noise. The characteristic patterns corresponding to different cognitive states are often very weak and difficult to separate and extract directly. Traditional methods usually require a lot of manual analysis and labeling work, which is inefficient and costly.

[0039] Secondly, even if the characteristic parameters are successfully extracted, how to use these parameters to efficiently and accurately identify and decode the current cognitive state is also a technical challenge. Since the characteristic parameter patterns corresponding to different cognitive states are not obviously different, complex pattern recognition and classification techniques are required, and the recognition accuracy is difficult to guarantee. In addition, after a certain cognitive state is identified, how to adjust and optimize the virtual reality system in a targeted manner to provide users with personalized optimal virtual reality experience feedback is also a key issue that needs to be solved urgently.

[0040] Please refer to Figure 1 , Figure 1 The flowchart of a method for real-time encoding of virtual reality cognitive state based on EEG signals provided in the embodiment of the present application is shown in FIG. The method for real-time encoding of virtual reality cognitive state based on EEG signals in the 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 real-time encoding method of virtual reality cognitive state based on EEG signals in this embodiment includes steps S101 to S106, which are described in detail as follows:

[0041] Step S101, obtaining the original EEG signal to be encoded, obtaining the current EEG pattern corresponding to the original EEG signal, and extracting EEG parameters corresponding to the current EEG pattern.

[0042] Specifically, in the virtual reality system, the subject needs to wear an EEG acquisition device that can obtain the subject's EEG activity signals in real time. In order to determine the subject's current EEG mode, this application needs to analyze and process the collected original EEG signals. During the transmission process, the original EEG signal needs to be encoded first to ensure the real-time and stability of the signal during wireless transmission. This application can use advanced LDPC code error correction coding technology to control the signal bit error rate at a low level. At the same time, the use of OFDM modulation technology can effectively overcome the signal fading caused by multipath transmission and improve the overall transmission efficiency.

[0043] Once the original EEG signals are successfully transmitted to the encoding system, the system will decode and restore these signals. Then, a series of preprocessing steps are required to improve the signal quality. Specifically, these steps include: removing power frequency noise, baseline correction, interpolation processing, and resampling.

[0044] 1) Remove power frequency noise: EEG signals are easily interfered by 50 / 60Hz power frequency AC in the environment, so a notch filter is needed to remove the power frequency noise. This application uses an IIR notch filter, and its transfer function is:

[0045] H(z)=[(z^2 -2zcosz0+1)] / [(z^2 -2zcosz0+r^2)];

[0046] Where z0=2πf0 / fs, f0 is the notch frequency, fs is the sampling frequency, and r is the notch bandwidth coefficient (usually 0.98).

[0047] 2) Baseline correction: EEG signals have slow baseline drift, which needs to be reduced. This application uses linear regression to estimate and remove the trend term of the signal. Specifically, each epoch of the signal (i.e., a complete segment of EEG data) is segmented by least squares fitting to obtain the slope k of the fitting line. The trend term can be eliminated by subtracting the original signal from kx.

[0048] 3) Interpolation processing: Sometimes EEG data is missing, and an interpolation algorithm is needed to fill in these missing values. This application uses the nearest neighbor interpolation method, that is, the mean of the two nearest non-missing values ​​is used to replace the missing value.

[0049] 4) Resampling: Usually, this application needs to upsample the original 128Hz sampling rate to a higher 256Hz to improve the resolution of subsequent wavelet analysis. Resampling uses the matrix interpolation resampling method, first interpolating the EEG sequence to a sufficiently high sampling rate, and then filtering it with an anti-aliasing filter to downsample it to the required sampling rate.

[0050] In some embodiments, obtaining the current EEG pattern corresponding to the original EEG signal includes: decoding the original EEG signal; preprocessing the decoded original EEG signal; wherein the preprocessing includes removing power frequency noise, baseline correction, interpolation and resampling; performing fast Fourier transform on the preprocessed original EEG signal to obtain the power spectral density of the original EEG signal in multiple preset frequency bands; and analyzing the power spectral density to determine the current EEG pattern corresponding to the original EEG signal.

[0051] Next, this application needs to determine the current EEG pattern based on the preprocessed EEG signal. In the virtual reality scenario, the main EEG patterns that this application focuses on include: attention mode, relaxation mode, focus mode and stress mode. This application will use the power spectral density analysis method to perform EEG pattern recognition.

[0052] Specifically, the preprocessed EEG signal is first transformed by FFT to obtain the power spectrum density of different frequency bands. This application will analyze the relative power of the five main frequency bands: delta wave (0.5-4Hz), theta wave (4-8Hz), alpha wave (8-13Hz), beta wave (13-30Hz) and gamma wave (30-50Hz).

[0053] Next, this application will calculate the average relative power of each frequency band and construct a 5-dimensional feature vector based on it:

[0054] F=[δ θ α β γ] represents the relative power distribution of the current EEG signal in each frequency band.

[0055] Exemplarily, the analyzing the power spectral density to determine the current EEG pattern corresponding to the original EEG signal includes: constructing a density feature vector based on multiple power spectral densities; inputting the density feature vector into a pre-trained pattern classifier, the pattern classifier matching the density feature vector with a reference feature vector corresponding to a pre-stored reference EEG pattern to output a reference EEG pattern corresponding to the successfully matched reference feature vector as the current EEG pattern.

[0056] Then, the feature vector F is input into the trained classifier, and the classifier matches and compares the input 5-dimensional feature vector F with the feature vector templates corresponding to various EEG patterns stored in it, and outputs which EEG pattern category the current EEG signal is most likely to belong to, that is, the current cognitive state of the subject (concentration, relaxation, concentration or stress, etc.). This application uses support vector machine (SVM) as a classifier, using Gaussian kernel function, kernel parameter γ=0.5, and soft interval parameter C=10.

[0057] In some embodiments, extracting EEG parameters corresponding to the current EEG pattern includes: extracting EEG parameters such as frequency domain parameters, time domain parameters, and phase parameters corresponding to the current EEG pattern.

[0058] The first step of frequency domain parameter extraction is to perform fast Fourier transform FFT on the preprocessed EEG signal to obtain the power spectrum density P(f) of the signal. Then, according to the power spectrum density function, the relative power of the five frequency bands of δ wave (0.5-4Hz), θ wave (4-8Hz), α wave (8-13Hz), β wave (13-30Hz) and γ wave (30-50Hz) is calculated. The formula is as follows:

[0059] Pδ=∫4Hz0.5HzP(f)df / ∫50Hz0.5HzP(f)df;

[0060] Pθ=∫8Hz4HzP(f)df / ∫50Hz0.5HzP(f)df;

[0061] Pα=∫13Hz8HzP(f)df / ∫50Hz0.5HzP(f)df;

[0062] Pβ=∫30Hz13HzP(f)df / ∫50Hz0.5HzP(f)df;

[0063] Pγ=∫50Hz30HzP(f)df / ∫50Hz0.5HzP(f)df.

[0064] Next, we need to calculate the peak frequency fpeak of the power spectrum. Specifically, we first find the maximum value Pmax of the power spectrum density function P(f), and then when the frequency f satisfies P(f)=Pmax, the corresponding f value is fpeak. The peak frequency fpeak of the power spectrum reflects the frequency of the dominant EEG rhythm. The next step is to calculate the power spectrum entropy H, the formula is H=−∑P(fi)logP(fi), where fi is a discrete frequency point. The larger the entropy H, the more dispersed the power spectrum distribution.

[0065] Next, calculate the center frequency fc and bandwidth B, the formulas are fc=∑fiP(fi) / ∑P(fi) and B=sqrt(∑(fi−fc)2P(fi) / ∑P(fi)). Where fi is the frequency point, and P(fi) is the corresponding power spectrum density value. The center frequency fc reflects the frequency area where the power spectrum is mainly concentrated, and the bandwidth B reflects the distribution range of the EEG activity spectrum. The larger the value, the more dispersed the frequency component. The above are the main frequency domain parameters that need to be extracted in this application.

[0066] Next, the time domain parameters are extracted. First, the average amplitude mean=∑|x(n)| / N is calculated, where x(n) is the time domain EEG signal and N is the signal length. Then the standard deviation std=sqrt(∑(x(n)−mean)2 / N) and the absolute mean mav=∑|x(n)| / N are calculated. Then the peak-to-peak value ptp=max(x(n))−min(x(n)), the zero crossing rate zr=∑|sign(x(n))−sign(x(n−1))| / 2N, the energy eng=∑x(n)2 / N and the sudden drop rate ise=∑(x(n)−x(n−1))2 / N are calculated. These time domain parameters reflect the statistical laws and mutation characteristics of EEG signals in time.

[0067] Finally, the phase parameters are extracted. First, the time domain signal x(n) is transformed into the frequency domain X(k) by FFT, and then the phase φ(k)=arctan(imag(X(k)) / real(X(k))) is calculated. Next, the phase lock value PLV is calculated, and the formula is PLV=|∑eіφn(t)| / N, where φn(t) is the phase value at time t of the nth test, and N is the total number of tests. PLV reflects the degree of phase consistency. The larger the value, the more concentrated the phase.

[0068] Then calculate the phase aggregation index PLI, the formula is PLI=|∑sign(φnm)| / N, where φnm=φn(t)−φm(t) is the phase difference between the two electrodes n and m at time t. PLI reflects the phase coupling degree of the two electrodes, and the larger the value, the stronger the coupling. The above are the main phase parameters that need to be extracted in this application.

[0069] The extraction of all these parameters is based on the current EEG pattern determined in the above steps, and different pattern categories will focus on different parameters. For example, for the concentration mode, this application will focus on the relative power Pα and Pβ of α and β waves, as well as parameters such as center frequency fc and bandwidth B; while for the stress mode, this application will focus more on the relative power Pδ and Pθ of δ and θ waves, as well as phase parameters such as PLV.

[0070] Step S102, according to the original EEG signal and the EEG parameters, obtain the current EEG feature vector corresponding to the original EEG signal, and obtain the mapped EEG feature graph corresponding to the current EEG feature vector.

[0071] Specifically, in the above steps, the present application extracts numerous frequency domain, time domain, phase and other parameters from the original EEG signal to form a high-dimensional original EEG parameter vector. However, these parameters are somewhat redundant and it is difficult to directly reflect the inherent differences between different EEG patterns. Therefore, the present application needs to transform and compress these original parameters to obtain a new feature representation so that the features of different patterns can be better distinguished in this new space. The purpose of the above steps is to map the original high-dimensional EEG parameters to a new feature space in order to obtain a more compact and discriminative EEG feature representation.

[0072] First, the current EEG pattern category (such as concentration, relaxation, focus or stress, etc.) output by the above steps is one-hot encoded to obtain a one-hot vector M. Then, various EEG parameters extracted by the above steps are spliced ​​together, such as band power Pδ, Pθ, Pα, Pβ, Pγ, power spectrum peak frequency fpeak, power spectrum entropy H, center frequency fc, bandwidth B, average amplitude mean, standard deviation std, absolute average mav, peak-to-peak value ptp, zero crossing rate zr, energy eng, sag rate ise, phase lock value PLV, phase aggregation index PLI, etc., to obtain the original EEG parameter vector P, and M and P are spliced ​​to form the original EEG feature vector X=[M,P].

[0073] Next, this application will use a feedforward neural network to map the original feature vector X to a high-dimensional feature space to obtain the mapped EEG feature vector Y. Let the mapping network be Y=f(X;θ), where f is the mapping function of the network and θ is the network parameter. The network consists of 3 fully connected hidden layers, each with 256 neurons, and the activation function uses ReLU, that is, ReLU(z)=max(0,z). There is no activation function in the output layer. The output Y dimension of the network is a 512-dimensional vector. The network is trained using the mean square error (MSE) loss function, that is, L(θ)=∑(Y−Y')2 / N, where Y' is the true mapping feature and N is the batch size. The network parameter θ is updated using the stochastic gradient descent optimization algorithm, with a learning rate η=0.001, momentum μ=0.9, and weight decay λ=0.0005. After 5000 iterations and training with a batch size of 64, the MSE loss of the network on the test set can be reduced to a low level, and a better mapping effect can be obtained.

[0074] Once the mapped high-dimensional EEG feature vector Y is obtained, the present application can extract its attributes and determine the current EEG features corresponding to the current EEG pattern. Specifically, the present application constructs a reference EEG feature library in advance, which contains reference EEG feature vectors {R1, R2, ..., Rn} corresponding to various typical EEG patterns. The present application compares the current mapped EEG feature vector Y with each reference EEG feature vector Ri, calculates the Euclidean distance di=||Y-Ri|| between them, and obtains a series of distance values ​​{d1, d2, ..., dn}. These distance values ​​are normalized to obtain di'=di / sum(d), then the current EEG feature vector C corresponding to the current mapped EEG feature vector Y can be expressed as: C=sum(di'*Ri).

[0075] So far, the present application has successfully obtained the current EEG feature vector C corresponding to the current EEG pattern. Next, it is necessary to compare it with the reference EEG feature to obtain the comparison result. The present application has prepared a reference EEG feature range [L, U] in advance, where L is a 512-dimensional reference lower limit vector, and U is a 512-dimensional reference upper limit vector, which correspond to the theoretical lower limit and upper limit of normal EEG features, respectively. The present application calculates the distance between the current EEG feature C and the reference range [L, U], and obtains the lower limit distance dl=||CL|| and the upper limit distance du=||CU||.

[0076] According to the values ​​of dl and du, the present application can determine the contrast difference of each EEG pattern. Specifically, the thresholds Tl and Tu are set. If dl>Tl and du>Tu, it means that the current EEG feature C deviates too much from the reference range, and the corresponding EEG pattern is confirmed as an abnormal pattern. The present application sums the dl and du values ​​of all abnormal patterns respectively to obtain the total lower limit difference D and upper limit difference U, that is, D=sum(dl), U=sum(du). These two values ​​reflect the overall degree of deviation between the current EEG feature and the reference range. The larger the difference, the more serious the deviation.

[0077] Method for obtaining mapped EEG feature map: First, the high-dimensional vector Y needs to be expanded into a two-dimensional matrix to facilitate subsequent pixelation and grayscale processing. Specifically, the present application rearranges Y in a 32×16 shape to obtain a 32-row 16-column matrix M. That is, M(i,j)=Y(16i+j), i=1,2,...,32,j=1,2,...,16. Through this arrangement, the present application maps the 512-dimensional high-dimensional vector Y to each element of M one by one.

[0078] Next, this application needs to uniformly map the element values ​​of the matrix M to the interval [0,1]. This is because the element values ​​need to be in the range [0,1] for subsequent grayscale quantization. The mapping method used in this application is to first find the maximum element value Mmax and the minimum element value Mmin in M, and then normalize each element M(i,j): M'(i,j)=(M(i,j)-Mmin) / (Mmax-Mmin). Through this normalization, some abnormally large or small values ​​that may have existed are limited to the interval [0,1].

[0079] After having the normalized matrix M', the present application can grayscale it. The purpose of grayscale quantization is to discretize the continuous grayscale values ​​into a finite number of levels for subsequent storage and display. The present application adopts 256-level grayscale quantization, that is, the [0,1] interval is divided into 256 sub-intervals, each sub-interval corresponds to a grayscale value g, g=0,1,2,...,255. Specifically, if M'(i,j) falls within the sub-interval [k / 256, (k+1) / 256), the present application assigns a grayscale value g=k to M'(i,j). Through this quantization, the element values ​​in the matrix M' are changed from the original continuous real numbers to 256 discrete grayscale levels.

[0080] Finally, the present application directly outputs the quantized matrix M' as a 32×16 pixel grayscale image, i.e., a mapped EEG feature map, where the grayscale value of each pixel corresponds to the quantized grayscale value g of the corresponding element in M'.

[0081] Step S103, extracting EEG attributes from the mapped EEG feature graph, obtaining a current EEG feature corresponding to the current EEG pattern, comparing the current EEG feature with a plurality of reference EEG features, and obtaining a comparison result corresponding to each reference EEG feature.

[0082] Specifically, based on the mapped EEG feature map obtained in the above steps, EEG attributes are extracted to determine the current EEG features corresponding to the current EEG pattern; the current EEG features are compared with the reference EEG features to obtain comparison results. The reason for extracting attributes from the mapped EEG feature map is that it is difficult to analyze directly in the original parameter space. The original parameter space dimension is too high, and there is a certain redundancy between the parameters, which makes it difficult to directly reflect pattern differences and abnormal features. Therefore, this application needs to complete the mapping first, compress the original parameters into a new space with stronger discrimination, and then analyze and extract the actual EEG attribute features in this space.

[0083] In some embodiments, comparing the current EEG feature with multiple reference EEG features to obtain a comparison result corresponding to each reference EEG feature includes: calculating the Mahalanobis distance between a current EEG feature vector corresponding to the current EEG feature and a reference vector corresponding to each reference EEG feature; and normalizing multiple Mahalanobis distances to obtain the comparison result.

[0084] Specifically, the present application constructs a CNN network structure containing 2 convolutional layers and 2 fully connected layers. The number of filters in the first convolutional layer is 32, the convolution kernel size is 5×5, the step size is 1, and the activation function is ReLU(x)=max(0,x); the number of filters in the second convolutional layer is 64, the convolution kernel size is 3×3, the step size is 1, and the activation function is also ReLU. Then there is a 2×2 maximum pooling layer with a step size of 2. Next is the first fully connected layer with 128 neurons and ReLU activation function. Finally, there is the output layer fully connected layer with 512 neurons.

[0085] The loss function of the CNN network adopts the mean square error (MSE) loss function. The design goal is to make the output 512-dimensional vector F as close as possible to the expected current EEG feature vector, that is, to minimize the loss: L(F,F') = ||F - F'||^2;

[0086] Where F' is the real current EEG feature vector. This application uses the Adam optimization algorithm to iteratively update the network parameters. The initial learning rate is 0.001. When the validation set loss no longer decreases, the learning rate is reduced by 0.1. The batch size is 64 and the iteration is 5000 times.

[0087] After the above CNN network training and prediction, this application successfully extracted a 512-dimensional current EEG feature vector F from the 32×16 mapped EEG feature map, which describes the specific EEG attribute characteristics corresponding to the current EEG pattern.

[0088] Next, this application needs to compare the extracted current EEG feature F with the pre-established reference EEG feature. The reference EEG feature library consists of 512-dimensional reference EEG feature vectors {R1, R2, ..., Rn} corresponding to various typical EEG patterns (concentration, relaxation, concentration, etc.). This application compares F with each reference vector Ri and calculates the Mahalanobis distance di between them, as follows:

[0089] di = sqrt((F - Ri)^T Σ^(-1) (F - Ri));

[0090] Where Σ is the covariance matrix of Ri, and ^(-1) represents the inverse. The Mahalanobis distance not only considers the Euclidean distance between vectors, but also includes the variance and covariance information of each dimension, which can more accurately describe the geometric distance between vectors.

[0091] After calculating each di, the application normalizes all di values ​​to obtain di'=di / sum(d). The application sets a distance threshold τ in advance. If di'>τ exists, it means that the distance between the current EEG feature F and the corresponding reference feature Ri is too large and exceeds the normal range.

[0092] For all cases where di'>τ, this application records the corresponding reference vector number i, and takes the first K with the largest di' value as the key difference vector, recorded as {i1, i2, ..., iK}. These K reference vectors are likely to be the main factors that cause the current EEG feature F to deviate from the normal. This application will specifically analyze these key differences in the subsequent steps to locate the specific cause of the abnormality.

[0093] As an example, assume that for the current EEG feature F, the normalized distances between the reference vectors R5, R12, and R37 are d5'=0.72, d12'=0.68, d37'=0.81, respectively, and this application sets τ=0.7, K=2. Then, since d37' and d5' both exceed the threshold τ, R37 and R5 are determined as key difference vectors, and R37 is the primary difference vector because d37' is the largest. This application will focus on analyzing the EEG patterns corresponding to these two reference vectors to find the main reason for the deviation of F.

[0094] In addition, this application also needs to quantify the overall deviation between the current EEG feature F and the entire reference feature library. This application calculates the sum of all di' values ​​D = sum(di'). The larger D is, the more F deviates from the normal range. Taking the above example, let sum(di') = 4.23, then D = 4.23. A larger D value indicates that F has an overall deviation.

[0095] Step S104, confirming abnormal EEG features among multiple reference EEG features according to the comparison results, extracting local signals corresponding to the abnormal EEG features and local key points in the local signals from the original EEG signals, and obtaining display vectors corresponding to the local key points.

[0096] Specifically, according to the comparison results of the above steps, the contrast difference of each EEG pattern is determined, and the reference EEG pattern corresponding to the reference EEG feature whose difference exceeds the threshold is confirmed as an abnormal pattern, and the reference EEG feature is an abnormal EEG feature.

[0097] In some embodiments, extracting the local signal corresponding to the abnormal EEG feature and the local key points in the local signal from the original EEG signal includes: obtaining the occurrence time corresponding to the abnormal EEG feature, and extracting EEG signal segments from the original EEG signal according to the occurrence time; performing wavelet decomposition on the EEG signal segments to obtain multiple signal components corresponding to the EEG signal segments; obtaining energy information corresponding to each of the signal components, and determining an energy concentration scale in the energy information; and extracting the local signal and the local key points from the EEG signal segments according to the energy concentration scale.

[0098] In the above steps, the application has calculated the normalized Mahalanobis distance di' between the current EEG feature vector F and each reference vector Ri. For any EEG mode j (such as concentration mode, relaxation mode, etc.), the application records the reference vector number corresponding to the mode as ij. Then the contrast difference between the mode j and the reference feature can be defined as Δj=di'j, that is, the corresponding normalized Mahalanobis distance value. The application will calculate the contrast difference {Δ1, Δ2, ..., Δn} of all modes j.

[0099] Next, this application needs to set a contrast difference threshold T. If Δj>T exists, it means that there is a large deviation between pattern j and its corresponding reference feature, and it is judged as a possible abnormal pattern and needs to be individually traced back and analyzed. This application records all patterns with Δj>T to obtain a possible abnormal pattern set S. Taking the attention concentration pattern as an example, assuming that the reference vector corresponding to this pattern is numbered i5 and the contrast difference is Δ5=0.82, if this application sets T=0.7, then Δ5>T, so the attention concentration pattern will be added to the possible abnormal set S.

[0100] For each possible abnormal pattern j in the set S, this application will trace back and analyze the original EEG signal obtained by the above steps to further determine whether there is an abnormality. The specific method is to extract the original EEG signal segment Sj corresponding to the occurrence of pattern j and perform wavelet analysis on it. The specific steps of wavelet analysis are as follows:

[0101] 1. Select a wavelet basis function, such as Daubechies wavelet, etc., denoted as ψ(t). This application takes Daubechies4 wavelet as an example;

[0102] 2. Perform multi-scale decomposition on the signal Sj and decompose it into low-frequency approximate components An and high-frequency detail components Dn of different scales;

[0103] 3. Calculate the wavelet energy En=∫|Dn(t)|^2dt and approximate energy En_a=∫|An(t)|^2dt of each component;

[0104] 4. Find the energy concentration scale n0 to maximize En0 and En0_a;

[0105] 5. Under the scale n0, extract the corresponding wavelet detail coefficient sequence Dn0(t), and find the local extreme point set {t1, t2, ..., tm} according to the coefficient value;

[0106] 6. Taking the local extreme point as the center, extract the local vector {V1, V2, ..., Vm} with a window width of w, Vi = Sj (ti-w / 2:ti+w / 2).

[0107] Through the above wavelet analysis, the present application extracts a series of local vectors {V1, V2, ..., Vm} from the original signal Sj corresponding to the possible abnormal mode j. These local vectors are likely to be the key abnormal areas that cause the abnormality of the mode.

[0108] Next, this application will further analyze these local vectors to determine whether they are really abnormal, and what the type and degree of abnormality are. The method adopted by this application is to build an anomaly detection model based on the long short-term memory network LSTM. The model input is the local vector Vi, and the output is a 0 / 1 scalar, predicting whether Vi is an abnormal vector.

[0109] The network structure of the LSTM anomaly detection model is: the input layer dimension is the window width w, followed by a 128-unit LSTM layer, followed by a 64-node fully connected layer, and finally a 1-node output layer, with the activation function being Sigmoid. The model is pre-trained on a large number of normal and abnormal EEG signal samples, and is able to learn the intrinsic characteristic patterns of abnormal vectors. This application inputs each local vector Vi into the LSTM model to obtain its abnormal score yi=sigmoid(outputi). If yi>0.5, Vi is determined to be an abnormal vector.

[0110] This application counts the number of all abnormal vectors m' and calculates the abnormal vector ratio p = m' / m. At the same time, this application also calculates the average abnormal score of all abnormal vectors ȳ = sum(yi>0.5) / m'. Considering p and ȳ comprehensively, if p>τp and ȳ>τy (τp and τy are preset thresholds), mode j is finally determined as an abnormal mode.

[0111] For each abnormal EEG pattern corresponding to the abnormal EEG feature confirmed in the above steps, this application needs to use the original EEG signal corresponding to the pattern for further in-depth analysis to determine the specific cause and location of the abnormality. The key step is to perform wavelet analysis on the original signal, extract possible abnormal local signal vectors from it, and locate the key points of these local vectors in the entire signal sequence.

[0112] Specifically, assume that in the above steps, this application confirms k abnormal EEG patterns, denoted as {m1, m2, ..., mk}. For each abnormal pattern mj, this application will extract the complete EEG signal sequence Xj corresponding to it during the original EEG acquisition process, where Xj={xj1, xj2, ..., xjn} is an n-dimensional vector representing the entire time series EEG signal under this pattern. This application will perform the following wavelet analysis on each Xj:

[0113] 1. Select a suitable wavelet basis function ψ(t), such as Daubechies4 wavelet;

[0114] 2. Perform wavelet transform on the signal Xj to obtain its detail coefficient sequence {d1j, d2j, ..., dJj} at different scales j and the low-frequency approximate coefficient sequence aJ at scale J;

[0115] 3. Calculate the energy Ej=Σ|djk|^2 for the detail coefficient djk of each scale j, and calculate the energy Ea of the approximate sequence aJ at the same time;

[0116] 4. Find the scale j0 that maximizes both Ej and Ea. This scale is likely to contain the main components of the abnormal signal;

[0117] 5. Under the scale j0, extract the corresponding detail coefficient sequence dj0={dj01,dj02,...,dj0n}, and perform threshold denoising on it to obtain a new sequence d'j0;

[0118] 6. Perform wavelet reconstruction on d'j0 and obtain the reconstructed signal sequence X'j={x'j1,x'j2,...,x'jn} corresponding to the abnormal mode mj.

[0119] The above steps use classic wavelet analysis methods such as wavelet transform, threshold denoising and reconstruction to extract the component X'j that is closely related to the abnormal pattern mj from the original EEG sequence Xj. Compared with Xj, X'j has filtered out most of the noise and irrelevant normal components, and can more clearly reflect the characteristics of the abnormal pattern.

[0120] Next, this application needs to determine the local signal vectors in the X'j sequence and locate the key points of these local vectors in the original sequence Xj to facilitate subsequent abnormal feature analysis and modeling. The specific steps are as follows:

[0121] 1. Calculate the local energy Ejk=Σ|x'j(k+i)|^2 for each element x'jk of the X'j sequence, i=-w / 2,...,w / 2, where w is the energy calculation window width;

[0122] 2. Set the energy threshold Eτ. If Ejk>Eτ, x'jk is considered as a candidate point for the abnormal sequence key point;

[0123] 3. For all candidate key points, cluster them according to their positions in the sequence to obtain m clusters {C1, C2, ..., Cm};

[0124] 4. For all candidate points in each cluster Ci, calculate the cluster energy Ei=ΣEjk, and find the cluster Cmax corresponding to the maximum cluster energy Emax;

[0125] 5. Find the maximum energy point ejmax within Cmax, and regard ejmax as the local key point of the abnormal sequence, denoted as kj;

[0126] 6. Extract the local vector Vj centered on kj from the original sequence Xj, with a length of 2w+1, that is, Vj={xj(kj-w),...,xj(kj),...,xj(kj+w)}.

[0127] Through the above analysis, this application successfully extracted possible abnormal local vectors Vj from the original EEG signal Xj corresponding to the abnormal pattern mj, and located the key point position kj of Vj in the Xj sequence. These local signal vectors are very likely to be the key abnormal pulses that cause the abnormal pattern.

[0128] In some embodiments, obtaining the display vector corresponding to the local key point includes: rotating the local key point to a preset angle; in the mapped EEG feature map, obtaining the image region corresponding to the rotated local key point, and determining the cluster center corresponding to the local key point in the image region; mapping the local key point to the cluster center to obtain multiple mapped points of the local key point in the image region; aggregating the multiple mapped points to obtain the display vector corresponding to the local key point.

[0129] First, the present application needs to perform a rotation transformation on the image region near each key point kj, aiming to eliminate the invariance of the image and improve the accuracy of subsequent feature extraction. Assuming that the set rotation angle is θ, for each kj, the present application will extract a square image region Rj with kj as the center and side length w' (w' < w). Then, the region Rj is rotated by θ degrees to obtain the rotated image region R'j.

[0130] Since there may still be some noise and redundant information in the local image region R'j, the present application needs to perform encoding mapping on it to obtain a more compact and discriminative local vector representation. The method adopted by the present application is the Bag of Visual Words model. First, the present application pre-trains a codebook C = {c1, c2,..., cV} containing V visual words. These visual words are actually representative image feature descriptors obtained through clustering.

[0131] Next, for each pixel point p in the region R'j, the present application extracts the SIFT feature descriptor F(p) according to its gray value, that is, a 128-dimensional vector. Find the visual word cmin in the codebook C that is most similar to F(p), that is, cmin = argmin||F(p) - ci||, i = 1, 2,..., V. The present application uses the index number imin of cmin to correspond to the encoded pixel p, that is, p → imin. Through this mapping encoding, the entire region R'j is encoded as a histogram vector Hj of length V, and Hj(i) represents the number of times the i-th visual word is included in the region.

[0132] Next, the present application needs to map Hj to a cluster center in the codebook C as the final compact representation of the region. Specifically, for each Hj, the present application finds the most similar cluster center cmj in C, that is, cmj=argmax(Hj·ci), i=1,2,...,V. Here "·" represents the vector dot product operation. The cluster center cmj is actually a V-dimensional vector, which can be regarded as the final mapping vector representation of the region R'j. The present application denotes it as Mj=cmj.

[0133] Now, each local region R'j is mapped to a V-dimensional vector Mj. For all key points {k1, k2, ..., kq} of the abnormal pattern, the present application can obtain q corresponding mapping vectors {M1, M2, ..., Mq}. Next, these mapping vectors need to be aggregated to obtain the overall signal display vector of the entire abnormal pattern.

[0134] This application uses a weighted average method for aggregation. For each mapping vector Mj, this application assigns it a weight wj, and the weight value is determined by the local energy value Ekj at the corresponding key point kj, specifically wj=Ekj / sum(Ekj). Then, the overall signal display vector D can be expressed as D=sum(wj*Mj). Intuitively, D is actually the weighted average of all local area mapping vectors, reflecting the main characteristic distribution of abnormal patterns in the entire mapping EEG feature map.

[0135] Finally, a V-dimensional overall signal display vector D is obtained (for example, when V=1024, D is a 1024-dimensional vector). This vector is compact and discriminative, and can focus on reflecting the main abnormal features of the current abnormal EEG pattern.

[0136] For example: Assume that in the above steps, the present application extracts three main key points k1, k2, and k3 from the original EEG signal of the abnormal mode "attention concentration", and the corresponding local energy values ​​are Ek1=25, Ek2=35, and Ek3=18. The present application rotates the regions R1, R2, and R3 near these three key points by θ=30 degrees to obtain the rotated regions R'1, R'2, and R'3.

[0137] Next, encode each R'j. Assume that the visual vocabulary V of this application is 512, that is, the codebook contains 512 visual words {c1, c2, ..., c512}. For each pixel p in R'1, extract its SIFT descriptor F(p), find the nearest neighbor visual word in the codebook, if it is c37, then encode p as 37, and finally get a 512-dimensional histogram vector H1, H1(37) is larger. Similarly, H2 and H3 can be obtained.

[0138] Then, the present application maps H1, H2, and H3 to the cluster centers of the codebook respectively. Assuming that the most similar ones are c215, c103, and c28, M1=c215, M2=c103, and M3=c28. The weights w1=25 / (25+35+18)≈0.33, w2≈0.46, and w3≈0.21 are calculated. The final overall display vector D=0.33M1+0.46M2+0.21M3=0.33c215+0.46c103+0.21c28 is a 512-dimensional vector. It can be seen that D retains more information of M2 and M1, reflecting the main pattern of abnormal distribution.

[0139] Step S105 , extracting a plurality of sampling feature points from the display vector, determining effective feature points among the plurality of sampling feature points, performing wavelet reconstruction on the effective feature points, and obtaining the current signal display feature.

[0140] Specifically, based on the overall display vector obtained in the above steps, sampling feature points are extracted from it; the sampling points are matched with the template to screen out the valid feature points corresponding to the valid difference points; through wavelet reconstruction, the current signal display characteristics are obtained based on these valid feature points.

[0141] Specifically, the first step is to extract sampling feature points based on the overall display vector D. This application regards D as a V×1 grayscale image. By running the standard SIFT algorithm on this image, a series of sampling feature points and their corresponding 128-dimensional SIFT descriptors {(pi, Fi)}, i=1,2,...,N can be obtained. Where pi=(xi,yi) is the two-dimensional coordinate of the i-th sampling point, and Fi is the 128-dimensional SIFT feature vector corresponding to the point. N is the total number of sampling points extracted. These sampling points pi are actually distributed on the V×1 overall display image D, with coordinate values ​​xi∈[1,V],yi=1.

[0142] The sampling point extraction process can be performed according to the following formula: This application first performs Gaussian smoothing on the overall display image D to generate a set of scale spaces L, namely L(x, y, σ) = G(x, y, σ) D(x, y). Here G(x, y, σ) is a two-dimensional Gaussian kernel function, and σ is a scale factor. Next, find extreme points in each scale space L as preliminary key points. For each preliminary key point (x, y, σ), it is necessary to calculate the principal curvature ratio (r) and edge response (e), discard unstable edge response points, and obtain the actual key point. The formula is as follows: H=∂^2L / ∂x^2 [∂^2L / ∂x∂y; ∂^2L / ∂y∂x ∂^2L / ∂y^2] r=(LxxLyy-Lxy^2) / (Lxx+Lyy)^2 e=(Lxx+Lyy)^2 / (Lxx*Lyy-Lxy^2) Using the above key points and their 128-dimensional SIFT descriptors, the present application obtains the sampling feature point representation {(pi,Fi)} of the overall display image D, i=1,2,...,N.

[0143] Next, it is necessary to match these sampling points with the template feature points to find the difference points with significant differences. This application pre-constructs a template vector library T={T1,T2,...,TM}, where each Tj (j=1,2,...,M) is a 128-dimensional vector that reflects the EEG characteristics that should be present under normal circumstances. This application matches each sampling feature point Fi with all vectors Tj in the library T, and calculates the Euclidean distance dij between them. When dij>τ (τ is the preset threshold), it is considered that there is a significant difference between Fi and Tj, and Fi is recorded as a valid difference feature point, recorded as F'i, and the corresponding sampling point coordinates are p'i. Through this matching process, this application obtains a series of valid difference feature point sets {(p'i,F'i)}, i=1,2,...,K.

[0144] The last step is to use these K effective difference feature points to obtain the current signal display feature vector through wavelet reconstruction. The specific steps are:

[0145] 1. For each p'i, extract a small neighborhood S'i with radius r as the center. Perform wavelet decomposition on the overall display vector D on S'i to obtain detail coefficients and approximate coefficients of each scale.

[0146] 2. Only the scale d'i with the largest energy in the detail coefficient is retained, and threshold processing is performed on it to eliminate small amplitude components.

[0147] 3. Using the detail coefficient d'i after eliminating the small amplitude component, wavelet reconstruction is performed to obtain a local eigenvector g'i.

[0148] 4. The final current signal display eigenvector G is taken as the weighted average of all local eigenvectors g'i, that is, G = sum(wi*g'i), i = 1, 2, ..., K. The weight wi is determined by the difference response value of F'i. The larger the difference response, the higher the weight.

[0149] 5. Normalize G and obtain the unit vector as the final current signal display feature.

[0150] The above process utilizes wavelet analysis and reconstruction technology. By performing wavelet decomposition and reconstruction on the overall display vector D near the significant difference feature points, a unit feature vector G reflecting the main abnormal features of the current abnormal EEG pattern is finally obtained. G will serve as an important feature input for subsequent abnormal recognition and classification.

[0151] Step S106, according to the current EEG characteristics and the current signal display characteristics, obtain the current EEG parameters, determine the EEG modulation values ​​corresponding to the current EEG parameters, adjust the original EEG signal according to the EEG modulation values, obtain the cognitive state encoding output signal, and complete the real-time encoding of the cognitive state of the original EEG signal.

[0152] Specifically, in combination with the current EEG features determined in the above steps and the current signal display features obtained in the above steps, the current EEG parameters of each abnormal mode are determined according to the current signal display features, and the EEG modulation values ​​corresponding to the current EEG parameters are determined. The original EEG signal is adjusted according to the EEG modulation value, and the cognitive state encoding output signal is obtained to complete the real-time encoding of the cognitive state of the original EEG signal.

[0153] In some embodiments, determining the current EEG parameters and the EEG modulation values ​​corresponding to the current EEG parameters includes: obtaining standard EEG parameters corresponding to the abnormal EEG features; and determining the EEG modulation values ​​corresponding to the current EEG parameters by comparing the current EEG parameters with the standard EEG parameters.

[0154] This application constructs a Siamese neural network model containing two subnetworks, which is used to extract current EEG parameters and standard EEG parameters from F and G respectively. The input of the first subnetwork is F, which is used to predict the current abnormal EEG parameters. This subnetwork is a 4-layer fully connected neural network. The first layer is a fully connected layer with an input dimension of 512, an output dimension of 256, and an activation function of ReLU; the second layer is a fully connected layer with both input and output dimensions of 256 and an activation function of ReLU; the third layer is a fully connected layer with both input and output dimensions of 128 and an activation function of ReLU; the fourth layer is a fully connected output layer with an input dimension of 128 and an output dimension of K. The activation function is linear, where K is the preset number of current EEG parameters.

[0155] Similarly, the input of the second subnetwork is G, which is used to predict normal standard EEG parameters. Its structure is similar to the first subnetwork, except that the output dimension of the last layer is also K, corresponding to K standard EEG parameters. Through the learning and prediction of these two subnetworks, this application obtains the K-dimensional current EEG parameter vector P1 and the standard EEG parameter vector P2 respectively. In fact, each component value in P1 reflects the characteristic value of the current abnormal mode on the corresponding EEG parameter, while each component in P2 reflects the standard value of the parameter under normal mode.

[0156] The objective function of the above Siamese neural network in the training phase is:

[0157] L(P1,P1',P2,P2')=λ||P1-P1'||^2 + (1-λ)||P2-P2'||^2;

[0158] Where P1' and P2' are the true labeled values ​​of the current EEG parameters and the standard EEG parameters, respectively. ||·|| represents the L2 norm, and λ is a hyperparameter between 0 and 1, which is used to control the importance of the current parameters and the standard parameters. The network parameters are iteratively updated using the stochastic gradient descent optimization algorithm, with a batch size of 64, an initial learning rate of 0.001, and a learning rate decay strategy. After enough iterations, the network can accurately predict the EEG parameter P1 of the current abnormal mode and the standard parameter P2 under normal conditions from F and G.

[0159] These EEG parameters are high-order parameters extracted and fused from the original low-level parameters such as frequency domain, time domain, phase, etc., which can better reflect the core characteristics of abnormal EEG patterns. Specifically, the current EEG parameter P1 may include parameters such as δ wave power ratio, θ wave entropy, β wave bandwidth, α wave phase lock value, overall power spectrum mean, etc. The standard parameter P2 corresponds to parameter values ​​within the normal range.

[0160] For example: Assuming that the number of EEG parameters set in this application is K=8, then P1 and P2 are both 8-dimensional vectors. Through the training and prediction of the Siamese neural network, for an abnormal mode of concentration, this application obtains the corresponding 8-dimensional current parameter vector P1=[0.21 0.38 12.6 0.35 18.2 3.28 0.62 0.47], and the normal standard parameter vector P2=[0.18 0.32 15.7 0.43 20.1 2.85 0.72 0.53].

[0161] From this, the present application can find that in this abnormal mode, compared with the normal situation, the power of the δ wave (the first parameter value 0.21 increases) and the θ wave (the second parameter value 0.38 increases) increases, the α wave bandwidth (the third parameter value 12.6 decreases) and the β wave phase lock value (the fourth parameter value 0.35 decreases) decrease, the center frequency (the fifth parameter value 18.2 decreases) shifts to low frequency, the overall power spectrum mean (the sixth parameter value 3.28 increases) increases, and the phase entropy (the seventh parameter value 0.62 decreases) decreases. These changes reflect the typical physiological change characteristics in the mode of attention concentration.

[0162] Through the above end-to-end prediction network based on the current signal display feature G and the current EEG feature F, this application successfully obtained the current EEG parameter P1 corresponding to each abnormal mode, and the corresponding normal standard parameter P2, preparing for the comparative analysis of the two.

[0163] Compare the current EEG parameter P1 obtained in the above step with the standard parameter P2, and determine the EEG modulation value based on the parameter difference; activate the modulation mode and determine the modulation-related output signal. Based on the EEG modulation value determined in step 0 above, determine the signal adjustment value of the modulated output signal; adjust the modulated output signal in real time according to the adjustment value to complete the cognitive state encoding

[0164] First, the present application compares each component of P1 and P2 one by one, calculates the absolute difference of each component, and obtains a K-dimensional parameter difference vector D, where D(i)=|P1(i)-P2(i)|, i=1,2,...,K. Then a normalization process is applied to D to make its norm 1, and a unit vector d is obtained.

[0165] Based on the experience of medical experts, this application pre-sets K threshold vectors V corresponding to EEG parameters, V=[v1,v2,...,vK]. Each vj,j=1,2,...,K is the maximum allowable threshold value of the jth parameter difference. If d(j)>vj, it means that the current difference of the jth parameter has exceeded the normal range and needs to be modulated. This application records all component indexes j that satisfy d(j)>vj to obtain a parameter index set J that needs to be modulated.

[0166] For each parameter index j in set J, this application will calculate the corresponding modulation value m(j). Assuming m(j)∈[0,1], the calculation formula of m(j) is:

[0167] m(j) = 1 - exp(-(d(j)-vj) / kj);

[0168] Where kj is the modulation scaling factor corresponding to the jth parameter, which is used to control the rate of change of m(j) as d(j) increases. When d(j) is close to vj, m(j) approaches 0, and when d(j) is much larger than vj, m(j) will approach 1. The m(j) values ​​corresponding to all parameter indexes j to be modulated in this application together form an M-dimensional EEG modulation value vector M, M=[m(j1), m(j2), ..., m(jM)], M≤K.

[0169] After having the modulation value vector M, this application needs to activate the corresponding modulation mode and determine the corresponding modulated output signal. This application constructs a modulation network containing M submodules, each submodule corresponds to a modulation mode and can generate an independent output signal. Each submodule is actually a small encoder-decoder network. The encoder encodes the current abnormal EEG signal X into a compact latent vector z, and the decoder generates the corresponding modulated output signal Yj according to the modulation values ​​m(j) and z. Specifically, assuming that the modulation output of the i-th submodule is Yj, then:

[0170] Yj = fj(z,m(j)) = Decoder(Uj*z+bj) Uj = gj(m(j);θj);

[0171] Where gj is the modulation value encoding function corresponding to the jth submodule, which takes m(j) as input and outputs a coding vector Uj. Decoder is the decoder network, which decodes Uj*z+bj into the modulated output signal Yj. It can be seen that Yj is determined by both the potential code z and the modulation value m(j).

[0172] Through the above modulation network, the present application obtains M modulation output signals {Y1, Y2, ..., YM} corresponding to each modulation parameter j. However, in order to obtain the final unified modulation signal Y, the present application also needs to integrate these M signals. The present application adopts the weighted summation method to obtain:

[0173] Y = sum(wjYj), j=1,2,...,M = sum(wjfj(z,m(j)));

[0174] Here wj is the weight coefficient of the j-th modulation signal, which reflects the contribution of this signal to the final output and can be automatically learned through network training.

[0175] Now, this application has obtained the final unified modulated output signal Y based on the EEG modulation value vector M. Next, Y needs to be further adjusted to obtain the final output signal S required for cognitive state encoding. This application will use a moving average filter and adaptive gain adjustment to adjust Y in real time. The purpose of the moving average filter is to suppress high-frequency noise and retain low-frequency components, so that S is smoother; while the adaptive gain is to dynamically adjust the amplitude of S to keep it within a suitable range.

[0176] Let Y(k) be the value of the modulated output signal at the kth time point. In order to obtain a smooth and appropriately amplituded final output S(k), Y(k) must first be subjected to a moving average filter, using the formula sum(y(ki) / N), i=0,1,...,N-1, where N is the moving average window size, which is usually an odd value such as 7 or 9 to ensure filter symmetry.

[0177] The filtered result is multiplied by the adaptive gain coefficient β to adjust the amplitude range. The value of β is dynamically adjusted according to the current amplitude of Y(k). When |Y(k)| is large, β acts to suppress the amplitude; when |Y(k)| is small, β acts to amplify the amplitude so that the output remains in a reasonable range. A simple β calculation method is: β = 1 / (1+α|Y(k)|), where α is a preset constant.

[0178] After filtering and adaptive gain adjustment, the result is weighted and summed with the previous output S(k-1) to obtain the final output S(k). The weight coefficient Λ∈[0,1] controls the contribution of S(k-1) to S(k). The larger the Λ, the smoother S(k); the smaller the Λ, the more responsive S(k) is to the current input Y(k). Usually a larger value of Λ, such as 0.9, is used to obtain a sufficiently smooth output.

[0179] In summary, the calculation formula of S(k) is: S(k) = Λβsum(y(ki) / N) + (1-Λ)S(k-1) = Λβ*filter(y(k)) + (1-Λ)*S(k-1);

[0180] The key to this step is to suppress high-frequency noise through moving average filtering, adjust the amplitude range through adaptive gain, and combine it with the weighted previous output to make the final output S(k) relatively smooth while keeping the amplitude within a reasonable range, thereby completing the real-time adjustment of the modulated output Y(k) and obtaining a smooth and appropriate cognitive state coding output signal.

[0181] Through the above series of steps, the present application successfully determined the EEG modulation value M based on the difference between abnormal EEG parameters and standard parameters, obtained the corresponding modulated output signal Y, and further modulated Y into the final smooth and amplitude-appropriate cognitive state encoding output signal S, thereby completing the entire signal modulation process.

[0182] In order to implement the real-time coding method of virtual reality cognitive state based on EEG signals corresponding to the above method embodiment, so as to achieve corresponding functions and technical effects. Figure 2 , Figure 2 The structure block diagram of a virtual reality cognitive state real-time encoding device 200 provided in an embodiment of the present application is shown. For the convenience of explanation, only the parts related to the present embodiment are shown. The virtual reality cognitive state real-time encoding device 200 provided in an embodiment of the present application includes:

[0183] The parameter extraction module 201 is used to obtain the original EEG signal to be encoded, obtain the current EEG pattern corresponding to the original EEG signal, and extract the EEG parameters corresponding to the current EEG pattern;

[0184] The feature mapping module 202 is used to obtain the current EEG feature vector corresponding to the original EEG signal and obtain the mapped EEG feature map corresponding to the current EEG feature vector according to the original EEG signal and the EEG parameter;

[0185] The result acquisition module 203 is used to extract EEG attributes from the mapped EEG feature graph, obtain the current EEG feature corresponding to the current EEG pattern, compare the current EEG feature with a plurality of reference EEG features, and obtain a comparison result corresponding to each reference EEG feature;

[0186] A vector acquisition module 204 is used to identify an abnormal EEG feature in the plurality of reference EEG features according to the comparison result, extract a local signal corresponding to the abnormal EEG feature and a local key point in the local signal from the original EEG signal, and acquire a display vector corresponding to the local key point;

[0187] A display acquisition module 205 is used to extract multiple sampling feature points from the display vector, determine valid feature points among the multiple sampling feature points, perform wavelet reconstruction on the valid feature points, and obtain current signal display features;

[0188] The encoding completion module 206 is used to obtain the current EEG parameters according to the current EEG characteristics and the current signal display characteristics, determine the EEG modulation values ​​corresponding to the current EEG parameters, adjust the original EEG signal according to the EEG modulation values, obtain the cognitive state encoding output signal, and complete the real-time encoding of the cognitive state of the original EEG signal.

[0189] The above-mentioned virtual reality cognitive state real-time encoding device 200 can implement the virtual reality cognitive state real-time encoding method based on EEG signals 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 this application can refer to the contents of the above-mentioned method embodiment, and will not be repeated in this embodiment.

[0190] 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.

[0191] 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.

[0192] 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.

[0193] 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.

[0194] 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.

[0195] 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.

[0196] 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.

[0197] 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.

[0198] 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 real-time encoding method for virtual reality cognitive state based on EEG signals, characterized in that: include: Acquire an original EEG signal to be encoded, acquire a current EEG pattern corresponding to the original EEG signal, and extract EEG parameters corresponding to the current EEG pattern; According to the original EEG signal and the EEG parameters, obtaining a current EEG feature vector corresponding to the original EEG signal, and obtaining a mapped EEG feature graph corresponding to the current EEG feature vector; Extracting EEG attributes from the mapped EEG feature graph to obtain a current EEG feature corresponding to the current EEG pattern, comparing the current EEG feature with a plurality of reference EEG features, and obtaining a comparison result corresponding to each of the reference EEG features; Confirming an abnormal EEG feature among the plurality of reference EEG features according to the comparison result, extracting a local signal corresponding to the abnormal EEG feature and a local key point in the local signal from the original EEG signal, and acquiring a display vector corresponding to the local key point; Extracting a plurality of sampling feature points from the display vector, determining a valid feature point among the plurality of sampling feature points, performing wavelet reconstruction on the valid feature point, and obtaining a current signal display feature; According to the current EEG characteristics and the current signal display characteristics, the current EEG parameters are obtained, the EEG modulation values ​​corresponding to the current EEG parameters are determined, the original EEG signals are adjusted according to the EEG modulation values, the cognitive state encoding output signals are obtained, and the cognitive state real-time encoding of the original EEG signals is completed; The extracting of the local signal corresponding to the abnormal EEG feature and the local key point in the local signal from the original EEG signal comprises: Obtaining the occurrence time corresponding to the abnormal EEG feature, and extracting an EEG signal segment from the original EEG signal according to the occurrence time; Performing wavelet decomposition on the EEG signal segment to obtain multiple signal components corresponding to the EEG signal segment; Acquire energy information corresponding to each of the signal components, and determine an energy concentration scale in the energy information; Extracting the local signal and the local key point in the EEG signal segment according to the energy concentration scale; The obtaining of the display vector corresponding to the local key point includes: Rotating the local key point to a preset angle; In the mapped EEG feature map, obtaining an image region corresponding to the rotated local key point, and determining a cluster center corresponding to the local key point in the image region; Mapping the local key point to the cluster center to obtain a plurality of mapping points of the local key point in the image area; Aggregate a plurality of the mapping points to obtain a display vector corresponding to the local key point.

2. The method according to claim 1, characterized in that The obtaining of the current EEG pattern corresponding to the original EEG signal includes: Decoding the original EEG signal; Preprocessing the decoded original EEG signal; wherein the preprocessing includes removing power frequency noise, baseline correction, interpolation processing and resampling; Performing a fast Fourier transform on the preprocessed original EEG signal to obtain the power spectrum density of the original EEG signal in multiple preset frequency bands; The power spectrum density is analyzed to determine a current EEG pattern corresponding to the original EEG signal.

3. The method according to claim 2, characterized in that The step of analyzing the power spectrum density to determine the current EEG pattern corresponding to the original EEG signal includes: Constructing a density feature vector according to a plurality of said power spectrum densities; The density feature vector is input into a pre-trained pattern classifier, and the pattern classifier matches the density feature vector with a reference feature vector corresponding to a pre-stored reference EEG pattern to output a reference EEG pattern corresponding to the successfully matched reference feature vector as the current EEG pattern.

4. The method according to claim 1, characterized in that: The step of comparing the current EEG feature with a plurality of reference EEG features to obtain a comparison result corresponding to each reference EEG feature includes: Calculating the Mahalanobis distance between the current EEG feature vector corresponding to the current EEG feature and the reference vector corresponding to each reference EEG feature; Normalization is performed on the multiple Mahalanobis distances to obtain the comparison result.

5. The method according to claim 1, characterized in that The determining of the current EEG parameter and the EEG modulation value corresponding to the current EEG parameter includes: Obtaining standard EEG parameters corresponding to the abnormal EEG features; The EEG modulation value corresponding to the current EEG parameter is determined by comparing the current EEG parameter with the standard EEG parameter.

6. A real-time encoding device for virtual reality cognitive state, characterized in that: A method for implementing real-time encoding of virtual reality cognitive state according to any one of claims 1 to 5, comprising: A parameter extraction module is used to obtain the original EEG signal to be encoded, obtain the current EEG pattern corresponding to the original EEG signal, and extract the EEG parameters corresponding to the current EEG pattern; A feature mapping module, used to obtain a current EEG feature vector corresponding to the original EEG signal and a mapped EEG feature map corresponding to the current EEG feature vector according to the original EEG signal and the EEG parameters; A result acquisition module is used to extract EEG attributes from the mapped EEG feature graph, obtain the current EEG feature corresponding to the current EEG pattern, compare the current EEG feature with a plurality of reference EEG features, and obtain a comparison result corresponding to each reference EEG feature; A vector acquisition module, used to confirm an abnormal EEG feature in the plurality of reference EEG features according to the comparison result, extract a local signal corresponding to the abnormal EEG feature and a local key point in the local signal from the original EEG signal, and acquire a display vector corresponding to the local key point; A display acquisition module, used to extract multiple sampling feature points from the display vector, determine effective feature points among the multiple sampling feature points, perform wavelet reconstruction on the effective feature points, and obtain current signal display features; The encoding completion module is used to obtain the current EEG parameters according to the current EEG characteristics and the current signal display characteristics, determine the EEG modulation values ​​corresponding to the current EEG parameters, adjust the original EEG signal according to the EEG modulation values, obtain the cognitive state encoding output signal, and complete the real-time encoding of the cognitive state of the original EEG signal.

7. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the steps of the real-time encoding method of virtual reality cognitive state based on EEG signals as described in any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, enables the processor to implement the steps of the real-time encoding method of virtual reality cognitive state based on EEG signals as described in any one of claims 1 to 5.