Translator Disclaimer
Open Access
14 September 2017 Convolutional neural network for high-accuracy functional near-infrared spectroscopy in a brain–computer interface: three-class classification of rest, right-, and left-hand motor execution
Thanawin Trakoolwilaiwan, Bahareh Behboodi, Jaeseok Lee, Kyungsoo Kim, Ji-Woong Choi
Author Affiliations +
The aim of this work is to develop an effective brain–computer interface (BCI) method based on functional near-infrared spectroscopy (fNIRS). In order to improve the performance of the BCI system in terms of accuracy, the ability to discriminate features from input signals and proper classification are desired. Previous studies have mainly extracted features from the signal manually, but proper features need to be selected carefully. To avoid performance degradation caused by manual feature selection, we applied convolutional neural networks (CNNs) as the automatic feature extractor and classifier for fNIRS-based BCI. In this study, the hemodynamic responses evoked by performing rest, right-, and left-hand motor execution tasks were measured on eight healthy subjects to compare performances. Our CNN-based method provided improvements in classification accuracy over conventional methods employing the most commonly used features of mean, peak, slope, variance, kurtosis, and skewness, classified by support vector machine (SVM) and artificial neural network (ANN). Specifically, up to 6.49% and 3.33% improvement in classification accuracy was achieved by CNN compared with SVM and ANN, respectively.




Brain–Computer Interface

A brain–computer interface (BCI) is a means of communication between the human brain and external devices. BCIs are typically designed to translate the neuronal activity of the brain to restore motor function, or to control devices.19 The major components of an effective BCI system are: (1) acquisition of brain signals using a neuroimaging modality, (2) signal processing and analysis to obtain features representative of the signal, and (3) translation of features into commands to control devices.7 Well-designed BCI systems have proven to be helpful for patients with severe motor impairment, and have improved their quality of life. For instance, many studies have been successfully conducted with patients who have suffered a stroke,10,11 have amyotrophic lateral sclerosis,12,13 or have spinal cord injury (SCI),14,15 in which BCI systems have allowed them to control external devices.

BCI systems have been developed based on invasive16,17 as well as noninvasive4,18 neuroimaging modalities, including electroencephalography (EEG),1823 magnetoencephalography (MEG),10,24 electrocorticography (ECoG),16 functional magnetic resonance imaging (fMRI),2527 and functional near-infrared spectroscopy (fNIRS).12,23,2833 BCI systems based on MEG, ECoG, fMRI, and EEG generally suffer from bulkiness, high cost, high sensitivity to head movements, low spatial and temporal resolution, and low signal quality. fNIRS-based systems are known to be more advantageous, in that they can provide moderate temporal and spatial resolution.


Functional Near-Infrared Spectroscopy-Based Brain–Computer Interface System

In the last few decades, fNIRS has been recognized as a promising noninvasive optical imaging technique for monitoring the hemodynamic response of the brain using neurovascular coupling. Neurovascular coupling in the cerebral cortex captures the increases in oxygenated hemoglobin (HbO) and reductions in deoxygenated hemoglobin (HbR) that occur during brain activity. To accomplish this, fNIRS employs multiple light sources and detectors, which emit and receive near-infrared light (at wavelengths between 650 and 950 nm), respectively. The emitted light passes through the scalp, tissue, and skull to reach the brain.3436 The relationship between light attenuation (caused by absorption and scattering) and changes in the concentration of HbO and HbR can be expressed by the modified Beer–Lambert law (MBLL),34 since HbO and HbR have different absorption coefficients in the near-infrared wavelengths.31,34,36

Several recent studies have focused on building fNIRS-based BCI systems. In previous research, various types of experiments have been performed to measure the accuracy of systems’ classification, using mental arithmetic,31,33 motor imagery,2831 motor execution,23,30,33,37 and other approaches. This type of research is particularly important since the final goal of the BCI is to have a system which is able to interpret subject intention, and any misclassification in the BCI system can lead to accidents for the user. Accordingly, improving classification accuracy is the most essential feature of the BCI-based communication system.38,39 To this end, it is important to exploit appropriate classifiers as well as discriminant features that can accurately represent the variability in the hemodynamic response signal.40

Many of the studies on fNIRS-based BCI primarily focused on different types of feature extraction techniques and machine learning algorithms.40 For feature extraction, methods of identifying statistical properties such as mean, slope, skewness, kurtosis, etc., from time-domain signals40 filter coefficients from continuous and discrete wavelet transforms (DWTs),41,42 and measurement based on joint mutual information43 have been used. In addition, for machine learning-based classification, methods such as linear discriminant analysis,6,23,29,31,33,38 support vector machine (SVM),12,30,44 hidden Markov model,30 and artificial neural network (ANN)45 have received considerable attention.

Among the above-mentioned techniques for feature extraction, most of the studies have relied on extracting the statistical values of the time-domain signal. However, reaching the highest classification accuracy depends on different factors, such as selecting the best set of combined features46 and the size of the time window.31 In addition, classification accuracies vary based on different mother wavelet functions for decomposition,41 which affect performance in a heuristic sense. To overcome the limitations of these conventional methods, therefore, an appropriate technique for feature extraction needs to be determined.



The results of previous studies have demonstrated that convolutional neural networks (CNNs) can successfully achieve high classification accuracy in many applications, including image recognition,47,48 artificial intelligence,49 speech detection, and multiple time-series processing.50,51 Considering CNNs’ ability to extract important features from a signal, CNN may be suitable for fNIRS-based BCI as well. Accordingly, our proposed method utilizes CNN to automatically extract the features from the hemodynamic response signal. To be specific, we attempt to answer the following two arguments: (1) does CNN outperform conventional methods in fNIRS-based BCI? (2) How well does CNN work with the input data of the hemodynamic response signal?

To address these questions, we compared the classification accuracies of CNN with those of conventional methods when used as the feature extractor and classifier in fNIRS-based BCI.40 Then, we analyzed how the trained convolutional filters in CNN optimized the features.

The rest of this work is organized as follows. In Sec. 2, the properties of the conventional methods as well as CNN are briefly introduced. Subsequently, data acquisition, preprocessing, and the proposed CNN structures are described in Sec. 3. Sections 46 cover the results, discussion, and conclusion, respectively.



