EEG-Based BCI System to Detect Fingers Movements

The advancement of assistive technologies toward the restoration of the mobility of paralyzed and/or amputated limbs will go a long way. Herein, we propose a system that adopts the brain-computer interface technology to control prosthetic fingers with the use of brain signals. To predict the movements of each finger, complex electroencephalogram (EEG) signal processing algorithms should be applied to remove the outliers, extract features, and be able to handle separately the five human fingers. The proposed method deals with a multi-class classification problem. Our machine learning strategy to solve this problem is built on an ensemble of one-class classifiers, each of which is dedicated to the prediction of the intention to move a specific finger. Regions of the brain that are sensitive to the movements of the fingers are identified and located. The average accuracy of the proposed EEG signal processing chain reached 81% for five subjects. Unlike the majority of existing prototypes that allow only one single finger to be controlled and only one movement to be performed at a time, the system proposed will enable multiple fingers to perform movements simultaneously. Although the proposed system classifies five tasks, the obtained accuracy is too high compared with a binary classification system. The proposed system contributes to the advancement of a novel prosthetic solution that allows people with severe disabilities to perform daily tasks in an easy manner.


Introduction
In 2006, a "Convention on the Rights of Persons with Disabilities" (UNCPRD) was adopted by the United Nations that recognizes the autonomy and independence of living as basic human rights [1]. In line with this treaty, the system proposed in this paper aims to help people with severe disabilities restore the mobility of their fingers using Brain Computer Interface (BCI) technology. BCI technology aims to assist people suffering from severe disabilities in regular everyday activities by proposing an affordable alternative pathway to regain communication and interaction with their environment. Over the past decade, the BCI technology has seen a rapid development and it has been applied to a wide range of fields, especially in rehabilitation engineering or for functional substitution [2][3][4][5][6].
Different types of bio-signals such as EEG [7][8][9][10], Magnetoencephalography (MEG) [11,12], Electrocorticogram (ECoG) [13][14][15], Functional Near-Infrared Spectroscopy (fNIRS) [16], as well as Electromyography (EMG) [17] have been used to design BCI systems that decode finger movements. EEG is the most commonly used technology for the acquisition of brain signals in BCI systems due to its noninvasive nature, low cost, and high portability [8]. EEG signals corresponding to motor imagery (MI) are defined in frequency domains as brain activity that is triggered by muscular contractions or

Materials and Methods
The experiments carried out in this paper were approved by the Targeted Research Program committee-Disability Research Grant Program at King Abdulaziz City for Science and Technology (KACST) which granted funding for the research project No 5-18-03-001-0015-10827.
Our methodology focuses on the requirements of a multi-class classification problem for a successful BCI system that decodes the movement of fingers using EEG brain activity signals. Figure 1 presents the general structure of the proposed system. Firstly, our own dataset was created using, a g.HIamp from g.tec, an 80 channel amplifier. To do this, volunteers were asked to randomly move their fingers. Every single finger movement was considered to be a single trial. EEG signals that correspond to the trials of the subject were recorded during different sessions. Every trial was labeled distinctively. Afterwards, the recorded data was processed by removing the artifacts to increase the signal-to-noise ratio (SNR) of the EEG signals. Subsequently, the set of electrodes showing signals that are relevant to the movements of the fingers was identified. Then, the CSP algorithm was applied to extract the features that correspond to the finger movements. Finally, an ensemble of one-class classifiers was used to decode the five finger movements. Every one-class classifier was trained to detect the movements of a given finger. To avoid over-fitting, every classifier was trained on a portion of the data set and tested using another portion. The measurement accuracy was used to determine the performance of every one-class classifier.

EEG Signal Acquisition
The EEG signals were recorded using a g.tec g.HIamp amplifier. The signals were captured through 64 electrodes placed on the scalp according to the international system localization 10-20. 256 Hz was decided as the sampling frequency of the signals and a filtration stage was applied using a BPF with the type "Chebyshev" to keep the frequency component between 1 Hz and 60 Hz.

Experimental Paradigm
The data used in this project was created locally and consisted of EEG signals recorded from 5 KSU volunteers aged between 21 and 23 years. All subjects were male and all of them were right-handed. As for the experiment, subjects were told to sit on a comfortable chair and their right arm was placed on a table to rest and thus to avoid muscle fatigue. We recorded EEG signals from every subject in multiple sessions. During every session, the selected subjects were asked to perform individual finger movements according to the automated scenario program interface (SPI). The subjects performed actions that corresponded to the movement of the five fingers and they were told to use only their right hand. All movements started at a neutral position, with the hand open, the lower arm extended to around 120 degrees, and the thumb placed on the inner side. Subjects were requested during every trial to execute sustained movements. For each finger, 180 trials were recorded which were comprised of 3 to 4 different sessions.

