A brain-machine model training sample rapid generation method
By extracting the covariance matrix eigenvectors and filters from brain-computer interface (BCI) samples, separating positive and negative effective features, calculating their contribution, and randomly selecting features to generate BCI model training samples, the problem of lengthy training time is solved, and the effect of rapidly generating high-quality samples is achieved.
Patent Information
- Application Number
- CN202310682515.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-09
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2043-06-09
AI Technical Summary
In existing technologies, the limited number of training samples for brain-computer interfaces leads to lengthy training times and makes it difficult to quickly generate high-quality training samples.
By acquiring brain-computer interface samples of known categories, the first-order and second-order feature vector matrices of the covariance matrix are extracted to form a filter for filtering and noise reduction. Multi-scale features are separated and positive and negative effective features are divided. The feature contribution is calculated using the L1 norm. A training sample generation algorithm is generated by randomly selecting features to generate training samples and designing iterative parameters to avoid duplicate samples.
It can quickly generate a large number of different training samples, improve sample quality, reduce training time, avoid generating duplicate samples, and improve training efficiency.
Smart Images

Figure CN116701937B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of training sample generation, and in particular to a method for rapidly generating training samples for brain-computer interfaces. Background Technology
[0002] Brain-computer interfaces (BCIs) are communication systems that utilize external devices to communicate with the outside world without relying on peripheral nerves and muscles. One of the main reasons limiting the practical application of BCI systems is the excessively small number of training samples, leading to lengthy training times. To address this issue, this invention proposes a method for rapidly generating training samples for BCI models. This method generates a large number of training samples for BCI models without sacrificing classification accuracy, thereby reducing the training time of BCI systems. Summary of the Invention
[0003] In view of this, the present invention provides a method for rapidly generating training samples for brain-computer interfaces (BCIs). The purpose is to: 1) acquire several sets of BCI samples of known BCI training sample categories; for samples of the same category, extract the first-order and second-order eigenvector matrices of the covariance matrix to construct filters for the corresponding category of EEG signals; and then perform filtering and noise reduction on EEG signals containing several types of interference signals. By performing multi-scale feature separation on the BCI sample features, the number of BCI sample features is expanded, and the L1 norm is used to determine the information content contained in the separated features, achieving the division of positive and negative effective features. The contribution of different effective features is calculated, with positive effective features having a higher contribution and containing more information. The higher the information value, the higher the contribution of the feature is selected to generate training samples and improve the quality of the generated samples; 2) Based on the positive and negative effective features and their contribution of any set of brain-computer samples collected, generate several sets of brain-computer model training samples. Select a random number of separation features to participate in the generation of training samples according to the generated random number. Among them, the separation feature with higher feature contribution has a higher probability of being selected for the generation of training samples. The iterative parameters are designed to change with the increase of the number of generated training samples to avoid selecting the same separation feature and generating the same training samples. The training sample generation algorithm does not include feature mapping and sampling processing algorithms, and the sample generation speed is fast, thus quickly generating a large number of different training samples.
[0004] To achieve the above objectives, the present invention provides a method for rapidly generating training samples for brain-computer interfaces, comprising the following steps:
[0005] S1: Collect brain-computer interface (BCI) samples and preprocess them. Extract features from the preprocessed BCI samples to obtain BCI sample features.
[0006] S2: Separate the features of the brain-computer interface sample to obtain the positive and negative effective features of the brain-computer interface sample, and calculate the contribution of different effective features;
[0007] S3: Generate brain-computer model training samples based on the positive and negative effective features and their contribution of the obtained brain-computer samples;
[0008] S4: Calculate the higher-order moments of the generated brain-computer interface training samples, and determine whether the higher-order moments of the generated training samples are within the threshold range. If they are, retain the training sample; otherwise, discard it.
[0009] As a further improvement of the present invention:
[0010] Optionally, the brain-computer interface sample collection and preprocessing in step S1 includes:
[0011] Electrode pads are used to collect electroencephalogram (EEG) signals, and the corresponding brain-computer interface (BCI) model training sample categories are collected to form BCI samples. In this embodiment of the invention, the BCI model training sample categories include emotion categories, language categories, and action categories of EEG signals, etc., and the resulting BCI sample set is as follows:
[0012] {s n =(x n (t), label n |n∈[1,N]}
[0013] x n (t)=[x n (t start (n)), x n (t start (n)+Δt),…,x n (t end (n))]
[0014] in:
[0015] s n This represents the nth group of brain-computer interface (BCI) samples in the BCI sample set.
[0016] x n (t) represents brain-computer interface sample s n In the context of EEG signals, t represents the EEG signal x. n The temporal information of (t), t∈[t start (n), t end (n)];
[0017] t start (n) represents the brain electrical signal x n (t) The initial time of data collection, t end (n) represents the cutoff time for EEG signal acquisition, and the time interval between adjacent acquisition times is Δt; in this embodiment of the invention, the time interval between adjacent acquisitions of all EEG signals is Δt, and the acquisition duration is the same;
[0018] label n Indicates brain-computer interface sample s n The corresponding brain-computer interface model training sample categories;
[0019] For any nth brain-computer interface sample s n Preprocessing operations are performed, and the preprocessing process is as follows:
[0020] S11: Calculate the EEG signal x n The covariance matrix of (t):
[0021]
[0022] in:
[0023] T represents transpose, and trace(·) represents the trace of the matrix obtained by calculation;
[0024] Cov(x n (t) represents the brain electrical signal x n The covariance matrix of (t);
[0025] S12: Obtain brain-computer interface model training samples with the category "label" from the brain-computer interface sample set. n The set of EEG signals is used to calculate the mean covariance matrix of all EEG signals in the set.
[0026] S13: For the mean covariance matrix Perform eigenvalue decomposition to obtain the average covariance matrix. Given m eigenvalues and eigenvectors, sort the eigenvalues and eigenvectors in descending order of eigenvalues, where the average covariance matrix is... The sorting result of the m eigenvalues and eigenvectors is as follows:
[0027] (λ1, λ2, ..., λ) m )
[0028] (α1, α2, ..., α) m )
[0029] in:
[0030] λ m Represents the average covariance matrix The m-th eigenvalue, α m Represents the eigenvalue λ m The corresponding feature vector;
[0031] Construct the transformation matrix C from the eigenvectors:
[0032]
[0033] α = [α1, α2, ..., α] m ]
[0034] S14: Perform eigenvalue decomposition on the transformation matrix C to obtain m eigenvalues and eigenvectors of the transformation matrix C. Sort the eigenvectors in descending order of eigenvalues and construct the eigenvector matrix β from the sorted eigenvectors.
[0035] β = [β1, β2, ..., β] m ]
[0036] in:
[0037] β m This represents the m-th eigenvector of the transformation matrix C;
[0038] S15: Construct brain-computer interface model training samples with the category of label. n The filter W of the EEG signal n :
[0039] W n =β T α
[0040] S16: Using filter W n For EEG signals x n (t) is filtered:
[0041] x′ n (t)=W n x n (t)
[0042] in:
[0043] x′ n (t) represents the EEG signal x n The filtering result of (t).
[0044] Optionally, in step S1, feature extraction is performed on the preprocessed brain-computer interface (BCI) samples to obtain BCI sample features, including:
[0045] Feature extraction was performed on the preprocessed brain-computer interface (BCI) samples to obtain BCI sample features, including the electroencephalogram (EEG) signal x′. n The brain-computer interface sample feature extraction process for (t) is as follows:
[0046] The EEG signal x′ was calculated. n The variance matrix Var(x′) of (t) n (t)), where:
[0047] x′ n (t)=[x′ n (t start (n)), x′ n(t start (n)+Δt),...,x′ n (t end (n))]
[0048] in:
[0049] x′ n (t start (n) represents the EEG signal x′ n (t) at t start (n) is the signal value at time n;
[0050] In this embodiment of the invention, Var(x′) n (t))=E[(x′ n (t)-μ n )(x′ n (t)-μ n ) T ], where E(·) represents the expected value, μ n Represents the brainwave signal x′ n The signal mean of (t), t∈[t] start (n), t end (n)];
[0051] Logarithmic transformation of the variance matrix:
[0052] A(x′ n (t))=log(Var(x′ n (t)))
[0053] in:
[0054] A(x′ n (t) represents the variance matrix Var(x′). n The logarithmic transformation result of (t)), where matrix A(x′) n The number of rows and columns of (t) are equal, and both are EEG signals x′ n The total number of signal acquisition times (t);
[0055] Extract A(x′) n The main diagonal elements of (t) constitute the EEG signal x′ n Brain-computer interface sample features f(x′) n (t)).
[0056] Optionally, the separation process of brain-computer interface sample features in step S2 includes:
[0057] The brain-computer interface (BCI) sample features are separated to obtain multi-scale BCI sample features. These separated multi-scale BCI sample features are then classified into positive effective features and negative effective features, where the BCI sample feature f(x′) is...n The separation process of (t) is as follows:
[0058] S21: The brain-computer interface sample features f(x′) n (t) is used as the original feature to obtain f(x′). n By identifying all extreme points of (t) and distinguishing between minimum and maximum points, the brain-computer interface sample features f(x′) are obtained. n The set of minimum and maximum points of (t));
[0059] S22: Use cubic spline interpolation to interpolate the set of minimum points and the set of maximum points respectively. The interpolation result of the set of minimum points is the lower envelope, and the interpolation result of the set of maximum points is the upper envelope.
[0060] S23: Calculate the mean of the upper and lower envelopes, and calculate the difference between the original feature and the mean;
[0061] If the difference between the number of zeros and the number of extreme points in the difference result is less than or equal to 1, and the mean of the upper and lower envelopes of the difference result is 0, then the difference between the original feature and the mean is taken as the brain-computer sample feature f(x′). n (t) Separation features f at scale a a (x′ n (t)), and let a = a + 1, separate the feature f a (x′ n (t) is used as the original feature, and the process returns to step S21, where the initial value of a is 1 and the maximum value is M, to obtain the brain-computer sample feature f(x′). n (t) Separation features at M scales;
[0062] Otherwise, the difference between the original feature and the mean is set as the original feature, and the process returns to step S21; in this embodiment of the invention, the brain-computer sample features and the separation features have the same length.
[0063] S24: The separated multi-scale brain-computer interface sample features are distinguished into positive effective features and negative effective features, where the separation feature f a (x′ n The distinction result of (t) is:
[0064]
[0065] in:
[0066] ||·|| denotes the L1 norm;
[0067] Represents the separating feature f a (x′ n The distinction result of (t)) if Then it represents the separating feature f a (x′ n (t) is a positive effective feature. Then it represents the separating feature f a (x′ n (t) is a negative effective feature;
[0068] th1 represents the preset feature threshold;
[0069] The sets of positive and negative effective features of the N groups of brain-computer interface samples are as follows:
[0070]
[0071] in:
[0072] s′ n (a) represents the separation feature information of the Nth brain-computer interface sample at scale a.
[0073] Optionally, the calculation of the contribution of different effective features in step S2 includes:
[0074] Calculate the contribution of brain-computer interface sample separation features, where the separation feature f a (x′ n The contribution of (t) is:
[0075]
[0076]
[0077] in:
[0078] count(label n The label indicates that the training samples of the brain-computer interface model are classified as "label" among the N groups of brain-computer interface samples collected. n The number of brain-computer interface samples;
[0079] This represents the average separation feature of all brain-computer interface samples with category labeln as the training sample of the brain-computer interface model.
[0080] sim(·) represents the cosine similarity algorithm;
[0081] ||·||2 represents the L2 norm;
[0082] Represents the separating feature f a (x′ n The contribution of (t));
[0083] exp{·} denotes an exponential function with the natural constant as its base.
[0084] Optionally, step S3, which generates brain-computer model training samples based on the effective features and contribution of the obtained brain-computer samples, includes:
[0085] Brain-computer interface (BCI) model training samples are generated based on the positive and negative effective features and their contribution values of any set of collected BCI samples. The process for generating BCI model training samples based on the nth set of BCI samples is as follows:
[0086] S31: Set the training sample number of the brain-computer model generated based on the nth group of brain-computer samples to k, with an initial value of 1 and a maximum value of K; and generate parameters δ1 and δ2.
[0087] S32: Generate a random number between 0 and 1, rand(0, 1);
[0088] S33: Randomly select from the M separation features of the nth brain-computer interface sample. There are _ ...
[0089]
[0090] in:
[0091] This indicates that during the generation of the brain-computer model training sample with number i, a separation feature of scale a was not selected; This indicates that during the generation of the brain-computer interface training sample numbered i, a separation feature with scale a is selected; when k=1,
[0092] This represents the probability of selecting a separation feature of scale a during the generation of training samples for the brain-computer interface model with number k.
[0093] S34: Generate brain-computer interface training samples with ID k. Brain-computer interface training samples The formula for generating it is:
[0094]
[0095]
[0096] in:
[0097] g j (k) represents the training samples selected in step S33 for generating the brain-computer interface model. The j-th separation feature;
[0098] λ k Indicates the training samples used to generate brain-computer interface models. The iteration parameters;
[0099] The generated brain-computer interface training samples The form is a vector representation of the EEG signal, and the corresponding brain-computer interface model training sample category is label. n ;
[0100] If k < K, then let k = k + 1 and return to step S32; otherwise, terminate the brain-computer model training sample generation algorithm based on the nth group of brain-computer samples to obtain K groups of brain-computer model training samples.
[0101] Optionally, the calculation of higher-order moments of the generated brain-computer interface model training samples in step S4 includes:
[0102] Calculate the higher-order moments of the generated brain-computer interface training samples, where the brain-computer interface training samples... The formula for calculating higher-order moments is:
[0103]
[0104] in:
[0105] This represents the generated brain-computer interface model training samples. higher-order moments;
[0106] This represents the generated brain-computer interface model training samples. Length;
[0107] like If the training samples of the brain-computer interface are less than or equal to a preset threshold, then... To obtain effective training samples, brain-computer interface (BCI) model training sample categories are added to create BCI model training samples with sample categories. Save the generated brain-computer interface training samples; otherwise, discard them. In this embodiment of the invention, the larger the higher-order moments of the training samples, the more obvious the maximum signal values in the generated training samples, and the greater the probability of them being abnormal EEG signals.
[0108] To address the above problems, the present invention provides an electronic device, the electronic device comprising:
[0109] Memory, storing at least one instruction;
[0110] Communication interfaces enable communication between electronic devices; and
[0111] The processor executes the instructions stored in the memory to implement the brain-computer model training sample rapid generation method described above.
[0112] To address the aforementioned problems, the present invention also provides a computer-readable storage medium storing at least one instruction, which is executed by a processor in an electronic device to implement the aforementioned method for rapidly generating brain-computer interface training samples.
[0113] Compared with existing technologies, this invention proposes a method for rapidly generating training samples for brain-computer interfaces, which has the following advantages:
[0114] First, this scheme proposes an effective feature selection method, which distinguishes the separated multi-scale brain-computer interface sample features into positive effective features and negative effective features, wherein the separation feature f a (x′ n The distinction result of (t) is:
[0115]
[0116] Where: ||·|| represents the L1 norm; Represents the separating feature f a (x′ n The distinction result of (t)) if Then it represents the separating feature f a (x′ n (t) is a positive effective feature. Then it represents the separating feature f a (x′ n (t) represents the negative effective feature; th1 represents the pre-set feature threshold; the set of positive and negative effective features of the N groups of brain-computer samples is as follows:
[0117]
[0118] Where: s′ n (a) represents the separation feature information of the Nth group of brain-computer interface samples at scale a. The contribution of the separation features of the brain-computer interface samples is calculated, where the separation feature f is... a (x′ n The contribution of (t) is:
[0119]
[0120]
[0121] Where: count(label) n The label indicates that the training samples of the brain-computer interface model are classified as "label" among the N groups of brain-computer interface samples collected. n The number of brain-computer interface samples; The training samples for the brain-computer interface model are categorized as labels. nThe average separation features of all brain-computer interface samples; sim(·) denotes the cosine similarity algorithm; ||·||2 denotes the L2 norm; Represents the separating feature f a (x′ n The contribution of (t) is used; exp{·} represents the exponential function with the natural constant as the base. This scheme obtains several sets of brain-computer interface (BCI) samples of known BCI model training sample categories. For samples of the same category, the first-order eigenvector matrix and the second-order eigenvector matrix of the covariance matrix are extracted to form a filter for the BCI signal of that category. Then, the BCI signal containing several kinds of interference signals is filtered and denoised. By performing multi-scale feature separation on the features of the BCI samples, the number of features of the BCI samples is expanded. The L1 norm is used to determine the amount of information contained in the separated features, realizing the division of positive and negative effective features. The contribution of different effective features is calculated. Among them, the higher the contribution of positive effective features, the higher the information value contained. Then, the features with higher contribution are selected to generate training samples, thereby improving the quality of the generated samples.
[0122] Meanwhile, this scheme proposes a training sample generation algorithm, which generates brain-computer model training samples based on the positive and negative effective features and their contribution values of any set of collected brain-computer samples. The process of generating brain-computer model training samples based on the nth set of brain-computer samples is as follows: set the number of the brain-computer model training sample generated based on the nth set of brain-computer samples as k, the initial value of k is 1, and the maximum value is K; and generate parameters δ1 and δ2; generate a random number rand(0,1) between 0 and 1; and randomly select from the M separating features of the nth set of brain-computer samples. There are _ ...
[0123]
[0124] in: This indicates that during the generation of the brain-computer model training sample with number i, a separation feature of scale a was not selected; This indicates that during the generation of the brain-computer interface training sample numbered i, a separation feature with scale a is selected; when k=1, This represents the probability of selecting a separating feature of scale a during the generation of training samples for the brain-computer interface model numbered k; (The last part, "Generate training samples for the brain-computer interface model numbered k," appears to be a separate, unrelated statement and is left untranslated.) Brain-computer interface training samples The formula for generating it is:
[0125]
[0126]
[0127] Wherein: g j (k) represents the selected training samples used to generate the brain-computer interface model. The j-th separation feature; λ k Indicates the training samples used to generate brain-computer interface models. The iteration parameters; the generated brain-computer interface model training samples The form is a vector representation of the EEG signal, and the corresponding brain-computer interface model training sample category is label. n If k < K, then let k = k + 1; otherwise, terminate the brain-computer interface model training sample generation algorithm based on the nth group of brain-computer interface samples, obtaining K groups of brain-computer interface model training samples. This scheme generates several groups of brain-computer interface model training samples based on the positive and negative effective features and their contribution values of any collected group of brain-computer interface samples. A random number of separating features are selected based on the generated random numbers to participate in the training sample generation. Separating features with higher contribution values have a higher probability of being selected for training sample generation. An iterative parameter is designed to change as the number of generated training samples increases, avoiding the selection of the same separating features and the generation of identical training samples. Furthermore, the training sample generation algorithm does not include feature mapping or sampling processing algorithms, resulting in fast sample generation speed and the rapid generation of a large number of different training samples. Attached Figure Description
[0128] Figure 1 This is a flowchart illustrating a method for rapidly generating training samples for a brain-computer interface model, as provided in an embodiment of the present invention.
[0129] Figure 2 This is a schematic diagram of an electronic device for implementing a method for rapidly generating training samples for brain-computer interfaces, according to an embodiment of the present invention.
[0130] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0131] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0132] This application provides a method for rapidly generating training samples for brain-computer interfaces (BCIs). The execution entity of this method includes, but is not limited to, at least one electronic device configured to execute the method provided in this application, such as a server or a terminal. In other words, the method can be executed by software or hardware installed on a terminal device or a server device, and the software may be a blockchain platform. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cloud server cluster.
[0133] Example 1:
[0134] S1: Collect brain-computer interface (BCI) samples and preprocess them. Extract features from the preprocessed BCI samples to obtain BCI sample features.
[0135] Step S1 involves collecting brain-computer interface samples and performing preprocessing, including:
[0136] Electrode pads are used to collect electroencephalogram (EEG) signals, and the corresponding brain-computer interface (BCI) model training sample categories are collected to form BCI samples. In this embodiment of the invention, the BCI model training sample categories include emotion categories, language categories, and action categories of EEG signals, etc., and the resulting BCI sample set is as follows:
[0137] {s n =(x n (t), label n |n∈[1,N]}
[0138] x n (t)=[x n (t start (n)), x n (t start (n)+Δt),…,x n (t end (n))]
[0139] in:
[0140] s n This represents the nth group of brain-computer interface (BCI) samples in the BCI sample set.
[0141] x n (t) represents brain-computer interface sample s n In the context of EEG signals, t represents the EEG signal x. n The temporal information of (t), t∈[t start (n), t end (n)];
[0142] t start (n) represents the brain electrical signal x n (t) The initial time of data collection, t end (n) represents the cutoff time for EEG signal acquisition, and the time interval between adjacent acquisition times is Δt; in this embodiment of the invention, the time interval between adjacent acquisitions of all EEG signals is Δt, and the acquisition duration is the same;
[0143] label n Indicates brain-computer interface sample s n The corresponding brain-computer interface model training sample categories;
[0144] For any nth brain-computer interface sample s nPreprocessing operations are performed, and the preprocessing process is as follows:
[0145] S11: Calculate the EEG signal x n The covariance matrix of (t):
[0146]
[0147] in:
[0148] T represents transpose, and trace(·) represents the trace of the matrix obtained by calculation;
[0149] Cov(x n (t) represents the brain electrical signal x n The covariance matrix of (t);
[0150] S12: Obtain brain-computer interface model training samples with the category "label" from the brain-computer interface sample set. n The set of EEG signals is used to calculate the mean covariance matrix of all EEG signals in the set.
[0151] S13: For the mean covariance matrix Perform eigenvalue decomposition to obtain the average covariance matrix. Given m eigenvalues and eigenvectors, sort the eigenvalues and eigenvectors in descending order of eigenvalues, where the average covariance matrix is... The sorting result of the m eigenvalues and eigenvectors is as follows:
[0152] (λ1, λ2, ..., λ) m )
[0153] (α1, α2, ..., α) m )
[0154] in:
[0155] λ m Represents the average covariance matrix The m-th eigenvalue, α m The eigenvalue λ represents the eigenvalue. m The corresponding feature vector;
[0156] Construct the transformation matrix C from the eigenvectors:
[0157]
[0158] α = [α1, α2, ..., α] m ]
[0159] S14: Perform eigenvalue decomposition on the transformation matrix C to obtain m eigenvalues and eigenvectors of the transformation matrix C. Sort the eigenvectors in descending order of eigenvalues and construct the eigenvector matrix β from the sorted eigenvectors.
[0160] β = [β1, β2, ..., β] m ]
[0161] in:
[0162] β m This represents the m-th eigenvector of the transformation matrix C;
[0163] S15: Construct brain-computer interface model training samples with the category of label. n The filter W of the EEG signal n :
[0164] W n =β T α
[0165] S16: Using filter W n For EEG signals x n (t) is filtered:
[0166] x′ n (t)=W n x n (t)
[0167] in:
[0168] x′ n (t) represents the EEG signal x n The filtering result of (t).
[0169] In step S1, feature extraction is performed on the preprocessed brain-computer interface (BCI) samples to obtain BCI sample features, including:
[0170] Feature extraction was performed on the preprocessed brain-computer interface (BCI) samples to obtain BCI sample features, including the electroencephalogram (EEG) signal x′. n The brain-computer interface sample feature extraction process for (t) is as follows:
[0171] The EEG signal x′ was calculated. n The variance matrix Var(x′) of (t) n (t)), where:
[0172] x′ n (t)=[x′ n (t start (n)), x′ n (t start (n)+Δt),…,x′ n (t end(n))]
[0173] in:
[0174] x′ n (t start (n) represents the EEG signal x′ n (t) at t start (n) is the signal value at time n;
[0175] In this embodiment of the invention, Var(x′) n (t))=E[(x′ n (t)-μ n )(x′ n (t)-μ n ) T ], where E(·) represents the expected value, μ n Represents the brainwave signal x′ n The signal mean of (t), t∈[t] start (n), t end (n)];
[0176] Logarithmic transformation of the variance matrix:
[0177] A(x′ n (t))=log(Var(x′ n (t)))
[0178] in:
[0179] A(x′ n (t) represents the variance matrix Var(x′). n The logarithmic transformation result of (t)), where matrix A(x′) n The number of rows and columns of (t) are equal, and both are EEG signals x′ n The total number of signal acquisition times (t);
[0180] Extract A(x′) n The main diagonal elements of (t) constitute the EEG signal x′ n Brain-computer interface sample features f(x′) n (t)).
[0181] S2: Separate the features of the brain-computer interface sample to obtain the positive and negative effective features of the brain-computer interface sample, and calculate the contribution of different effective features.
[0182] The S2 step involves separating the brain-computer interface sample features, including:
[0183] The brain-computer interface (BCI) sample features are separated to obtain multi-scale BCI sample features. These separated multi-scale BCI sample features are then classified into positive effective features and negative effective features, where the BCI sample feature f(x′) is... n The separation process of (t) is as follows:
[0184] S21: The brain-computer interface sample features f(x′) n (t) is used as the original feature to obtain f(x′). n By identifying all extreme points of (t) and distinguishing between minimum and maximum points, the brain-computer interface sample features f(x′) are obtained. n The set of minimum and maximum points of (t));
[0185] S22: Use cubic spline interpolation to interpolate the set of minimum points and the set of maximum points respectively. The interpolation result of the set of minimum points is the lower envelope, and the interpolation result of the set of maximum points is the upper envelope.
[0186] S23: Calculate the mean of the upper and lower envelopes, and calculate the difference between the original feature and the mean;
[0187] If the difference between the number of zeros and the number of extreme points in the difference result is less than or equal to 1, and the mean of the upper and lower envelopes of the difference result is 0, then the difference between the original feature and the mean is taken as the brain-computer sample feature f(x′). n (t) Separation features f at scale a a (x′ n (t)), and let a = a + 1, separate the feature f a (x′ n (t) is used as the original feature, and the process returns to step S21, where the initial value of a is 1 and the maximum value is M, to obtain the brain-computer sample feature f(x′). n (t) Separation features at M scales;
[0188] Otherwise, the difference between the original feature and the mean is set as the original feature, and the process returns to step S21; in this embodiment of the invention, the brain-computer sample features and the separation features have the same length.
[0189] S24: The separated multi-scale brain-computer interface sample features are distinguished into positive effective features and negative effective features, where the separation feature f a (x′ n The distinction result of (t) is:
[0190]
[0191] in:
[0192] ||·|| denotes the L1 norm;
[0193] Represents the separating feature f a (x′ n The distinction result of (t)) if Then it represents the separating feature f a (x′ n (t) is a positive effective feature. Then it represents the separating feature f a (x′ n (t) is a negative effective feature;
[0194] th1 represents the preset feature threshold;
[0195] The sets of positive and negative effective features of the N groups of brain-computer interface samples are as follows:
[0196]
[0197] in:
[0198] s′ n (a) represents the separation feature information of the Nth brain-computer interface sample at scale a.
[0199] The calculation of the contribution of different effective features in step S2 includes:
[0200] Calculate the contribution of brain-computer interface sample separation features, where the separation feature f a (x′ n The contribution of (t) is:
[0201]
[0202]
[0203] in:
[0204] count(label n The label indicates that the training samples of the brain-computer interface model are classified as "label" among the N groups of brain-computer interface samples collected. n The number of brain-computer interface samples;
[0205] This represents the average separation feature of all brain-computer interface samples with category labeln as the training sample of the brain-computer interface model.
[0206] sim(·) represents the cosine similarity algorithm;
[0207] ||·||2 represents the L2 norm;
[0208] Represents the separating feature f a (x′ n The contribution of (t));
[0209] exp{·} denotes an exponential function with the natural constant as its base.
[0210] S3: Generate brain-computer model training samples based on the positive and negative effective features and their contribution of the obtained brain-computer samples.
[0211] Step S3 generates brain-computer model training samples based on the effective features and contribution of the obtained brain-computer samples, including:
[0212] Brain-computer interface (BCI) model training samples are generated based on the positive and negative effective features and their contribution values of any set of collected BCI samples. The process for generating BCI model training samples based on the nth set of BCI samples is as follows:
[0213] S31: Set the training sample number of the brain-computer model generated based on the nth group of brain-computer samples to k, with an initial value of 1 and a maximum value of K; and generate parameters δ1 and δ2.
[0214] S32: Generate a random number between 0 and 1, rand(0, 1);
[0215] S33: Randomly select from the M separation features of the nth brain-computer interface sample. There are _ ...
[0216]
[0217] in:
[0218] This indicates that during the generation of the brain-computer model training sample with number i, a separation feature of scale a was not selected; This indicates that during the generation of the brain-computer interface training sample numbered i, a separation feature with scale a is selected; when k=1,
[0219] This represents the probability of selecting a separation feature of scale a during the generation of training samples for the brain-computer interface model with number k.
[0220] S34: Generate brain-computer interface training samples with ID k. Brain-computer interface training samples The formula for generating it is:
[0221]
[0222]
[0223] in:
[0224] g j(k) represents the training samples selected in step S33 for generating the brain-computer interface model. The j-th separation feature;
[0225] λ k Indicates the training samples used to generate brain-computer interface models. The iteration parameters;
[0226] The generated brain-computer interface training samples The form is a vector representation of the EEG signal, and the corresponding brain-computer interface model training sample category is label. n ;
[0227] If k < K, then let k = k + 1 and return to step S32; otherwise, terminate the brain-computer model training sample generation algorithm based on the nth group of brain-computer samples to obtain K groups of brain-computer model training samples.
[0228] S4: Calculate the higher-order moments of the generated brain-computer interface training samples, and determine whether the higher-order moments of the generated training samples are within the threshold range. If they are, retain the training sample; otherwise, discard it.
[0229] The calculation of higher-order moments of the generated brain-computer interface model training samples in step S4 includes:
[0230] Calculate the higher-order moments of the generated brain-computer interface training samples, where the brain-computer interface training samples... The formula for calculating higher-order moments is:
[0231]
[0232] in:
[0233] This represents the generated brain-computer interface model training samples. higher-order moments;
[0234] This represents the generated brain-computer interface model training samples. Length;
[0235] like If the training samples of the brain-computer interface are less than or equal to a preset threshold, then... To obtain effective training samples, brain-computer interface (BCI) model training sample categories are added to create BCI model training samples with sample categories. Save the generated brain-computer interface training samples; otherwise, discard them.
[0236] Example 2:
[0237] like Figure 2The diagram shown is a schematic representation of an electronic device for implementing a method for rapidly generating training samples for brain-computer interfaces, according to an embodiment of the present invention.
[0238] The electronic device 1 may include a processor 10, a memory 11, a communication interface 13 and a bus, and may also include a computer program, such as program 12, stored in the memory 11 and executable on the processor 10.
[0239] The memory 11 includes at least one type of readable storage medium, such as flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the electronic device 1, such as a portable hard drive. In other embodiments, the memory 11 can be an external storage device of the electronic device 1, such as a plug-in portable hard drive, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the electronic device 1. Furthermore, the memory 11 can include both internal and external storage units of the electronic device 1. The memory 11 can be used not only to store application software and various types of data installed on the electronic device 1, such as the code of program 12, but also to temporarily store data that has been output or will be output.
[0240] In some embodiments, the processor 10 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control unit of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes programs or modules stored in the memory 11 (such as program 12 for rapidly generating brain-computer interface training samples) and calls data stored in the memory 11 to perform various functions of the electronic device 1 and process data.
[0241] The communication interface 13 may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), which is typically used to establish communication connections between the electronic device 1 and other electronic devices, and to enable communication between internal components of the electronic device.
[0242] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable communication between the memory 11 and at least one processor 10, etc.
[0243] Figure 2 Only electronic devices with components are shown; those skilled in the art will understand that... Figure 2 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0244] For example, although not shown, the electronic device 1 may also include a power supply (such as a battery) to power various components. Preferably, the power supply can be logically connected to the at least one processor 10 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.
[0245] Optionally, the electronic device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired or wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device 1 and to display a visual user interface.
[0246] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.
[0247] The program 12 stored in the memory 11 of the electronic device 1 is a combination of multiple instructions, which, when run in the processor 10, can achieve the following:
[0248] Brain-computer interface (BCI) samples were collected and preprocessed. Feature extraction was performed on the preprocessed BCI samples to obtain BCI sample features.
[0249] The brain-computer interface (BCI) sample features are separated to obtain positive and negative effective features, and the contribution of different effective features is calculated.
[0250] Brain-computer model training samples are generated based on the positive and negative effective features and their contribution values of the obtained brain-computer samples.
[0251] Calculate the higher-order moments of the generated brain-computer interface training samples, and determine whether the higher-order moments of the generated training samples are within the threshold range. If they are, retain the training sample; otherwise, discard it.
[0252] Specifically, the processor 10's implementation method for the above instructions can be found in [reference needed]. Figures 1 to 2 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.
[0253] It should be noted that the sequence numbers of the above embodiments of the present invention are merely for descriptive purposes and do not represent the superiority or inferiority of the embodiments. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, apparatus, article, or method. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.
[0254] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0255] The above are merely preferred embodiments of the present invention and do not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A method for rapidly generating brain-machine model training samples, characterized in that, The method comprises: S1: collecting brain-computer samples and pre-processing, and extracting features of the pre-processed brain-computer samples to obtain brain-computer sample features; S2: separating the brain-computer sample features to obtain positive and negative effective features of the brain-computer samples, and calculating the contribution degrees of different effective features; Brain-machine sample characteristics The separation process is as follows: S21: obtaining brain-computer sample features As the original features, all extreme points of the brain-computer sample features are obtained The extreme points are divided into minimum value points and maximum value points to obtain minimum value point set and maximum value point set of the brain-computer sample features The extreme points are divided into minimum value points and maximum value points to obtain minimum value point set and maximum value point set of the brain-computer sample features S22: using a cubic spline interpolation method to respectively interpolate the minimum point set and the maximum point set, wherein the interpolation result of the minimum point set is the lower envelope line, and the interpolation result of the maximum point set is the upper envelope line; S23: calculating the mean of the upper and lower envelope lines, and calculating the difference between the original feature and the mean; If the difference between the zero point number and the extreme point number of the difference result is less than or equal to 1, and the average of the upper and lower envelope lines of the difference result is 0, then the difference between the original feature and the average is taken as the brain-computer sample feature Separate features at scale a and let a=a+1, separate features As the original feature, return to step S21, where the initial value of a is 1, and the maximum value is M, to obtain the brain-computer sample feature Separate features at M scales Otherwise, the difference between the original feature and the mean is the original feature, and returning to step S21; S24: separating the multi-scale brain-machine sample features obtained by separation into positive effective features and negative effective features, wherein the separation features The separation result is: Wherein: denotes the L1 norm; denotes a separation feature the result of the discrimination, if denotes a separation feature is a positive valid feature, denotes a separation feature is a negative valid feature; represents a pre-set characteristic threshold value; The positive and negative effective feature sets of the N groups of brain-computer samples are: Wherein: represents the separation feature information of the Nth brain-machine sample at scale a; computing a contribution degree of a brain computer sample separation feature, wherein the contribution degree of the separation feature is: Wherein: represents the number of brain-computer samples in the collected N groups of brain-computer samples, whose brain-computer model training sample category is . represents the average separation feature of all brain-machine model training sample classes whose brain-machine model training sample class is denotes the cosine similarity algorithm; denotes the L2 norm; representing the contribution of the separation feature to the overall performance denotes an exponential function with base the natural constant; S3: generating brain-computer model training samples according to the obtained positive and negative effective features of the brain-computer samples and their contribution degrees; S4: calculating the high-order moments of the generated brain-computer model training samples, and determining whether the high-order moments of the generated training samples are within a threshold range, if yes, retaining the training samples, otherwise discarding.
2. The method for rapidly generating training samples for a brain-computer interface model as described in claim 1, characterized in that, The S1 step of collecting brain-computer samples and pre-processing comprises: Collecting electroencephalogram signals using an electrode sheet, and collecting brain-computer model training sample categories corresponding to the electroencephalogram signals to form brain-computer samples, wherein the brain-computer sample set is: Wherein: represents the nth set of brain-machine samples in the brain-machine sample collection; represents an electroencephalogram signal in a brain sample, represents an electroencephalogram signal in a brain sample, represents timing information of the electroencephalogram signal, representing the electroencephalogram signal initial time of acquisition, representing the end time of the acquisition of the electroencephalogram signal, the time interval between adjacent acquisition times being ; representative brain-machine samples corresponding brain-machine model training sample classes; For any nth group of brain-machine samples A pretreatment operation is performed, wherein the pretreatment procedure is: S11: calculating the covariance matrix of the electroencephalogram signals S11: calculating the covariance matrix of the electroencephalogram signals Wherein: T denotes transposition, denotes the calculation of the trace of a matrix; representing an electroencephalogram signal covariance matrix of the electroencephalogram signal; S12: Obtain the electroencephalogram set of the brain-computer model training sample category in the brain-computer sample set, and calculate the average covariance matrix of all electroencephalograms in the electroencephalogram set ; S13: performing eigen decomposition on the average covariance matrix to obtain m eigenvalues and eigenvectors of the average covariance matrix , and sorting the eigenvalues and the eigenvectors in descending order of the eigenvalues, wherein the sorted results of the m eigenvalues and the eigenvectors of the average covariance matrix are Wherein: denotes the mth eigenvalue of the average covariance matrix denotes the mth eigenvalue of the average covariance matrix denotes the mth eigenvalue of the average covariance matrix denotes the mth eigenvalue of the average covariance matrix The feature vector is constructed into a conversion matrix C: S14: perform eigen-decomposition on the conversion matrix C to obtain m eigenvalues and eigenvectors of the conversion matrix C, and sort the eigenvectors in descending order of the eigenvalues, and form an eigenvector matrix by the sorted eigenvectors : Wherein: denotes the mth eigenvector of the conversion matrix C; S15: Constructing brain-computer model training sample class is Filter of electroencephalogram signal : S16: Utilizing filter On electroencephalogram signal Filtering processing: Wherein: representing a result of a filtering process of the electroencephalogram signal representing a result of a filtering process of the electroencephalogram signal 3. The method for rapidly generating training samples for a brain-computer interface model as described in claim 2, characterized in that, The S1 step of extracting features from the pre-processed brain-computer samples to obtain brain-computer sample features comprises: The brain-computer sample features are extracted from the preprocessed brain-computer sample, wherein the electroencephalogram signal The brain-computer sample feature extraction process is as follows: The variance matrix of the electroencephalogram signal is calculated wherein: Wherein: for electroencephalographic signals at signal values at the time instant The difference matrix is logarithmically converted: Wherein: a log-transformed result of a variance matrix , wherein the number of rows and columns of the matrix are equal, and both are the total number of signal collection time instants of the electroencephalogram signals extracting the main diagonal elements of the eeg signal the brain-machine sample features .
4. The method for rapidly generating training samples for a brain-computer interface model as described in claim 1, characterized in that, The S3 step of generating brain-computer model training samples according to the obtained effective features of the brain-computer samples and their contribution degrees comprises: Generating brain-computer model training samples based on the positive and negative effective features and their contribution degrees of any one group of brain-computer samples, wherein the brain-computer model training sample generation process based on the nth group of brain-computer samples is: S31: set the number of brain-computer model training samples generated based on the n-th set of brain-computer samples as k, the initial value of k is 1, and the maximum value is K; and generate parameters ; S32: generate a random number between 0 and 1 ; S33: randomly select one isolated feature from the M isolated features of the nth group of brain-machine samples wherein the selection probability of each isolated feature is: Wherein: , indicates that the separated feature with the scale a is not selected in the process of generating the brain-computer model training sample numbered i; indicates that the separated feature with the scale a is selected in the process of generating the brain-computer model training sample numbered i; when k=1, ; P (a | k) represents the probability of selecting the separation feature with scale a in the process of generating the brain-computer model training sample numbered k; S34: generating a brain-computer model training sample numbered k wherein the brain-computer model training sample is generated according to the following formula: Wherein: a jth separated feature of the selected brain-machine model training sample generated in step S33 step S33 representing an iteration parameter for generating brain-machine model training samples The generated brain-computer model training sample is in the form of a vector representation of an electroencephalogram signal, and the corresponding brain-computer model training sample category is ; If , let k=k+1, return to step S32, otherwise terminate the brain-computer model training sample generation algorithm based on the nth group of brain-computer samples, and obtain K groups of brain-computer model training samples.
5. The method for rapidly generating training samples for a brain-computer interface model as described in claim 4, characterized in that, The S4 step of calculating the high-order moments of the generated brain-computer model training samples comprises: The higher order moments of the generated brain-machine model training samples are calculated, wherein the higher order moments of the brain-machine model training samples are calculated according to the following formula: Wherein: representing the generated brain-machine model training sample high order moments; a length of the generated brain-machine model training sample If If the brain-computer model training sample is less than or equal to a preset threshold, the brain-computer model training sample is an effective training sample, and a brain-computer model training sample category is added to constitute a brain-computer model training sample with a sample category ; otherwise, the generated brain-computer model training sample is discarded .
Citation Information
Patent Citations
Motor imagery electroencephalogram signal classification method based on iterative learning
CN115034272A