This section describes the details of the commonly used features, machine learning-based classifiers, and how the classification performance is evaluated for BCI systems.


Features Extracted from the Input Signal

While a large body of previous studies have reported various features which can be used to extract the hemodynamic signal, the most commonly used features for fNIRS-based BCI are signal mean (μxi), variance (σxi2), kurtosis (Kxi,j), skewness (Sxi), peak, and slope where such features are computed as40

Eq. (1)


Eq. (2)


Eq. (3)


Eq. (4)

where N is the total number of samples of xi, xi is the i’th row of the input x, xi,j is the j’th signal amplitude of the input xi, and σxi2 is the variance of xi. The signal peak is computed by selecting the maximum value of xi, and the slope is computed using linear regression.


Support Vector Machine

SVM is a discriminative classifier which optimizes a separating hyperplane by maximizing the distance between the training data.52 The decision boundary is obtained by

Eq. (5)

min(12ws2)+Ci=1Lϵ(i)s.t.  ys(i)(xs·ws+bs)1+ϵ(i)0,
where ws is the weight vector, C>0 is the regularization parameter, ϵi>0 is the training error, ys(i) is the true class label for i’th input xs, and bs is the bias. Among these, C plays an important role in reducing the error as well as accommodating the outliers through the training process of the data. In other words, it controls the trade-off between the data training error and the norm of the weights. As a matter of fact, determining a proper C is a vital step in training the SVM on the input data.53


Artificial Neural Network

ANN is a classifier, inspired by a biological brain’s axon, with the ability to detect patterns in the training data set,54 which consists of assemblies of interconnected artificial neurons that provide nonlinear decision boundaries. Typically, ANN consists of multiple layers, respectively called the input layer, fully connected hidden layer(s), and the output layer, with one or more neurons in each layer (see Fig. 1). Through forward propagation, the output values are computed based on the activation function of the hidden layer(s) by

Eq. (6)


Eq. (7)

where oi is the output of the first fully connected hidden layer calculated by using an activation function a to transform the summation of bias value b(1), and the multiplication of the input vector x with the weight vector w(1). Likewise, yi is the output of the second fully connected hidden layer, which is similarly calculated by using the input vector o of the second layer, and the weight vector w(2) and the bias b(2).

Fig. 1

The common structure of ANN.


Through the first iteration of the training procedure, weight values should be initialized. Proper weight initialization is one of the important operations for improving the classification performance of the networks.55 Afterward, the weight values are updated by the backward propagation by comparing the computed output values from the forward propagation with the desired output values, using a loss function. This iteration is performed until the minimum loss function value is achieved.54

To obtain a proper predictive model with ANN, several hyperparameters, such as learning rate, batch size, and number of epochs, should be considered. The learning rate is the parameter that controls how fast the weight values in the fully connected layers can be updated during the training process. Through the batch learning process, training data are separated into several sets, and this is followed by propagation through the training process, where the batch size is the number of samples in each set.55 An epoch is defined as the total number of times that the training procedure is completed.


Convolutional Neural Network

CNN is an effective classifier based on deep network learning. It is highly capable of automatically learning appropriate features from the input data by optimizing the weight parameters of each filter, using forward and backward propagation to minimize classification errors.56

CNN consists of several layers, which are called the input layer, convolutional layer, fully connected hidden layer, and output layer (see Fig. 2). In the convolutional layers, a convolutional filter whose width is equal to the dimension of the input and kernel size (height) of h is convolved with the input data, where the output of the i’th filter is57

Eq. (8)

where w is the weight matrix, x[i:j] is the submatrix of input from row i to j, and oi is the result value.

Fig. 2

The common structure of convolutional neural network.


Then, in order to build the feature map (the input of the next layer), the output of the convolutional layer is converted by an activation function similar to ANN. After each convolutional layer, additional subsampling operations such as max-pooling and dropout are performed to enhance the performance.

Max-pooling57 is one of the common methods used to reduce data size, and it stores only the important data. Dropout,58 which helps CNN avoid overfitting during the training process, is a regularization step that randomly drops out one or more hidden nodes. As with ANN, the mentioned hyperparameters such as learning rate, batch size, and number of epochs should be investigated for CNN in order to improve the classification performance.


Cross Validation

k-fold cross validation is used to estimate the classification performance of the predictive model.53,59 The first step in this process is to divide the data into k-folds, where each fold contains an identical amount of the input data. Then, one fold is used as a test set, while the remaining folds are used as training sets (see Fig. 3). Afterward, a classification procedure is applied to the selected test and training sets. This process is performed for each of the k-folds, and the corresponding accuracies obtained from each test set are averaged to estimate the performance.

Fig. 3

Cross-validation procedure.






Eight healthy subjects were recruited for the experiment (ages of 25.25±3.81 years, three females, all right-handed). The subjects were asked to avoid smoking and drinking alcohol or coffee within 3 h prior to the experiment. None of the subjects had been reported for any neurological or brain injuries. Written consent forms were obtained from all subjects. The experiment was approved by the Daegu Gyeongbuk Institute of Science and Technology (DGIST) Institutional Review Board (DGIST-170414-HR-004-01).


Data Acquisition

For data acquisition, LABNIRS (Shimadzu), an fNIRS device with a multichannel continuous wave with three wavelengths (780, 805, and 830 nm) and a sampling rate of 25.7 Hz, was utilized. A total of 12 sources and 12 detectors, resulting in 34 measurement channels, were placed over the motor areas, C3 and C4, according to the international 10–20 system which corresponds to the motor cortex of the right- and left-hand motor execution (see Fig. 4).60 The distance between source and detector was 3 cm.

Fig. 4

(a) A subject with optodes over motor area C3 and C4 based on the international 10–20 system and (b) the source and detector configuration. Channel numbers 1 to 17 and 18 to 34 were placed over motor areas C4 and C3, respectively.



Experimental Procedure

The subjects sat on a comfortable chair in front of a computer screen, which displayed the experimental tasks. In the experiment, subjects were asked to perform a motor execution task in order to generate a robust signal for better discrimination. To be specific, while a black screen was displayed during the rest task, an arrow pointing right or left was shown during each of the right- or left-hand execution tasks, respectively.