Monitoring the Recording Sessions
Furthermore, a SPI was developed to guide the subjects during the recording of the sessions. It was responsible for displaying the instructions for the subjects on a screen. The main menu of the SPI and indicates the general information related to each subject, the scenario mode, the duration of readiness, the duration of flexing, the duration of waiting, and the number of trials in each session. Once the EEG recording process was launched, a specific state machine was followed; which included 3 phases: • Get ready phase: during this phase, a random finger/limb movement was selected and the corresponding animated picture "gif file" was displayed by the scenario program on the screen.

•
Action phase: during this phase, the subject moved the selected finger/limb.

•
Rest phase: during this phase, the subject was in a resting state.
The duration of each recording session was as follows. 2 s were set for each phase; the get ready phase, the action phase, and the reading phase.

Labeling Signals
The recording process was done over four sessions. Each session was continuous and was discretized into a sequence of six seconds per trial. The first 20 s of each session were discarded due to the BCI amplifier initialization delay. The EEG signals were subdivided into six-second intervals where each epoch corresponded to one finger movement. Each interval was labeled with a corresponding label from the scenario program. This process was repeated for every session and the processed sessions were concatenated to give each subject a fully labeled signal.

Artifacts Removal
After labeling the EEG signals, a filter block was applied to remove artifacts. In this way, only the frequency components related to the intention of finger movement were kept. These frequency components were often set to be between 8 Hz and 30 Hz [22]. Thus, a finite impulse response filter was applied with a 4th order, allowing the removal of frequency components outside the band while maintaining a zero-frequency phase for the signal [23]. Subsequently, a common average referencing technique was applied to allow the average signal at all electrodes to be calculated and subtracted from the EEG signal at every electrode for each time point. This step allowed for the discrimination between the positive and the negative peaks in the EEG signals and for locating the sources of the signal in the noisy environment that led to an improvement in the SNR [24]. The EEG signals were converted and computed according to Equation (1).
where E is the total number of electrodes used in the recording process of one trial T. T(k) is the EEG signal at the electrode k.

Selection of Relevant Electrodes
Unlike existing EEG-based studies to detect fingers movements which are extracting features from a predefined set of electrodes, this work proposes an adaptive method to analyze the brain activity during fingers movements and to identify the electrodes that are showing relevant changes. The identified electrodes were used as signal resources to extract relevant features before the classification step.

•
An electrode (e) is an electrical conductor used to acquire brain signals. • E is the set of electrodes (e) on a cap. • A motor imagery (m), also called the motor imagery task, is a mental process by which an individual simulates a given movement action.

•
Ψ is a set of motor imagery tasks. The motor imagery tasks which were considered here are the imaginary movements of the thumb, index, middle, ring and pinky fingers.
is a set of brain signals that are recorded with a set of electrodes E during a given motor imagery task m.
ς is a set of subjects from each of which a set of trials was recorded.

•
A rest is a set of brain signals, recorded using a set of electrodes E that corresponds to the mental state during a resting period. In this study, the resting period corresponds to the portion of a trial t recorded during the 0-1 s period of t. It is denoted t[0 − 1].

Preliminaries
The following set of basic functions are required for the selection of the relevant electrodes: • σ: For a given motor imagery task m i , this function returns the subset of trials that were recorded during m i . It is defined as follows: a way that t j is recorded during the motor imagery task m i }.
• δ: For a given subject s i , this function returns the subset of trials that have been recorded during the sessions of the subject s i . It is defined as follows: Pow(e, t) is the power, also called the energy, of the electrode e calculated from the trial t.
It is computed using a spectral representation of the trial t with the application of the fast Fourier transformation. It is measured according to the following expression: where The power spectrum of each trial using the FFT function are available online at Supplementary Materials (Folder S1). -ERD/ERS(e, t, re f _Power) is defined as the percentage of the power increase or decrease in the electrode e during the trial t in relation to a reference power re f _Power, according to the following expression: ERD_ERS(e, t, re f _Power) = Pow(e, t) − re f _Power re f _Power (4)

