1. INTRODUCTION
The brain controls most of the body’s activities, such as pro-cessing, integrating, and coordinating the information it re-ceives from the sensory organs, and makes decisions regard-ing the generalizations sent to the rest of the body’s organs. The brain is located inside the skull and is protected by it. The cerebrum is the largest part of the human brain; it consists of two cerebral hemispheres. The cerebral cortex consists of six neural layers, while the parietal cortex consists of only three or four layers. Although the left and right cerebral hemispheres are very similar in shape and functions, some functions are related to one side of it, such as language in the left cleft and visual and spatial ability in the right cleft. This research is considered a combination of brain–computer interface and artificial intelligence.
2. PREVIOUS STUDIES
Many studies have been conducted in order to recognize brain signals using artificial intelligence. A number of researchers in [1] presented a study to recognize brain signals using a local dataset consisting of 21,700 EEG brain signals. FBCSP (filter bank CSP) was used with a variable number of filters in primary processing and a CNN network as a classifier. The average recognition rate was 74.15% with an error rate of ±15% at a 3×3 kernel and 10 filters.
A study was also conducted to identify brain signals expressing actual hand movement and motor perception (imagined hand movement) using Linear Discriminant Analysis (LDA) for classification and CSP in primary processing, using a protected database. The muscle signals of the hand were recorded synchronously with the EEG brain signals, converted into a binary matrix of size 6 × 30, and stored as a dataset. The LDA classifier was then trained to recognize the EEG signals by converting them into a binary matrix of the same size and comparing it with the dataset. The recognition rate was 63.98±7.54% for actual movement and 46.96±15.3% for motor perception [2].
Another study was presented to identify brain signals using a CNN network as a classifier and the Finger dataset. This dataset contains EEG signals expressing real movement of the fingers of one hand individually. Ten people participated in the recording with a recording frequency of 1000 Hz, and a rate of 80% was reached using a Support Vector Machine (SVM) as a classifier [3].
Another study was conducted to identify EEG signals, in which a Generative Adversarial Network (GAN) was used to add fake samples to the dataset. The CNN classifier also used four bypass layers and two max-pooling layers, and a recognition ratio of 67.97±15.86% was reached on the IV2b dataset when 300 fake samples were added [4].
It should be noted that performance assessment should be carried out on the same dataset; the use of a specific kernel for the CNN classifier gives different results depending on the dataset used.
The results obtained in these studies cannot be generalized to all databases and classifiers, as the parameters used do not necessarily give the best performance. It is therefore necessary to study the impact of changing classifier parameters on the recognition ratio and on training and recognition times.
3. THE IMPORTANCE OF THE RESEARCH AND ITS GOALS
The importance of the research lies in the fact that increasing the recognition rate contributes to the practical application of motor perception systems and therefore contributes to finding solutions for amputees. When the movement imagined in the brain is recognized, commands can be directed from the brain to robotic prosthetic limbs and executed. In this research, an EEG signal recognition system is built using a CNN network, and the effect of changing the parameters of this network on the recognition ratio is studied.
4. RESEARCH METHODS AND MODALITY
Initially, the brain signals are loaded chronologically and spectrally. The preprocessing process is then applied, and the relationship between the nature of the EEG brain signals and the coefficients of the CNN classifier is explored. Afterward, the effect of calibrating these coefficients on the recognition ratio is studied. The IV2b dataset is used to test the performance of the proposed classifier. The work was performed within the Google Colaboratory environment.
An electroencephalogram (EEG) is a multichannel time series that captures the electrical activity recorded from the scalp at specific electrode locations, as shown in Figure 1.
EEG signal recording systems usually use electrodes, each connected to a single wire. The locations and names of the electrodes are determined through the international 10–20 system, which ensures the standardization of electrode names in all laboratories.
4.1 The Database Used
The BCI Competition IV2b database was used. It consists of data for 9 participants and contains 6,520 motor-imagery trials. Brain signals were recorded using three EEG electrodes, C3, Cz, and C4, at a sampling frequency of 250 Hz, and the signal was passed through a band-pass filter from 0.5 to 100 Hz.
The database contains two types of motor imagery: imagining movement of the right hand and imagining movement of the left hand. Figure 2 shows one motor-imagery sample from the IV2b database.
4.1.1 Common Spatial Pattern
The CSP idea is based on a set of linear transformations that increase the contrast between the target classes by moving to a new space (CSP). The matrix of mutual variation between classes is calculated, followed by the transformation matrix, and filters that give the highest contrast between classes are applied. Figure 3 shows the signal before and after applying CSP.
Let X1 and X2 be two windows of a multichannel signal. The CSP algorithm determines the component wT so that the contrast ratio between the two windows is maximized according to [5]:
w = argmax
The CSP method can be applied to multichannel signals in general and is commonly applied to EEG signals in particular. Figure 4 shows EEG brain signals after applying CSP with four filters to the EEGBCI database. The CSP2 filter gives the greatest contrast between classes, and the scale next to the figure shows the spectral-activity value represented by each color gradient.
The use of CSP in the time domain results in a matrix with dimensions (11,26,3,1) for each motor-imagery trial in the IV2b dataset, while in the spectral domain it produces a matrix of dimensions (3,3,1), which does not fit the nature of the CNN classifier.
4.1.2 Classifier Construction
The classifier was built using a CNN consisting of two convolutional layers (Conv2D), an average-pooling layer, a flattening layer, and two dense layers (i.e., two fully connected layers). The first dense layer consists of 80 neurons, and the second, which is the output layer, consists of two neurons, as shown in Figure 5.
The input to the CNN is the brain signal after conversion to a matrix. Each repetition or motor-imagery epoch is a digital matrix with dimensions (3,1126,1), where 3 is the number of recording channels or electrodes and 1126 is the number of time samples per channel. Figure 5 shows the input and output of each classifier layer when 40 filters are used per layer.
Table 1 shows the input and output of each layer in the CNN proposed in Experiment 4 of the second scenario. It also shows the number of parameters produced by each layer and the total number of parameters. This number changes
significantly with the kernel of each layer, ranging in this research from 200,000 to 2,200,000. The parameters indicate the weights and other values adjusted during network training and testing, through which classifier complexity can be estimated.
4.2 Performance Evaluation Criteria
The performance of the proposed classifier is evaluated by measuring accuracy and the area under the AUC curve, which is one of the most important criteria for measuring recognition accuracy when there are only two classes. Accuracy is calculated by [10]:
Accuracy = True Positive+True Negative True Positive+True Negative+False Positive+False Negative.
True Positive (TP) denotes positive instances classified correctly; True Negative (TN) denotes negative instances classified correctly; False Positive (FP) denotes negative instances classified as positive; and False Negative (FN) denotes positive instances classified as negative. These values are obtained from the confusion matrix shown in the scenario results.
Area under the ROC curve (AUC): AUC is an important criterion for evaluating classifiers, as it measures confidence in the classifier based on the Receiver Operating Characteristic (ROC) curve. The ROC curve describes classifier performance at different thresholds. The true-positive rate (TPR) is placed on the y-axis and the false-positive rate (FPR) on the x-axis; the upper-left corner represents the ideal case. The AUC value ranges from 0 for the worst performer to 1 for the best performer, as shown in Figure 6.
1 Conv2d 20,1 (None,1126,3,40) 840 ReLU 2 Conv2d 1,3 (None,1126,3,40) 4,840 ReLU 3 Average_pooling2d 100,1 (None,21,3,40) 0 – 4 Flatten – (None,2520) 0 – 5 Dense1 – (None,80) 201,860 ReLU 6 Dense2 – (None,2) 162 Softmax
Total parameters 207,522 Trainable parameters 207,522 Non-trainable parameters 0 Optimizer: Adam; Model: Sequential; Batch size: 32
Time is divided into two parts: training time, which is the time needed to train the classifier, and test time, which is the time needed to test the proposed system.
Experimental scenarios: The work was carried out according to three different scenarios. In all scenarios, 80% of the IV2b dataset was used for training and 20% for testing.
In the first scenario, the CNN network was tested while changing selected parameters until the best performance was reached, in order to study the effect of parameter changes on performance. In the second scenario, CSP was applied during signal preprocessing, and the network parameters that gave the best performance in the first scenario were used to study the feasibility of CSP in the time domain. In the third scenario, the effect of adding layers on the recognition ratio and time cost was studied by adding a Conv2D layer between the first and second layers.
The CNN parameters changed in the proposed scenarios are the kernel of the first layer (Kernel 1), the kernel of the second layer (Kernel 2), the kernel of the third layer (Kernel 3), and the stride in the average-pooling layer.
5. RESULTS AND DISCUSSION
The simulations for designing and testing the proposed system were conducted on the Google Colab platform using Python 3, 12.7 GB of RAM, a GPU with 15 GB of memory, and 78.2 GB of storage.
The First Scenario
Eleven experiments were conducted using different kernels for each layer of the CNN, testing network performance on the IV2b database in terms of recognition ratio, training and recognition times, and the AUC criterion. Increasing the kernel size increases the time cost. To limit this increase, the stride in the average-pooling layer was enlarged. The stride indicates the step taken by the kernel; increasing it reduces the output of that layer.
Table 2 shows that the best result was obtained with kernel (35,1) in the first layer and (1,3) in the second layer, yielding 76.38%. The worst performance was obtained with kernel (3,3) in the first layer and (3,3) in the second layer, yielding 65.439%. The difference between the best and worst performance was 10.941 percentage points in recognition ratio and 14.615 seconds in training time. The 3×3 kernel produced the worst recognition ratio with the proposed classifier on the IV2b database.
The Second Scenario
Six experiments were conducted using CSP in data preprocessing and changing the classifier coefficients to obtain the results shown in Table 3. The best performance using CSP in primary processing was obtained with a (35,1) kernel in the first layer and a (1,3) kernel in the second, with a recognition rate of 76.022%. Thus, CSP did not significantly affect recognition performance, but reduced training time by four seconds on average. A circular (3,3) kernel gave the worst performance, at 72.903%, compared with a one-dimensional kernel.
0.80698 0.75664 4 71.792 50,1 100,1 1,3 35,1 1 0.80492 0.74846 4 71.783 50,1 100,1 1,3 30,1 2 0.80635 0.75306 4 71.634 50,1 100,1 1,3 25,1 3 0.80605 0.76022 3 71.564 50,1 100,1 1,3 20,1 4 0.79759 0.74130 4 75.739 50,1 100,1 1,3 15,1 5 0.79022 0.72903 5 108.117 50,1 100,1 3,3 5,1 6
The Third Scenario
A Conv2D layer was added to the CNN to study the effect of adding a layer on network performance. Two experiments were conducted, and the kernel was changed in each experiment, as shown in Table 4.
0.81060 0.76175 7 250.213 50,1 100,1 1,3 10,1 35,1 1 0.80581 0.76533 7 265.177 50,1 100,1 10,3 25,1 50,1 2
nition ratio compared with the best case in the first scenario. However, the test time increased by 4 ms, almost doubling, and the training time increased by 189.598 s. Figure 7 shows how samples were identified based on the confusion matrix.
6. CONCLUSION
The use of a horizontal kernel (m,1) in the first classifier layer and a vertical kernel (1,n) in the second layer, where n equals the number of channels or sensors, improved the recognition ratio by 11.1%.
The use of Common Spatial Pattern (CSP) in the time domain with the CNN classifier had no noticeable effect on the recognition ratio. Its use in the spectral domain does not fit the nature of the CNN classifier, but it can be used with other classifiers such as a Support Vector Machine (SVM).
Adding layers to the classifier also increases the recognition ratio, but at the expense of significantly increased training and recognition times, without a substantial performance improvement. After studying and analyzing the results, the following directions are proposed:
- Use CNN hybrids with other classifiers, such as a Random Forest classifier.
- Increase preprocessing and use algorithms compatible with the nature of the CNN classifier.
- Use well-known classifiers such as GoogLeNet and AlexNet after processing the brain signals to make them suitable for these networks.