All of the subjects were asked to relax before the experiment in order to stabilize blood flow. For data acquisition, the subjects were trained to relax during the rest tasks and to perform finger tapping during the motor execution tasks. Each subject performed 10 experiments of five sessions of right- and left-hand motor executions, with two rest blocks per session (see Fig. 5). All the blocks lasted 10 s, and each block became a sample. The data for all the subjects were collected within three days. We eventually obtained a total of 100 samples of rest, 50 samples of right, and 50 samples of left-hand motor execution for each subject.

Fig. 5

Experimental procedure includes rest and two motor tasks: right- and left-hand motor execution.



Acquired Data Preprocessing


Calculation of hemoglobin concentration changes

After signal measurement, we converted the signals of light intensity into concentration changes of HbO and HbR by MBLL, utilizing statistical toolbox NIRS-SPM.61 The MBLL equation is given by

Eq. (9)

where Δ[HbO] and Δ[HbR] are the changes in HbO and HbR concentration, respectively, d is the distance between the light source and detector, DPF is the differential path length factor, ϵ is the extinction coefficient at wavelength λ, and ΔOD is the optical density change.



The acquired hemodynamic signal contains various physiological noises, including the heart rate at 0.8 Hz, respiration at 0.2 Hz, Mayer wave at 0.1 Hz, and very-low-frequency oscillations at 0.03 Hz.36,38,40 Among various possible criteria, we employed wavelet filtering to remove physiological noise.62

The wavelet transform is an efficient method of signal analysis and performs by adjusting its window width in both time and frequency domains. For denoising a signal S[n], first, wavelet coefficients are obtained by shifting and dilating the waveforms of the so-called mother function ψ[n], and then important coefficients are selected to reconstruct the signal by thresholding. For a more comprehensive analysis, we also exploited multiresolution analysis (MRA) which decomposes signals into a tree structure using the DWT.41,63 Using MRA based on DWT, S[n] can be approximated by expanding both low- and high-frequency coefficients for M time points as

Eq. (10)

where ϕj0,k[n] and Ψj,k[n]=1jψ(nkj) are scaling and wavelet mother functions, respectively, in which the mother function ψ[n] is dilated with scaling parameter j, translated by k which is the number of decomposition levels, and represented as Ψj,k[n]. Since these functions are orthogonal to each other, taking the inner product results in obtaining the approximation coefficients (low frequency) Aϕ[j0,k]=1MnS[n]ϕj0,k[n] and the detailed coefficients (high frequency) Dψ[j,k]=1MnS[n]Ψj,k[n]. By denoting

Eq. (11)


Eq. (12)

Eq. (10) can be rewritten as

Eq. (13)


In order to remove the undesired high- and low-frequency noises, we exploited a 10-level wavelet decomposition with a Daubechies (db5) mother function.62 In addition, we used a bandpass frequency between 0.02 and 0.1 Hz, in which the combination of low-frequency components d8 and d9 from the 10-level decompositions was solely in the same 0.02- to 0.1-Hz frequency range. Therefore, the filtered signal was reconstructed based on d8 and d9 by Sdenoised[n]=d8+d9. After filtering, the hemodynamic response signals were normalized into range (0,1) by subtracting with the signal mean and scaling.


Feature Extraction and Classification

After filtering, we trained and tested the classifiers for each individual subject based on the extracted features. Following the training step, we computed the classification accuracies from both the conventional methods (SVM- and ANN-based fNIRS) and the proposed method (CNN-based fNIRS). In this section, we discuss the details of the conventional methods and our proposed CNN structure.


Conventional methods

As mentioned, features were extracted after the filtering step, followed by normalizing into range (0,1). The obtained input data contained 408 feature dimensions (6 features ×2 signal of HbO and HbR ×34 channels). Using such features with the settings above, we evaluated the performance of the conventional methods by observing the concentration changes of HbO and HbR over all channels using SVM and ANN.

Before applying SVM, since such high-dimensional features usually suffer from performance degradation in classifiers,64 a principle component analysis (PCA) was utilized to decrease the dimensions of the data. This reduces the aforementioned effect by maximizing the variance using a smaller number of principle components.52 Grid search53,65 was used to determine the number of principle components and the C regularization parameters in SVM, and the combination of both parameters which yielded the highest classification accuracy was selected.

In this study, we report the results for linear SVM and multiple structures of ANN (see Table 1). To be specific, structures of ANN with one hidden layer (ANN1) and two hidden layers (ANN2) were evaluated. For further comprehensive investigation, each structure of ANN was considered with various numbers of neurons. All of the aforementioned hyperparameters were tuned for each subject (see Table 2).

Table 1

Structures of ANN.

StructureHidden layerNeurons in each hidden layer
ANN2-a2256, 128
ANN2-b2512, 256
ANN2-c2512, 128

Table 2

Hyperparameters of each individual subject for ANN.

Batch size646416161632
Learning rate0.0010.00050.0010.00050.0010.001
Batch size161632161616
Learning rate0.00050.0010.00050.00010.00050.001
Batch size161664643232
Learning rate0.00010.00010.00050.00010.00010.0001
Batch size163264323264
Learning rate0.00050.00050.00050.00050.00010.0005
Batch size326464166464
Learning rate0.00050.00050.00050.00010.0010.001
Batch size161632161616
Learning rate0.0010.0010.00050.00050.00050.0005
Batch size163216161664
Learning rate0.00050.00050.0010.00050.00050.001
Batch size646432323216
Learning rate0.00010.00010.00010.00010.00010.0001


Proposed structures of convolutional neural network

Instead of using other methods, we employed CNN as the feature extractor as well as the classifier in this study. As the input data, the changes in HbO and HbR concentration over all channels were passed through CNN layers using the structures presented in Table 3. The input data for CNN were an M by N matrix, where M is the number of points during 10 s that correspond to the sampling rate (M=time×sampling rate257) and N is the number of channels for both HbO and HbR (34 channels each of HbO and HbR). Similar to the process used to evaluate the conventional methods, we considered two structures of CNN, that is, CNN with one convolutional layer (CNN1) and three convolutional layers (CNN2). Furthermore, each structure of CNN was considered with a distinct number of filters (see Table 3).