The selection models
Let's define the following functions: • The function φ(s i , m j ) that calculates the subset of trials recorded during the sessions of the subject s i while performing the motor imagery task m j . It is defined as follows: where changes in the brain activity of the subject s i in the electrode e k are significant during the motor imagery task m j . Brain activity variations during a given motor imagery are considered significant if they exceed the variation in power in a reference electrode during the same motor imagery. It is defined as follows: is defined as the average power of the electrode e during the distinct rest periods of s i , according to the following expression: (5) * Regarding the reference electrode (re f erence elec ) we selected C 3 as the reference for all electrodes located at the left-brain hemisphere. Moreover, we selected C 4 as the reference for all electrodes located at the right brain hemisphere.
A recent study published in Scientific Reports on 2020 [21] has presented the distribution of sensorimotor rhythms during hand motor imagery in the right and the left hemispheres. These distributions confirm neuroscience assumptions saying that brain activity corresponding to left hand movements is located on the right hemisphere and vice versa. This is why we considered the electrodes C3 and C4 as references to the electrodes at the left and right hemispheres respectively.
Take for instance a subject s i , a motor imagery m j and an electrode e k . The electrode e k is relevant to the motor imagery m j with respect to the subject s i , if the probability, denoted ρ(s i , m j , e k ), of obtaining significant brain activity changes in e k when the subject s i performs the motor imagery task m j exceeds a given threshold called the α_threshold. The probability ρ(s i , m j , e k ) is calculated as follows: Here: • τ(s i , m j , e k ) and φ(si, m j ) are the total number of trials of τ(s i , m j , e k ) and φ(s i , m j ), respectively.
Based on the function specifications described above, the following electrodes selector, called the , calculates and returns the set of electrodes that are relevant, for a given subject s i , to a given motor imagery m j . It is defined according to the following expression:

Feature Extraction
For every finger movement m of a given subject s, we identified a set of relevant electrodes. These electrodes were used to extract appropriate features using the CSP method that is a well-known feature extraction technique. This method aims to extract and keep a significant activity or rhythm, as well as eliminate all redundant EEG signals. These features represent the most significant energy at the relevant electrodes in the α and β bands in reality; which have the highest likelihood of containing significant motor imagery information [22]. More theoretical details about the CSP algorithm are presented in [25].

Finger Movements Classification
For every Finger movement m, a one-class classifier denoted C m was designed. The classifier C m is responsible for the detection of the movements of the corresponding finger. The classification model of a given classifier C m is built including features extracted by the CSP algorithm using the subset of electrodes that are relevant to the corresponding motor imagery m. As such, each finger had its classification model, where the signal was copied to the model of each finger as well as each model was classified based on whether that signal belonged to that particular finger. This approach made the movement of multiple fingers at the same time possible, as each finger worked independently.
Many classifiers were tested, such as SVM, Logistic Regression, Gaussian Naive Bayes, and LDA. LDA was more efficient in term of accuracy against the other classifiers. Therefore, the LDA was selected as the main classifier of the proposed approach.

Prosthesis Control
The main objective of this work is to control prostheses merely by EEG motor imagery signals. A complex signal pre-processing is performed on EEG trials to remove artifacts, enhance signal to noise ratio, and decrease the dimensionality of the EEG signals. Every trial is processed simultaneously by each one-class classifier. Every one-class classifier applies the CSP algorithm on the set of electrodes that are relevant to the corresponding finger, to extract relevant features. Based on the extracted features, the LDA classifier identifies the trial as a target or as an outlier. If a given one-class classifier has recognized the trial as target, then a control command is sent to the corresponding finger's actuator. A finite state machine corresponding to these steps is designed and validated at the simulation stage.

