A kind of based on P300 brain power mode without threshold value brain method of switching
Technical field
The present invention relates to brain-computer interface field, particularly a kind of based on P300 brain power mode without threshold value brain method of switching.
Background technology
Brain-computer interface (braincomputerinterface, BCI) be that one does not rely on peripheral neverous system and musculature, and directly exchanging and control channel of setting up between brain with external device, it is a kind of new human-machine interface technology, this technology disabled person (as amyotrophic lateral sclerosis ALS, brain stem apoplexy, spinal cord injury SCI etc.) the auxiliary and rehabilitation aspect of life there is vital role, at home and abroad cause at present and pay close attention to widely.Brain power mode for brain-computer interface mainly contains Mental imagery, P300, SSVEP, can form single mode brain-computer interface by a kind of pattern wherein, or combines various modes composition multi-mode brain-computer interface wherein.Adopt the brain-computer interface of P300 brain power mode can be operated in synchronously (synchronous) or asynchronous (asynchronous) state, synchronous brain-computer interface needs given user to carry out the start time of cerebration, asynchronous brain-computer interface then allows user to start cerebration at any time as required, the practicality of obvious asynchronous brain-computer interface is stronger, but be in state of a control or idle condition, so the more synchronous brain-computer interface of difficulty realized is much larger because asynchronous brain-computer interface needs constantly to detect user.
Brain switch is a kind of typical asynchronous brain-computer interface, and it can be used for the ON/OFF controlling another synchronous brain-computer interface, or directly controls the ON/OFF of external unit, as TV, electric light, air-conditioning etc.Brain switching requirements the least possible appearance wrong report when user is in idle condition of a function admirable, responds as far as possible fast when user is in state of a control.There are some based on Mental imagery both at home and abroad at present, based on SSVEP, or realized the function of brain switch based on the multi-mode brain-computer interface of multiple brain power mode.But these existing methods all need to rely on one or more threshold value carries out decision-making, is namely judged to be state of a control when certain value calculated exceedes the threshold value of setting, otherwise is idle condition.This way has following three shortcomings: the first, and threshold value itself is difficult to determine, because need consideration True Positive Rate and the false positive rate of compromise; The second, usually by ROC Curve selection threshold value, so need relatively a large amount of training datas, more consuming time; 3rd, selected threshold value can not use, for a long time because EEG signals itself has polytrope.
Summary of the invention
The shortcoming that the object of the invention is to overcome prior art, with not enough, provides a kind of asynchronous brain method of switching without threshold value based on P300 brain power mode, ensures that it has with existing method quite or the performance more excellent than existing method simultaneously.Namely the brain method of switching that the present invention relates to does not need to set any threshold value, ensures the low false positive rate of idle condition and the high True Positive Rate of state of a control simultaneously.
Object of the present invention is achieved through the following technical solutions:
Based on P300 brain power mode without a threshold value brain switch detection method, comprise the following steps:
S1, the initialization of brain wave acquisition hardware system and electrical brain stimulation interface start;
S2, to be gathered user by described brain wave acquisition hardware system respectively and be in state of a control and idle condition hypencephalon electricity training data;
S3, off-line training, respectively the time series brain electricity training data under state of a control and idle condition that is in gathered is split, obtain the class label of proper vector and correspondence thereof, and train SVM1 sorter and SVM2 sorter based on the proper vector extracted and class label;
S4, online process in real time, the EEG signals data of the current user of Real-time Collection, extract proper vector, respectively by first time categorised decision and second time categorised decision, the EEG signals of user are converted into the control command controlling external unit " ON/OFF ".
Further, described electrical brain stimulation interface comprises 4 flicker keys, one of them key is on & off switch, other three keys are pseudo-key, described flicker key lays respectively at the lower right corner at described electrical brain stimulation interface, the upper left corner, the upper right corner and the lower left corner, and the EEG signals with P300 brain power mode for bringing out user of glimmering in a random way.
Further, the discrete training of described step S3 specifically comprises:
S31, pre-service, carry out bandpass filtering and standardization by brain electricity training data;
S32, feature extraction, respectively feature extraction is carried out to the brain electricity training data be under state of a control and idle condition, described feature comprises proper vector and class label, wherein said characteristic vector pickup process is: from selected " O1 ", " Oz ", " O2 ", " P3 ", " Pz ", " P4 ", " CP3 ", " CPz ", " CP4 ", " C3 ", " Cz ", " C4 ", " FC3 ", one section of initial characteristics signal is extracted for each key flash in " FCz " and " FC4 " 15 passages, the serial data of 15 passages is unified into the proper vector of a P300 brain power mode after the down-sampling of 1/6th times
wherein i, k, r represent respectively i-th button, a kth round and r trial, i ∈ 1 ..., 4}, k ∈ 1 ..., 10}, r ∈ 1 ..., 20},
S33, sorter are trained, and utilize the proper vector of described P300 brain power mode
and class label trains described SVM1 sorter, then test by the proper vector of SVM1 sorter to the P300 brain power mode of each round of each trial, obtain corresponding score value Si, Si is carried out minimax normalization and obtains
by four of each round
with 1, the order composition proper vector of 2,3,4
for training described SVM2 sorter.
Further, described step S4 processes in real time online and specifically comprises:
S40, real-time data acquisition, the EEG signals data of nearest 3 round of the provisional preservation of extract real-time;
EEG signals data are carried out bandpass filtering and standardization by S41, pre-service;
S42, feature extraction, characteristic vector pickup is carried out to EEG signals data, leaching process is: from selected " O1 ", " Oz ", " O2 ", " P3 ", " Pz ", " P4 ", " CP3 ", " CPz ", " CP4 ", " C3 ", " Cz ", " C4 ", " FC3 ", it is the characteristic signal that each key flash extracts the EEG signals data of nearest 3 round in " FCz " and " FC4 " 15 passages, the serial data of 15 passages is unified into the proper vector of a P300 brain power mode after the down-sampling of 1/6th times, the proper vector of P300 brain power mode corresponding for nearest for each button three flickers is carried out the P300 proper vector of superposed average as current flicker key,
S43, ground floor categorised decision, call the SVM1 sorter that described step S3 off-line training obtains, four online P300 proper vectors are tested, obtain 4 score values, if the score value corresponding on & off switch is positive and is maximum, then turn to step S44, otherwise current state decision-making is idle condition;
S44, second layer categorised decision, 4 score values obtained by described step S43 form score value proper vectors, and call the SVM2 sorter that described step S3 off-line training obtains and test, and obtain a new score value.If this score value is positive, then current state decision-making is state of a control, otherwise is idle condition, if user is consecutively detected 3 state of a controls, then exports the control command of " ON/OFF ".
Further, the minimax method for normalizing in described step S3 off-line training is:
Wherein Si and
be respectively the SVM score value before and after normalization.
Further, the key flash of 4 flicker keys on described electrical brain stimulation interface is in units of round, a round refers to that 4 buttons are each once glittering with random sequencing, each glittering duration is 100ms, the gap 100ms that each button is glittering, therefore each round duration 800ms.
Further, described in be in state of a control and idle condition hypencephalon electricity training data length be 20 trial, wherein, trial represents the unit of training data length, and a trial comprises the key flash of 10 round.
Further, described bandpass filtering used band is 0.5-30Hz, and the signal amplitude after described standardization is [-1,1].
The present invention has following advantage and effect relative to prior art:
1) advantage that asynchronous brain method of switching disclosed by the invention is maximum is than existing methods without the need to arranging threshold value, no matter existing method is based on Mental imagery, based on SSVEP, or artificially set one or more threshold value for decision-making based on multi-modal all needs, and threshold value has selection and comparison difficulty, select time is long, the shortcoming such as can not to use for a long time.
2) method of the present invention utilizes two-layer SVM classifier, first split/key carries out with or without P300 inspection, be whether the inspection of control state again to the new feature be made up of 4 score values, finally the direct score value by two SVM carries out decision-making, without the need to threshold value, this overcomes now methodical deficiency to a great extent.
Accompanying drawing explanation
Fig. 1 is the application schematic diagram without threshold values brain method of switching based on P300 brain power mode disclosed by the invention;
Fig. 2 is the process step figure without threshold values brain method of switching based on P300 brain power mode disclosed by the invention;
Fig. 3 is the electrical brain stimulation surface chart without threshold values brain method of switching based on P300 brain power mode disclosed by the invention.
Embodiment
For making object of the present invention, technical scheme and advantage clearly, clearly, developing simultaneously referring to accompanying drawing, the present invention is described in more detail for embodiment.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
Embodiment
Refer to Fig. 1, Fig. 1 is the application schematic diagram without threshold values brain method of switching based on P300 brain power mode disclosed in the present embodiment one.The application without threshold values brain method of switching based on P300 brain power mode shown in Fig. 1, first by brand-new electrical brain stimulation interface to the visual stimulation of user, then the brain wave acquisition hardware system be made up of electrode cap and eeg amplifier gathers the EEG signals of user, then by based on P300 brain power mode without threshold values brain method of switching, EEG signals is converted into control external unit " ON/OFF " order.As shown in Figure 2, comprising the following steps without threshold value brain switch detection method based on P300 brain power mode is somebody's turn to do:
Step S1, the initialization of brain wave acquisition hardware system and electrical brain stimulation interface start.
Above-mentioned brain wave acquisition hardware system comprises electrode cap and eeg amplifier, the initialization of above-mentioned brain wave acquisition hardware system mainly refers to equipment connection, the scalp brain of user electricity is gathered by electrode cap, eeg amplifier, the sampling rate of signal is 250Hz, gathers hindbrain electrical signal transfer to carrying out decision-making conversion based on P300 brain power mode without threshold values brain switching algorithm.
Described electrical brain stimulation interface comprises 4 flicker keys, one of them key is on & off switch, and other three keys are pseudo-key, do not play any switch control functions, not corresponding any control command, for real time contrast is provided on & off switch and in follow-up judgement for forming new feature.
Electrical brain stimulation interface in the present embodiment can with reference to shown in accompanying drawing 3,1 corresponding on & off switch is positioned at the lower right corner, 3 corresponding pseudo-keys lay respectively at the upper left corner, the upper right corner, the lower left corner, and 4 flicker keys glimmer in a random way for bringing out the EEG signals with P300 brain power mode.
The key flash of 4 flicker keys on described electrical brain stimulation interface is in units of round, a round refers to that 4 buttons are each once glittering with random sequencing, each glittering duration is 100ms, the gap 100ms that each button is glittering, therefore each round duration 800ms, the attribute of flicker is color.
Step S2, collection user brain electricity training data.
Described step S2 gathers brain electricity training data when user's brain electricity training data refers to that collection two sections of users are in state of a control and idle condition respectively, the length of every segment data is 20 trial, trial is the unit of the usual expression training data length in brain-computer interface field, and in the embodiment of the present invention, trial comprises the key flash of 10 round.Namely each trial duration is be spaced apart 2S, so the acquisition time of every section of training data is about 200s between 8s, trial.
Described step S2 gathers in user's brain electricity training data, requires the on & off switch watched attentively on electrical brain stimulation interface, then do not watch any flicker key on electrical brain stimulation interface when being in idle condition attentively when user is in state of a control.
Step S3, off-line training.
Described step S3 off-line training comprises S31 pre-service, S32 feature extraction and S32 sorter and trains three major parts, and wherein data prediction is mainly for stress release treatment, improves signal to noise ratio (S/N ratio); Feature extraction, mainly according to the principle of P300 brain power mode, is split the time series EEG signals gathered, is obtained the class label of proper vector and correspondence thereof; Sorter training trains two SVM classifier by the proper vector extracted and class label, calls the processing stage of online real-time for step S4.
The S31 pre-service of described step S3 off-line training refers to carries out bandpass filtering and standardization by EEG signals, and bandpass filtering used band is 0.5-30Hz, and the signal amplitude after standardization is [-1,1].
Feature extraction S32 in described step S3 off-line training refers to from the training data of step S2 gained and concentrates proper vector for the key flicker extraction P300 brain power mode that glimmers at every turn and class label, for training SVM classifier (wherein, SVM:SupportVectorMachine, Chinese name: support vector machine), it is a kind of supervised learning model conventional in machine learning, be generally used for pattern-recognition, classification and regretional analysis, SVM is used for classification by the present invention.For the training dataset of state of a control, specific practice is: first, (" O1 ", " Oz ", " O2 " from 15 selected passages, " P3 ", " Pz ", " P4 ", " CP3 ", " CPz ", " CP4 ", " C3 ", " Cz ", " C4 ", " FC3 ", " FCz ", " FC4 ") extract one section of initial characteristics signal for each key flash, specific practice be extract this key flash occur after the 100ms-500ms time period in EEG signals as initial proper vector, but each button in fact only glittering 100ms.Wherein, above-mentioned 15 passages be according to international electroencephalology can the electrode position of 10/20 standard definition from being easy to occur that the pillow page of P300 brain power mode, top page and middle section are selected.The second, obtained EEG signals is carried out the down-sampling of 1/6th times, and the serial data of 15 passages is unified into the proper vector of a P300 brain power mode
the flicker of a corresponding flicker key, wherein i, k, r represent i-th button, a kth round and r trial respectively.Because each trial comprises 10 round, in each round, all buttons can be once glittering, and the data of one-stage control state or idle condition comprise 20 trial, so i ∈ here 1 ..., 4}, k ∈ 1 ..., 10}, r ∈ 1 ..., 20}.Therefore, from the training data of state of a control, each button extracts the proper vector (round × 1, a 20 trial × 10 target glint key) of 200 P300 brain power modes.The training dataset of idle condition also does same process.
S33 sorter training in described step S3 off-line training refers to training two SVM classifier models (being respectively SVM1 sorter and SVM2 sorter), specific practice is: the first, by the proper vector of P300 brain power mode concentrating extraction from the training data under state of a control and idle condition
and class label (1 and-1) training SVM1 sorter.The second, test by the proper vector of SVM1 sorter to the P300 brain power mode of each round of each trial, obtain corresponding score value Si, Si is carried out minimax normalization and obtains
by four of each round
with 1, the order composition proper vector of 2,3,4
the flicker of a corresponding round, wherein k, r represent a kth round and r trial respectively.Concentrate from the training data of state of a control and idle condition like this and obtain 200 respectively
proper vector, class label is respectively 1 and-1, for training SVM2.
The minimax method for normalizing that model training in described step 3 off-line training is used is:
Wherein Si and
be respectively the SVM score value before and after normalization.
Step S4, online process in real time.
Step S4 mainly comprises five parts, i.e. real-time data acquisition, pre-service, feature extraction, ground floor categorised decision and second layer categorised decision.Wherein pre-service is consistent with step S3, feature extraction and the difference of step S3 are the P300 proper vector that nearest for each button three times glimmer corresponding to carry out the feature of superposed average as this key, the SVM1 sorter that trains of ground floor classification invocation step three is for judging that whether the score value of ON/OFF key is just and maximum, when ground floor sorter judged result is that to think current be Idle state to fictitious time, do not need to carry out second layer classification, otherwise carry out second layer classification, namely the SVM2 sorter that trains of invocation step three is for judging whether current round belongs to control state.
During online process in real time, class label is unknown, and user is likely in state of a control or idle condition at any time, and the process of classification is exactly the process identifying its class label in fact.
Described step S4 processes in units of round online in real time, and namely decision-making once for every 800ms (round).Decision process specifically can be divided into following step:
S40 real-time data acquisition, only needs the EEG signals data of nearest 3 round of provisional preservation, and upgrades after each round terminates during online process in real time.
S41 pre-service, consistent with pre-service in described step S3.
S42 feature extraction, similar with the feature extraction of described step S3 off-line training, difference is the proper vector of P300 brain power modes corresponding for nearest for each button three flickers to carry out the P300 proper vector of superposed average as current flicker key, like this for each button during current round glimmers extracts the proper vector of an online P300 brain power mode.
In training stage, data are collected, and each button is 200 flickers altogether, and corresponding 200 proper vectors, these proper vectors are all trained for SVM classifier.Real-time judge is needed time step S4 processes online in real time, specific practice has often dodged a round to judge once, and a round comprises 4 key flash, and each key dodges once, so just corresponding 4 proper vectors, so each judgement is all go to judge by new 4 proper vectors.Just now the proper vector of corresponding each key is not the data of present single flicker, but the eeg data superposed average of nearest three flickers obtains.
S43 ground floor categorised decision, calls the SVM1 sorter that described step S3 off-line training obtains and tests four online P300 proper vectors, obtain 4 score values.If the score value corresponding on & off switch is positive and is maximum, then turn to step S44, otherwise current state decision-making is Idle state.
S44 second layer categorised decision, 4 score values obtained by step S43 form score value proper vector according to the method for described step S3 off-line training, and test with SVM2 sorter, obtain a new score value.If this score value is positive, then current state decision-making is control state, otherwise is Idle state.Finally, if user is consecutively detected 3 control states, then export the control command of " ON/OFF ".
Above-mentioned second layer categorised decision is on the basis of first time categorised decision, is classified by the SVM1 sorter score value corresponding to four buttons of current round again, judges whether current round belongs to control state further.The object done like this is the error rate reducing to judge.
Above-described embodiment is the present invention's preferably embodiment; but embodiments of the present invention are not restricted to the described embodiments; change, the modification done under other any does not deviate from Spirit Essence of the present invention and principle, substitute, combine, simplify; all should be the substitute mode of equivalence, be included within protection scope of the present invention.