Table 3

Structures of CNN.

StructureConvolutional layerFilters in each convolutional layer
CNN2-a332, 32, 32
CNN2-b364, 64, 64

All of the convolutional filters in the convolutional layers performed one-dimensional convolution with the input data along the vertical axis, as shown in Fig. 6. Each convolutional layer consisted of filters with a kernel size of 3, and an algorithm63 was used to update the weight values in the training process. After each convolutional layer, max-pooling with a kernel size of 2 was applied, followed by dropout with a dropout rate of 50%. The first and second fully connected layers contained 256 and 128 hidden nodes, respectively. The output layer had 3 nodes corresponding to the three classes, which were classified using softmax. For better understanding of the structures mentioned here, the input and output sizes of each layer in our proposed CNN2-a are summarized in Table 4.

Fig. 6

The input data consisted of the concentration changes of HbO (red) and HbR (blue) overall channels. A convolutional filter ran through the input data along the vertical axis.


Table 4

Input and output size of the CNN2-a.

LayerInput sizeOutput sizeProperties
Convolutional layer 1257, 68257, 3232 filters with kernel size 3
Max-pooling 1257, 32128, 32Kernel size 2
Dropout 1128, 32128, 32Dropout rate 50%
Convolutional layer 2128, 32128, 3232 filters with kernel size 3
Max-pooling 2128, 3264, 32Kernel size 2
Dropout 264, 3264, 32Dropout rate 50%
Convolutional layer 364, 3264, 3232 filters with kernel size 3
Max-pooling 364, 3232, 32Kernel size 2
Dropout 332, 3232, 32Dropout rate 50%
Fully connected layer 11024256256 hidden nodes
Fully connected layer 2256128128 hidden nodes
Output layer12833 hidden nodes

In the proposed structure, the activation functions of all layers were set to a rectified linear unit (ReLU), which is a nonlinear function, as shown in66

Eq. (14)


Unlike other activation functions, ReLU avoids a vanishing gradient and in practice converges to the optimum point much faster. Consequently, it improves the training process of deep neural network architectures on large scale and complex data sets.

In addition, the hyperparameters for training all the CNN structures, including learning rate, number of epochs, and batch size, were chosen for each individual subject using Grid search (see Table 5). Adam was applied as a gradient descent optimization algorithm, whose parameters β1, β2, and ε were set to 0.9, 0.1, and 108, respectively.67

Table 5

Hyperparameters of each individual subject for CNN.

Batch size16643216
Learning rate0.0010.0010.0010.0005
Batch size32161664
Learning rate0.00050.0010.00050.001
Batch size16646432
Learning rate0.00010.00050.0010.0005
Batch size32321616
Learning rate0.00010.0010.00010.0005
Batch size64163264
Learning rate0.0010.00050.0010.001
Batch size16321632
Learning rate0.00050.00010.0010.001
Batch size64326416
Learning rate0.0010.0010.00050.0005
Batch size64326416
Learning rate0.0010.0010.00050.0005


Visualization of Feature Extraction

Many previous studies of feature extraction in fNIRS-based BCI have been reported in the past. Since appropriate features and classifiers are desired in order to achieve high classification accuracy, the proposed method of the CNN exploitation was utilized in this study because of its automatic feature extraction property.

To provide better insights into the feature extraction performance, a visualization of the features extracted by the aforementioned methods is shown and compared. Because high-dimensional data are difficult to visualize, the PCA was applied to reduce the dimensionality of the data.

In this study, we also compared the visualization of the hemodynamic response signals with the features extracted by conventional methods and convolutional filter, by plotting the first two principle components of the PCA. The overall procedure to visualize signal features is shown in Fig. 7.

Fig. 7

The overall procedure to visualize signal features, including the hemodynamic response signal, commonly used features in fNIRS-based BCI, and output of the convolutional filter (feature map). The first and second principle components of the signal features are illustrated for the visualization.



Computational Time in the Classification

In our work, various machine learning algorithms were applied to classify tasks, including rest, right-, and left-hand motor executions. For the ANN and CNN, we trained the model using GPU GeForce GTX 1070.68 The data were divided equally into 10-folds, and then nine folds were used as a training set. To imitate the environment of a real application, a single sample was fed through the trained model then the computational time was measured. For training SVM, ANN, and CNN, the hyperparameters such as C regularization, number of epochs, and learning rate were set to 1, 1, and 0.01, respectively.




Measured Hemodynamic Responses

In the experiment, the changes in HbO and HbR concentration were measured as the input data for classification. The average of the hemodynamic response signals was obtained with respect to the samples from subjects 1 and 2, across full sessions of each task for rest, right-, and left-hand motor executions and are shown in Figs. 8(a)8(c), respectively. Each row of the input data indicates signal amplitudes. These are represented by red and blue colors, which imply the maximum and minimum amplitudes, respectively. The beginning and the end of the tasks correspond to 0 and 10 s, respectively.

Fig. 8

Average hemodynamic response of each execution task measured from subject 1 and 2: (a) rest, (b) right-, and (c) left-hand motor execution. Each input presents concentration changes of HbO and HbR overall 34 channels. Red and blue colors represent the maximum and minimum amplitude, respectively.


As is widely known, neural activity induces typical changes in cerebral blood oxygenation, resulting in increases in HbO concentration and decreases in HbR concentration.34 In our results, a similar behavior in the hemodynamic response can be observed, as shown in Fig. 8. To be specific, the signals obtained from channels over C3 show higher cortical activation of HbO over a period of 5 to 10 s during the right-hand motor execution [see Fig. 8(b)], whereas the signals over C4 have higher activation during the left-hand motor execution [see Fig. 8(c)].

Figure 9 shows the averaged signals for the entire experiment over all channels of the left and right hemispheres. It is obvious that the change in HbO concentration is higher in the left cerebral cortex during the right-hand motor execution [see Fig. 9(b)], while it is larger in the right cerebral cortex during the left-hand motor execution [see Fig. 9(c)]. The brain behaviors observed in Fig. 9 demonstrate that three-class discrimination, for rest, right-, and left-hand motor execution, can be achieved, since they show different patterns of cortical activation over the left and right hemispheres.

Fig. 9