Results
The extracted features and their corresponding labels were split into two sets. The first set was dedicated to the training session and the other for testing purposes. The presented results were measured according to a 5-fold cross-validation approach. The training set for each finger was concatenated with 20% of the data from other fingers. However, for the testing set, 50% of the data from other fingers was added. Algorithm 1 summarizes the data set decomposition process.
The main objective of this section is to demonstrate the efficiency of the proposed method in regard to distinguishing the movements of the five-finger based on the intention of the user. Until now, the recording trials were applied directly to the signal processing chain without the application of the proposed channel selection algorithm. This is the first approach where the EEG features are extracted using the CSP spatial filter and the LDA algorithm for classification, while maintaining the same data partition as presented in Algorithm 1. The accuracy of the system fluctuates between subjects from 52% to 60%, with an average of 57%. This accuracy is poor, which makes the system inefficient. With the application of the same techniques and the integration of the channel selection method, the number of channels used during the acquisition are minimized by identifying the relevant channels and removing the others. Figure 2 represents the identified relevant electrodes for each finger in all subjects. As depicted in Figure 2, despiteusing 64 channels during the acquisition process, more than 70% of the channels were removed due to not containing useful information. Furthermore, the most sensitive channels were in the left hemisphere and the center of the cortex as the scope of this study focused on the movements of fingers of the right hand. These results were obtained with an α_threshold set to 70%.
Concatenate test data from different classes tr =CSP(T r ); Features extraction of the training session; t =CSP(T e ); Features extraction of the test session; Cl p = Classifier_algorithm( tr ,Labels(θ)); Extract classifiers parameters Cl p ; Acc= Classifier_algorithm( te ,Label(θ)); Predict classes and compute the system accuracy Acc;  Figure 3 shows the spatial filters, obtained with CSP algorithm after identification of relevant electrodes. The obtained features are available online at Supplementary Materials (Folder S2). These maps show that the location of relevant electrodes changes from one subject to another and from one finger to another for the same subject, as expected from the literature [26]. The features are generally smoother and physiologically more relevant, with strong weights over the motor cortex areas, except in some cases where the features have large weights in several unexpected locations from a neuro-physiological point of view. Four different metrics have been used to measure the efficiency of the proposed method to detect fingers movements. These metrics are: the Accuracy, Precision, Recall, and the F-measure.
The integration of the channel selection algorithm with the same feature extraction as well as classification algorithms enhanced the accuracy of the system significantly, by more than 20% for each subject. The obtained system accuracy was 81% overall. Table 1a-e present the significance test for the five subjects. The column "Raw Accuracy" of these tables shows the accuracy of the classification process of finger movements using CSP and LDA without our proposed statistical based channel selection. The results demonstrate the efficiency and the validity of our approach. Table 1f presents the accuracy obtained for each subject. Despite the system classifying five finger movements simultaneously, the measured accuracy exceeded 83%, which exceeds all previous literature concerning EEG and fingers. In fact, with the use of the same approach, multiple finger movements can be detected simultaneously, in addition to having high model accuracy.

Discussion
This research was implemented with the use of a relatively large amount of data instances. The sessions of the recording will hopefully help other BCI researchers bring further improvements based on this data. The starting prediction models on the raw data ranged from 52% to 59% and this was highly improved with intensive cleaning and the addition of a pre-processing phase. Having an accuracy of 83% proves the quality of the decided approach. Our pre-processing approach showed high accuracy results by choosing the relevant channels after their comparison with reference channels and with the exclusion of unimportant channels. The prediction model will get a differentiable dataset by using this pre-processed sequence along with the feature extraction approach that can be classified using a machine learning model such as the LDA. The main advantage of giving every finger its classifier is that it allows the model to predict movements of multiple fingers at the same time, which has not been done or discussed in previous works. The determination of the flexion angle of the fingers and distinguishing between different finger movements extracted from both hands could be investigated in future works, along with improving the accuracy of the current system. Table 2 presents the accuracy in association with the proposed system and the overall results of existing methods that are validated according to the online and offline approach. System performance is significantly improved by the proposed system, achieving a system accuracy of 81% on average according to the offline approach. Therefore, the proposed finger decoding system outperforms those described in previous studies in multiple ways. For example, the average accuracy described herein increased by 4% compared to the best known previous system that was presented in [10]. Moreover, the proposed system significantly improves the runtime using robust and efficient algorithms in contrast with the method presented in [7][8][9][10]. A small number of trials for every finger movement are sufficient to train the system for the on-line scenario before being used by a new user. Indeed, the number of training set could be increased using data augmentation techniques. The data augmentation technique which we have adopted in this work consists of decomposing every trial t of a total time T into fragments of an equal small window size W. Having fragments with small duration does not harm the proposed method since the features are extracted from the frequency domain of the trial and not from its time domain. Moreover, every two consecutive fragments may overlap. Let's define O as the overlapping ratio. This ratio determines how much data are common between two consecutive fragments. Thus, every trial t will be split into N fragments of a window size W. N is calculated as follows: Therefore, if we consider a trail t of 6 s. The trial t could be split into N = (6 − 2)/(0.25 × 2)) + 1 = 9 fragments of 2 s each with an overlapping ratio of 75%. Thus, five trials of 6 s will be decomposed to 45 trials of 2 s.

Conclusions
This study aimed to develop a BCI system for disabled people who are suffering from motor mobility impairment. The outcomes of this study may contribute to the development of a next-generation prosthesis, i.e., a brain-controlled prosthesis. Such prosthesis can offer an alternative method for disabled people to restore their mobility. In this study, a prediction method was developed that consists of a set of one-class classifiers. An average accuracy of 81% was achieved with the proposed method. Existing EEG BCI systems decode only single finger movements. In contrast, different models were trained during the establishment of this system, including the SVM, Gaussian, Naïve Bayes, Linear Regression, as well as the LDA model. The LDA was the classifier which obtained the best results. The system was trained and tested using a data-set recorded from volunteers. These promising results can significantly increase the control of EEG-based BCI technologies and potentially facilitate their development with rich control signals to drive complex applications. The detection of continuous finger movements will be the target of the future work associated with this system.