BCI for Stroke Rehabilitation - preprocessing and deep learning, poor accuracy
Hi!
My name is Anete and I am working on my bachelor thesis about “The Brain-Computer Interface for Rehabilitation After Stroke Using EEG Signals and Virtual Reality Glasses”.
I am using an OpenBCI gel-free EEG headset. Electrodes used: Fp1, Fp2, F7, F3, F4, F8, T3, C3, Cz, C4, T4, T5, P3, P4, T6, O2. Reference electrode and ground as shown in the picture.
I want to classify between rest and action–hand-raising states. For data labeling, I use a button that is pressed when there is a rest state and released when action state. In one file there are 20 hand raises where each is followed by rest state, but I have tried this also with 40 hand raises in the training set.
I record data using Python and save it as numpy files.
My preprocessing steps are:
* cut the beginning of each file as there often is a spike,
* 50 Hz notch filter as I am in Latvia,
* bandpass filter from 7 to 35Hz (but I have tried 5 to 50Hz, 8 to 30Hz and many more)
* for model training and testing, data are divided in 30 frame segments with 50% overlap.
Then I have an LSTM deep learning model with 128 hidden layers. This is similar to https://github.com/xiangzhang1015/Deep-Learning-for-BCI/blob/38ecb0645cf861504a637a556fd4de74e106dabf/pythonscripts/4-1-1_LSTM.py.
Now the best accuracy I can achieve if I take one file and divide it into test and validation sets (so that all external factors are the same) is approximately 70% (in the best-case scenario), but it is not enough for rehabilitation.
I have also tried to use OpenBCI GUI time series through LSL, but it did not make accuracy better, and in GUI at all no difference can be seen between rest and action when looking at graphs.
Is it possible to achieve better accuracy with this EEG headset? If yes, then what am I missing? What should I change, or add? What should be the bandpass filter range? How should the graph of rest and action states look?
Raw data:
All electrodes after preprocessing (with pink line showing rest - 0 and action - 1 states):
Does spikes before 1500 frame influences data overall? Should I remove them? Can they be detected already in raw data?
C3 electrode after preprocessing (yellow - action, purple - rest):
Comments
Hi Anete,
It's possible that your selection of electrode positions is not 'optimal' for motor-strip-sensing applications. (your Frontal, Parietal, Occipital locations have less helpfulness than those locations around that strip.) Here some papers showing sample layouts:
https://www.researchgate.net/publication/330765910_A_Novel_Deep_Learning_Approach_With_Data_Augmentation_to_Classify_Motor_Imagery_Signals
Another similar layout:
https://blog.jfrey.info/2015/03/03/openbci-motor-imagery/
And one more:
https://docs.openbci.com/Examples/EEGProjects/MotorImagery/
For reference here is the book and Github you reference:
https://www.amazon.com/Deep-Learning-EEG-Based-Brain-Computer-Interfaces/dp/1786349582
https://github.com/xiangzhang1015/Deep-Learning-for-BCI
Also, I'm not sure I'm interpreting your graphs correctly, but is it true that your average EEG per channel microvolts are only around 2 uV? That is not much signal to work with as the signal to noise ratio is so low.
Regards, William
One other aspect to note, and might explain your low amplitude ~2uV sample values: you placed your reference at CPz. This is very close to the motor strip activity that you want to record. That is not optimal. EEG is differentially recorded, by subtracting the reference electrode value from each channel. So your placement at CPz will result in very low activity recorded from the C3, C4, Cz, P3, P4 sites of most relevance / interest for motor applications.
Unfortunately for you, the lower the microvolts amplitude (in the range around 1 or 2 microvolts) the more random and noisy is the EEG signal. This is just the reality of such tiny 1 to 2 microvolt EEG. Environmental noise and noise from cables, movement, etc., get harder to separate at such low voltages.
The three other layouts pictured above, use reference at the ear lobe. The last two on the right ear lobe. The first picture shows reference on BOTH ear lobes, this is known as "linked ears" and can be done by connecting the cables for each ear clip together at the amplifier.
Hi!
Thank you for your answer!
Regarding electrode placement and reference electrodes, I have gel free EEG headset; therefore, it is not very flexible towards electrode placement, including reference. However, I will try to find a way how to change at least the reference electrode placement to the ear lobe.
Regarding the 2 microvolt signal. The pictures are after standardization / z-score normalization and I am not sure if those are real voltage values or if they are smaller just because they have been normalized. I will also try to look deeper into that.
All you need to do is look at your signals in the GUI. The Time Series graph is not 'normalized'.
re: gel electrode caps
Some inexpensive caps are available on the web that can be fitted with gel holder / or paste electrodes at intermediate 10-10 sites. Check the Chinese suppliers. For example:
https://www.tenocom.net/products/eeg-cap-for-cup-electrodes
Is the 100 microvolt signal considered to be normal? I have way less also in OpenBCI GUI.


Is this not normal range?
Regarding reference electrode, I will try to find a way how to check how it works when placed on ear lobe.
re: EEG ear clips. These are available through online sellers or the OpenBCI Shop
Your first graph shows many channels with just a few uV. For example 3, 4, 7, 15, 16. You are misinterpreting the '100uV' label. This is the currently set maximum scale value. Once you set the scale to 'Auto' of course every channel then readjusted. I would believe the first snapshot over the 2nd. The periodic larger amplitude excursions visible, for example channels 1 & 2 in first snapshot at time -2.5, are likely artifact: movement or EMG jaw or eyeblink/movement.
Thank you for your answer!
Yes, I know that I have two pictures with just different scales, I just wanted to understand if the signal amplitude is larger enough to be considered normal as I have read somewhere that EEG signal has to be in range of 100 uV, but I have less.
And yes, that spike in channels 1, 2, 9, 10, 11 and 12 is from eyeblink.
EEG UPPER limit range is around 100 uV. Your channels with only a few uV are BELOW normal range.
Another thing you could try if you do not yet have ear clips, is to just swap the GND and REF on your cap. That will put REF farther away from the most important areas near the motor strip. Thus increasing the uVs.
I would also suggest giving less weight to your Fpx and Ox positions, as they are just going to decrease your signal to noise ratio.
Hello!
For some moment I thought that swapping GND and REF helped, but later I understood that I still receive 70% accuracy or less. Is there some app/code/game or something developed that I could try out using my eeg device to just understand if my device works correctly? Then at least I would know if the problems is with device and its setup or in my code.
Best regards,
Anete
Eyes closed alpha is the classic test. Strongest in occiput and parietal areas.
https://docs.openbci.com/GettingStarted/Biosensing-Setups/EEGSetup/#4-alpha-brain-waves-eeg