Average signal amplitude of subjects 1 and 2 across left (C3) and right (C4) hemisphere from full sessions of each class: (a) rest, (b) right-, and (c) left-hand motor execution. Red and blue colors imply HbO and HbR, respectively. Solid and dot lines are related to the C3 and C4 motor areas in that order.



Classification Accuracies

To determine the classification accuracies of the SVM, ANNs, and CNNs, we employed 10-fold cross validation to estimate performance and to optimize hyperparameters, as we attempted to discriminate the three classes of rest, right-, and left-hand motor execution. In this section, the classification accuracies of commonly used features classified by SVM and ANNs are compared with those obtained by CNNs.

To be specific, the classification accuracies for all the tested criteria for the individual subjects are presented in Table 6. As expected, the results of all the individual subjects indicate that the use of CNN was significantly superior to SVM and ANN. For convenience of analysis, the average of the classification accuracies of SVM, ANN, and CNN (86.19%, 89.35%, and 92.68%, respectively) are presented in Fig. 10, which confirms the superior performance of CNN over the conventional methods. This superior performance is due to CNN’s ability to learn the inherent patterns of the input data, by updating the weight values of the convolutional filters.

Table 6

Classification accuracies of the individual subjects (%).


Fig. 10

Average classification accuracies of the individual subjects.


The learning performance can be affected by the size of the training set, and this is especially true for ANN and CNN, where a larger-sized training set usually provides higher classification performance. To examine the effect of the size of the data set on the classification accuracy, the average classification accuracies across all the subjects were obtained, based on different numbers of samples.

To evaluate the classification performance, 10-fold cross validation was utilized. For all the classification methods, the classification performance was found to increase with the number of samples in the data set, and the classification accuracy of CNN outperformed other tested methods for all numbers of samples (see Fig. 11). Moreover, the CNN was also able to attain higher accuracy with smaller numbers of samples; for instance, CNN exceeded 90% accuracy with 120 samples, whereas ANN required 200 samples to reach 89% accuracy.

Fig. 11

Average classification accuracies across all the subjects, based on different number of samples.



Analysis of Feature Extraction Performance

To better understand the feature extraction performance, we visualized the three classes of rest, right-, and left-hand motor executions. To be specific, three classes were visualized using the hemodynamic response signals, features extracted by the conventional methods, and the output of the first layer convolutional filter, by plotting the first and second principle components of PCA (see Fig. 12). The results for subjects 1 and 2 show that the features extracted by the convolutional filters are better discriminated compared with commonly used features and the hemodynamic response signals.

Fig. 12

The visualization of the hemodynamic response signals, commonly used features, and output of the convolutional filter from (a) subject 1 and (b) subject 2.


When considering just the binary classification of rest and motor execution, both the conventional methods and CNN resulted in well-separable features. However, for the binary classification of right- and left-hand motor executions, and for multiclass classification, it was clear that features extracted by the convolutional filter were better discriminated as compared with the conventional methods.


Convolutional Filters of Convolutional Neural Network

One might notice that CNN is able to recognize the patterns of three different classes by updating its filters’ weight values. Therefore, to further investigate the convolutional filters of CNN, we examined the first layer of CNN to determine whether it is able to identify the distinguishable channels from the input or not. By training the data using forward and backward propagations, we let CNN learn how to emphasize some channels containing distinguishable signals by increasing the corresponding weight values, since each column of convolutional filter interacts with each channel from the input data. To approximate the most distinguishable channel, each column of the convolutional filter was averaged after training. Then, the channel of all of the samples of the input data with the highest weight value of the averaged convolutional filter was selected for visualization.

In order to visualize the essential information, the most distinguishable channels from all the samples were selected. Two examples of the CNN filter weight values from subject 1 are shown in Fig. 13, where each row represents the most distinguishable signal from a single sample and the red and blue colors indicate the maximum and minimum amplitudes, respectively. We found that over a period of 5 to 10 s, there were remarkable differences in the signals chosen from both filters for the three classes of rest, right-, and left-hand motor execution.

Fig. 13

Each filter trained by subject 1 represents signals from a channel in every samples corresponding to the highest weight value. The filters represent three classes in the classification: (a) rest, (b) right-, and (c) left-hand motor execution.


Subsequently, in Fig. 13(a) which represents the rest task, both filters have low signal amplitude. Figure 13(b) represents the right-hand motor execution, in which filter 1 shows a higher signal amplitude than filter 2. In the same manner, Fig. 13(c) shows the left-hand motor execution, in which filter 2 exhibits a higher signal amplitude compared with filter 1. Therefore, it can be concluded that filter 1 can detect right-hand motor execution, and filter 2 detects left-hand motor execution.


Computational Time

The computational time for each of the classification algorithms, i.e., SVM, ANN, and CNN, was averaged across all subjects and structures (see Table 7). For the training process, the computational time for CNN was 2 and 183 times greater than ANN and SVM, respectively. For testing time, the computational time for CNN was 6 and 81 times greater than ANN and SVM, respectively. The computational time for CNN in the training and testing process was longer than ANN and SVM, as its structure is deeper and more complex. However, it provides a better performance in terms of classification accuracy.

Table 7

Computational time(s).

Training timeTesting time



The primary aim of the present study was to evaluate the use of CNN versus conventional methods in fNIRS-based BCI, particularly in light of the automatic feature extraction property of CNN. The proposed and conventional methods were investigated to compare their respective classification accuracies.

In the experiment, motor execution tasks performed by healthy subjects were utilized to obtain strong and robust hemodynamic response signals. However, in real applications, motor imagery can produce a greater impact than motor execution tasks, in both healthy users and in patients with severe motor impairment. A previous study reported that the cortical activation resulting from motor execution is similar to motor imagery.6 Hence, it is feasible that a healthy user or a patient without a brain injury, such as SCI, will be able to use motor imagery for commands instead of motor execution. Further investigation of the use of motor imagery, and the study of patients with neurological disorders, will be explored in the future.

The results of the classification accuracies in Fig. 10 imply that the proposed method using CNN outperforms the conventional methods. To be specific, the analysis of signal features by visualizing the first and second principle components demonstrates that the features extracted by the convolutional filter yield better discriminating features than conventional methods, because it is capable of learning appropriate features from the training data.

Additionally, the channels corresponding to the highest weight value in the trained CNN filter demonstrate that the convolutional filter emphasizes the discriminating signal from the training data. It is also worthwhile to note that while the performance of feature extraction for the binary classification of rest and motor execution was similar for both the conventional and proposed methods, since they showed well-discriminated features, the proposed method performed better for multiclass data. This is because the convolutional filter is able to transform mixed data into well-separated data.

Consequently, the proposed method will be appropriate for various systems that require multitasks to command. For instance, a brain-controlled wheelchair requires multiclass classification to control the wheelchair in several directions. Although the proposed method requires a longer time for training, it performs better in multiclass classification.

The number of samples used to train the classifier directly affects classification accuracy, especially in the complex classifier, as shown in Fig. 11. For a small number of samples, the classification performances of SVM, ANN, and CNN were similar. However, as the number of samples increased, the complex classifier was able to achieve higher accuracy than the simple classifier, though the computational time to train was much greater than that of the simple classifier.

This means there is a trade-off between accuracy and ease of use when building the appropriate BCI system. The user must take a longer time to train the complex classifier to obtain a high-performance classifier. When an application requires ease of use over safety, the conventional methods might be more appropriate, since a shorter time and smaller-sized training set are desired.

On the other hand, in the case of vital applications, systems to control assistive technology devices for a patient with motor impairment require very high accuracy, since any misclassification would probably lead to a serious accident. Consequently, in such cases the proposed method is recommended even if it takes a longer time, because it achieves higher accuracy with a smaller number of samples (see Fig. 11).



To enhance the classification accuracy of an fNIRS-based BCI system, we applied CNN for automatic feature extraction and classification, and compared those results with results from conventional methods employing SVM and ANN, with features of mean, peak, slope, variance, kurtosis, and skewness. From the measurement results for rest, right-, and left-hand motor execution on eight subjects, the CNN-based scheme provided up to 6.49% higher accuracy over conventional feature extraction and classification methods, because the convolutional filters can automatically extract appropriate features.

The results confirmed that there was an improvement in accuracy when using CNN over the conventional methods, which can lead to the practical development of a BCI system.

Since classification accuracy is the most essential factor for many BCI applications, we will explore further improvements in the accuracy of fNIRS-based BCI by implementing various deep learning techniques, as well as combining fNIRS with other neuroimaging modalities. To investigate clinical applications, we will also undertake experiments with patients.


The authors declare that there is no conflict of interest regarding the publication of this paper.


This work was supported in part by the Basic Science Research Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Science and ICT (No. NRF-2015R1A2A2A01008218), the DGIST R&D Program of the Ministry of Science and ICT (No. 17-BD-0404) and the Robot industry fusion core technology development project of the Ministry of Trade, Industry & Energy of Korea (No. 10052980).



T. O. Zander and C. Kothe, “Towards passive brain–computer interfaces: applying brain–computer interface technology to human-machine systems in general,” J. Neural Eng., 8 (2), 025005 (2011). 1741-2560 Google Scholar


J. R. Wolpaw et al., “Brain–computer interface technology: a review of the first international meeting,” IEEE Trans. Rehabil. Eng., 8 (2), 164 –173 (2000). Google Scholar


J. R. Wolpaw et al., “Brain–computer interfaces for communication and control,” Clin. Neurophysiol., 113 (6), 767 –791 (2002). CNEUFU 1388-2457 Google Scholar


G. Dornhege, Toward Brain-Computer Interfacing, MIT Press, Cambridge, Massachusetts (2007). Google Scholar


R. P. Rao, Brain-Computer Interfacing: An Introduction, Cambridge University Press, Cambridge, Massachusetts (2013). Google Scholar


V. Kaiser et al., “Cortical effects of user training in a motor imagery based brain–computer interface measured by fNIRS and EEG,” NeuroImage, 85 432 –444 (2014). NEIMEF 1053-8119 Google Scholar


J. J. Daly and J. R. Wolpaw, “Brain–computer interfaces in neurological rehabilitation,” The Lancet Neurol., 7 (11), 1032 –1043 (2008). Google Scholar


C. Neuper et al., “Motor imagery and EEG-based control of spelling devices and neuroprostheses,” Prog. Brain Res., 159 393 –409 (2006). PBRRA4 0079-6123 Google Scholar


K. LaFleur et al., “Quadcopter control in three-dimensional space using a noninvasive motor imagery-based brain–computer interface,” J. Neural Eng., 10 (4), 046003 (2013). 1741-2560 Google Scholar


E. Buch et al., “Think to move: a neuromagnetic brain–computer interface (BCI) system for chronic stroke,” Stroke, 39 (3), 910 –917 (2008). SJCCA7 0039-2499 Google Scholar


K. Saita et al., “Combined therapy using botulinum toxin A and single-joint hybrid assistive limb for upper-limb disability due to spastic hemiplegia,” J. Neurol. Sci., 373 182 –187 (2017). JNSCAG 0022-510X Google Scholar


U. Chaudhary et al., “Brain–computer interface-based communication in the completely locked-in state,” PLoS Biol., 15 (1), e1002593 (2017). Google Scholar


U. Chaudhary, N. Birbaumer and M. Curado, “Brain-machine interface (BMI) in paralysis,” Ann. Phys. Rehabil. Med., 58 (1), 9 –13 (2015). Google Scholar


G. Pfurtscheller et al., “EEG-based asynchronous BCI controls functional electrical stimulation in a tetraplegic patient,” EURASIP J. Appl. Signal Process., 2005 3152 –3155 (2005). Google Scholar


K. L. Koenraadt et al., “Preserved foot motor cortex in patients with complete spinal cord injury: a functional near-infrared spectroscopic study,” Neurorehabil. Neural Repair, 28 (2), 179 –187 (2014). Google Scholar


E. C. Leuthardt et al., “A brain–computer interface using electrocorticographic signals in humans,” J. Neural Eng., 1 (2), 63 –71 (2004). 1741-2560 Google Scholar


T. N. Lal et al., “Methods towards invasive human brain–computer interfaces,” in Conf. on Neural Information Processing Systems (NIPS), 737 –744 (2004). Google Scholar


N. Birbaumer et al., “A spelling device for the paralysed,” Nature, 398 (6725), 297 –298 (1999). Google Scholar


L. Parra et al., “Linear spatial integration for single-trial detection in encephalography,” NeuroImage, 17 (1), 223 –230 (2002). NEIMEF 1053-8119 Google Scholar


M. Cheng et al., “Design and implementation of a brain–computer interface with high transfer rates,” IEEE Trans. Biomed. Eng., 49 (10), 1181 –1186 (2002). IEBEAX 0018-9294 Google Scholar


A. Buttfield, P. W. Ferrez and J. R. Millan, “Towards a robust BCI: error potentials and online learning,” IEEE Trans. Neural Syst. Rehabil. Eng., 14 (2), 164 –168 (2006). Google Scholar


B. Blankertz et al., “The non-invasive Berlin brain–computer interface: fast acquisition of effective performance in untrained subjects,” NeuroImage, 37 (2), 539 –550 (2007). NEIMEF 1053-8119 Google Scholar


S. Fazli et al., “Enhanced performance by a hybrid NIRS–EEG brain–computer interface,” NeuroImage, 59 (1), 519 –529 (2012). NEIMEF 1053-8119 Google Scholar


J. Mellinger et al., “An MEG-based brain–computer interface (BCI),” NeuroImage, 36 (3), 581 –593 (2007). NEIMEF 1053-8119 Google Scholar


S. M. LaConte, “Decoding fMRI brain states in real-time,” NeuroImage, 56 (2), 440 –454 (2011). NEIMEF 1053-8119 Google Scholar


N. Weiskopf et al., “Principles of a brain–computer interface (BCI) based on real-time functional magnetic resonance imaging (fMRI),” IEEE Trans. Biomed. Eng., 51 (6), 966 –970 (2004). IEBEAX 0018-9294 Google Scholar


B. Sorger et al., “Another kind of BOLD response: answering multiple-choice questions via online decoded single-trial brain signals,” Prog. Brain Res., 177 275 –292 (2009). PBRRA4 0079-6123 Google Scholar


S. M. Coyle, T. E. Ward and C. M. Markham, “Brain–computer interface using a simplified functional near-infrared spectroscopy system,” J. Neural Eng., 4 (3), 219 –226 (2007). 1741-2560 Google Scholar


N. Naseer and K.-S. Hong, “Classification of functional near-infrared spectroscopy signals corresponding to the right-and left-wrist motor imagery for development of a brain–computer interface,” Neurosci. Lett., 553 84 –89 (2013). NELED5 0304-3940 Google Scholar


R. Sitaram et al., “Temporal classification of multichannel near-infrared spectroscopy signals of motor imagery for developing a brain–computer interface,” NeuroImage, 34 (4), 1416 –1427 (2007). NEIMEF 1053-8119 Google Scholar


K.-S. Hong, N. Naseer and Y.-H. Kim, “Classification of prefrontal and motor cortex signals for three-class fNIRS-BCI,” Neurosci. Lett., 587 87 –92 (2015). NELED5 0304-3940 Google Scholar


J. Shin and J. Jeong, “Multiclass classification of hemodynamic responses for performance improvement of functional near-infrared spectroscopy-based brain–computer interface,” J. Biomed. Opt., 19 (6), 067009 (2014). JBOPFO 1083-3668 Google Scholar


M. J. Khan, M. J. Hong and K.-S. Hong, “Decoding of four movement directions using hybrid NIRS-EEG brain–computer interface,” Front. Hum. Neurosci., 8 244 (2014). Google Scholar


F. Scholkmann et al., “A review on continuous wave functional near-infrared spectroscopy and imaging instrumentation and methodology,” NeuroImage, 85 6 –27 (2014). NEIMEF 1053-8119 Google Scholar


F. Matthews et al., “Hemodynamics for brain–computer interfaces,” IEEE Signal Process. Mag., 25 (1), 87 –94 (2008). ISPRE6 1053-5888 Google Scholar


H. Liang, J. D. Bronzino and D. R. Peterson, Biosignal Processing: Principles and Practices, CRC Press, Boca Raton, Florida (2012). Google Scholar


X. Cui, S. Bray and A. L. Reiss, “Functional near infrared spectroscopy (NIRS) signal improvement based on negative correlation between oxygenated and deoxygenated hemoglobin dynamics,” NeuroImage, 49 (4), 3039 –3046 (2010). NEIMEF 1053-8119 Google Scholar


S. Weyand et al., “Usability and performance-informed selection of personalized mental tasks for an online near-infrared spectroscopy brain–computer interface,” Neurophotonics, 2 (2), 025001 (2015). Google Scholar


D. P.-O. Bos, M. Poel and A. Nijholt, “A study in user-centered design and evaluation of mental tasks for BCI,” in Int. Conf. on Multimedia Modeling, 122 –134 (2011). Google Scholar


N. Naseer and K.-S. Hong, “fNIRS-based brain–computer interfaces: a review,” Front. Hum. Neurosci., 9 3 (2015). Google Scholar


B. Abibullaev and J. An, “Classification of frontal cortex haemodynamic responses during cognitive tasks using wavelet transforms and machine learning algorithms,” Med. Eng. Phys., 34 (10), 1394 –1410 (2012). MEPHEO 1350-4533 Google Scholar


T. Q. D. Khoa and M. Nakagawa, “Functional near infrared spectroscope for cognition brain tasks by wavelets analysis and neural networks,” Int. J. Biol. Med. Sci., 1 28 –33 (2008). Google Scholar


X. Yin et al., “Classification of hemodynamic responses associated with force and speed imagery for a brain–computer interface,” J. Med. Syst., 39 (5), 53 (2015). JMSYDA 0148-5598 Google Scholar


X. Cui, S. Bray and A. L. Reiss, “Speeded near infrared spectroscopy (NIRS) response detection,” PLoS One, 5 (11), e15474 (2010). POLNCL 1932-6203 Google Scholar


B. Abibullaev, J. An and J.-I. Moon, “Neural network classification of brain hemodynamic responses from four mental tasks,” Int. J. Optomechatronics, 5 (4), 340 –359 (2011). Google Scholar


N. Naseer et al., “Analysis of different classification techniques for two-class functional near-infrared spectroscopy-based brain–computer interface,” Comput. Intell. Neurosci., 2016 5480760 (2016). Google Scholar


Y. Bengio et al., “Scaling learning algorithms towards AI,” Large-Scale Kernel Mach., 34 (5), 1 –41 (2007). Google Scholar


P. Y. Simard et al., “Best practices for convolutional neural networks applied to visual document analysis,” in 7th Int. Conf. on Document Analysis and Recognition (ICDAR), 958 –962 (2003). Google Scholar


D. Silver et al., “Mastering the game of go with deep neural networks and tree search,” Nature, 529 (7587), 484 –489 (2016). Google Scholar


S. Sukittanon et al., “Convolutional networks for speech detection,” in Interspeech, (2004). Google Scholar


Y. Bengio et al., “Learning deep architectures for AI,” Found. Trends Mach. Learn., 2 (1), 1 –127 2009). Google Scholar


J. L. Semmlow and B. Griffel, Biosignal and Medical Image Processing, CRC Press, Boca Raton, Florida (2014). Google Scholar


C.-W. Hsu et al., “A practical guide to support vector classification,” 1 –16 Taipei (2003). Google Scholar


M. Anthony and P. L. Bartlett, Neural Network Learning: Theoretical Foundations, Cambridge University Press, Cambridge, Massachusetts (2009). Google Scholar


Y. A. LeCun et al., “Efficient backprop,” Neural Networks: Tricks of the Trade, 9 –48 Springer, Heidelberg (2012). Google Scholar


C. M. Bishop, Neural Networks for Pattern Recognition, Oxford University Press, Oxford, Mississippi (1995). Google Scholar


Y. Zhang and B. Wallace, “A sensitivity analysis of (and practitioners’ guide to) convolutional neural networks for sentence classification,” CoRR, (2015). Google Scholar


N. Srivastava et al., “Dropout: a simple way to prevent neural networks from overfitting,” J. Mach. Learn. Res., 15 (1), 1929 –1958 (2014). Google Scholar


S. Arlot et al., “A survey of cross-validation procedures for model selection,” Stat. Surv., 4 40 –79 (2010). Google Scholar


R. W. Homan, J. Herman and P. Purdy, “Cerebral location of international 10–20 system electrode placement,” Electroencephalogr. Clin. Neurophysiol., 66 (4), 376 –382 (1987). ECNEAZ 0013-4694 Google Scholar


J. C. Ye et al., “NIRS-SPM: statistical parametric mapping for near-infrared spectroscopy,” NeuroImage, 44 (2), 428 –447 (2009). NEIMEF 1053-8119 Google Scholar


H. Tsunashima, K. Yanagisawa, M. Iwadate, “Measurement of brain function using near-infrared spectroscopy (NIRS),” Neuroimageing-Methods, INTECH Open Access Publisher, Rijeka, Croatia (2012). Google Scholar


K. He et al., “Deep residual learning for image recognition,” in Proc. of the IEEE Conf. on Computer Vision and Pattern Recognition, 770 –778 (2016). Google Scholar


M. Griebel, “Sparse grids and related approximation schemes for higher dimensional problems,” in Proc. of the Conf. on Foundations of Computational Mathematics (FoCM 2005), 106 –161 (2005). Google Scholar


J. Bergstra and Y. Bengio, “Random search for hyper-parameter optimization,” J. Mach. Learn. Res., 13 281 –305 (2012). Google Scholar


V. Nair and G. E. Hinton, “Rectified linear units improve restricted boltzmann machines,” in Proc. of Int. Conf. on Machine Learning (ICML), 807 –814 (2010). Google Scholar


D. Kingma and J. Ba, “Adam: a method for stochastic optimization,” (2014). Google Scholar


Thanawin Trakoolwilaiwan received his BS degree in biomedical engineering from Mahidol University, Thailand, in 2015. He is a master’s student at Daegu Gyeongbuk Institute of Science and Technology, South Korea. His research interests include brain–computer interface and neural engineering.

Bahareh Behboodi received her BS degree in biomedical engineering from Amirkabir University of Technology, Iran, in 2013. She is a master’s student at Daegu Gyeongbuk Institute of Science and Technology, South Korea. Her research interests include functional near-infrared spectroscopy and functional magnetic resonance imaging.

Jaeseok Lee received his BS degree in radio communications and PhD in computer and radio communications from Korea University, South Korea, in 2008 and 2015, respectively. He is a postdoctoral researcher at Daegu Gyeongbuk Institute of Science and Technology, South Korea. His research interests include sparse signal reconstruction theory and cyber-physical system security.

Kyungsoo Kim received his BS degree in information and communication engineering from Soong-sil University, South Korea, in 2012. He is a PhD candidate at Daegu Gyeongbuk Institute of Science and Technology, South Korea. His research interests include brain–computer interface and brain plasticity and stroke rehabilitation.

Ji-Woong Choi received his BS, MS, and PhD degrees in electrical engineering from Seoul National University, South Korea, in 1998, 2000, and 2004, respectively. He is an associate professor at Daegu Gyeongbuk Institute of Science and Technology, South Korea. He is the author of more than 80 journal papers and patents. His current research interests include advanced communication systems, biomedical communication and signal processing, invasive, and noninvasive brain–computer interface, and magnetic communication and energy transfer systems.

© The Authors. Published by SPIE under a Creative Commons Attribution 3.0 Unported License. Distribution or reproduction of this work in whole or in part requires full attribution of the original publication, including its DOI.
Thanawin Trakoolwilaiwan, Bahareh Behboodi, Jaeseok Lee, Kyungsoo Kim, and Ji-Woong Choi "Convolutional neural network for high-accuracy functional near-infrared spectroscopy in a brain–computer interface: three-class classification of rest, right-, and left-hand motor execution," Neurophotonics 5(1), 011008 (14 September 2017).
Received: 6 April 2017; Accepted: 17 August 2017; Published: 14 September 2017

Cited by 63 scholarly publications.
Brain-machine interfaces

Feature extraction

Convolutional neural networks

Electronic filtering

Near infrared spectroscopy




Initial-dip-based classification for fNIRS-BCI
Proceedings of SPIE (March 01 2019)

Back to Top