Common Spatial Pattern for the Classification of Imagined Geometric
Objects
Fabio R. Llorella Costa
1
, Gustavo Patow
1
and Jos
´
e M. Azor
´
ın
2
1
VIRViG, Universitat de Girona, Girona, Spain
2
BMI-LAB, Universidad Miguel Hern
´
andez, Elche, Spain
Keywords:
Brain-Computer Interface, Common Spatial Pattern, Support Vector Machine, Visual Imagery.
Abstract:
Electroencephalographic (EEG) signals contain cognitive information, which can be used by Brain-Computer
Interface (BCI) systems to control devices through thought. In this work we study the possibility of detecting
the visual imagination of seven different geometric objects (triangle, circle, square, pentagon, line, hexagon
and parallelogram). The power spectral density in the α band were compared offline with using common
spatial pattern (CSP) and the variance of each channel, obtaining as a best result the calculation of the CSP plus
variance in the α band and classifying the vector of features with a support vector machine (SVM), obtaining
an average result of 52% accuracy and a kappa value of 0.43 in the classification of the seven geometrical
shapes, reaching up to 83% and a kappa value of 0.78 for a single user.
1 INTRODUCTION
Classification of electroencephalographic (EEG) sig-
nals is not a simple task as they show a great variabil-
ity in time, that is, they are non-stationary signals (Lo
et al., 2009). BCI are non-invasive systems that are
ultimately based on the classification of EEG signals.
There exist BCI devices that can properly classify
EEG signals for the control of different devices (Chen
et al., 2015; Abiyev et al., 2016; Edlinger et al., 2011),
but the vast majority of works that can be found in the
literature use motor imagery or related signals, as the
slow cortical potentials (SCP) (Mensh et al., 2004).
This limits applications of BCI systems to applica-
tions of motor nature, i.e., where motor imagination
can play an important role, as could be the movement
of a wheelchair or a prosthesis (Ferreira et al., 2010;
Gal
´
an et al., 2008; Guger et al., 2002). However, there
are applications that are difficult to implement and ul-
timately are unnatural at the time of use.
Another problem encountered by non-invasive
BCI systems is that, as EEG signals are difficult
to classify, these systems can only discriminate few
classes, usually between two and four classes, al-
though it is true that There are studies where this
number of classes is overcome using visual evoked
potentials (SSVEP) (Song et al., 2017). However,
for imagined signals, the four-class limit cannot usu-
ally be overcome. In this paper we have chosen to
use techniques widely used in motor imagery classi-
fication, such as the common spatial pattern, which
has offered good results (Wang et al., 2005; DaSalla
et al., 2009) and has been used to classify support vec-
tor machines, also widely used in the classification of
EEG signals (Singla and Haseena, 2013; Mariko and
Junichi, 2014; Lotte et al., 2018). To extract the char-
acteristics of the signals, we chose to use the vari-
ance of each channel, as it is a fast statistical tech-
nique. Currently, there are few works that offer light
on how to build a BCI system that takes advantage of
the opportunities that visual imagination can offer in
the construction of BCI systems for people who have
artistic interests or who want to use BCI systems to
carry out design or drawing applications. Here we
demonstrate the possibility of classifying seven imag-
ined geometric objects with a high degree of accuracy.
Being simple geometric objects, these can be used for
the creation of a BCI system such as computer-aided
design.
2 METHODS
2.1 Subjects
Three subjects (two female and one male) between 24
and 40 years of age, participated in this study. All sub-
152
Costa, F., Patow, G. and Azorín, J.
Common Spatial Pattern for the Classification of Imagined Geometric Objects.
DOI: 10.5220/0007934601520155
In Proceedings of the 3rd International Conference on Computer-Human Interaction Research and Applications (CHIRA 2019), pages 152-155
ISBN: 978-989-758-376-6
Copyright
c
2019 by SCITEPRESS – Science and Technology Publications, Lda. All rights reserved
jects were right-handed and and they have not vision
problems or neurological disorders. The experiment
had the informed consent of the people.
2.2 Material
In this study, the g.Nautilus device of g.tec was used.
The device consists of eight wet electrodes at a sam-
pling rate of 250 Hz. We used the international 10-10
system to place the electrodes on the scalp. The elec-
trodes used were: Oz, P3, POz, P4, PO7, PO4, PO3
and PO8, with AFz used as reference. We have used
these electrodes because they are located in the occip-
ital area, an area linked to vision and because other
studies identified electrodes P4, PO4, PO3 and PO7
as good to classify signals coming from visual imagi-
nation (Bobrov et al., 2011). At the time of registering
the impedance of the electrodes was below 10k.
2.3 Experimental Paradigm
The paradigm used lasts a total of eight seconds. Dur-
ing the first second, a white cross is shown on a black
background, indicating the start of the trial. The next
two seconds show the geometric figure that the person
must imagine, and in the last five the black screen ap-
pears and is left. This is when the person must imag-
ine the figure that has been previously shown. The or-
der the figures appear on the screen is random, so the
user does not know what figure will appear and thus
cannot anticipate it. This procedure is performed 20
times (14 trials each). Once the trials have been regis-
tered, the person makes a short break and re-registers
other 14 trials, making a total of 280 trials (40 trials
per geometric figure). The OpenVibe software was
used to program of the paradigm, because it offers a
simple and quick way to create these paradigms.
3 PROCESSING PIPELINE
In all BCI systems, there are differentiated phases,
the first phase always being the pre-processing of the
EEG signals, where the EEG signals are conditioned
for the following phases. In this pre-processing, EEG
signals are usually partitioned into pieces to be fil-
tered in the frequency range and spatial filters are ap-
plied to eliminate the artifacts that they may contain.
The next phase is feature extraction. Features
must contain the necessary information to be able
to differentiate between the different classes that we
want to classify.
The last phase is the classification, which will be
responsible for associating the different feature vec-
tors with the corresponding cognitive activity. In
this work, we have used common spatial pattern,
together with the variance of each component of
the common spatial pattern in the feature extraction
phase (Ramoser et al., 2000).
3.1 Data Processing
While the signals were being recorded, they were fil-
tered by the hardware of the g.Nautilus device be-
tween 0.01 and 60 Hz with a pass banda filter, the
order of the filter was six, and then a Notch filter
between 48 and 52 Hz was also applied. Once the
EEG signals were registered, they were partitioned
into fragments of a second without overlapping, omit-
ting the first second of the imagination task. Once
the trials were partitioned, they were filtered in the α
band, between 8 and 12 Hz (this band is important in
visual imagery (Bobrov et al., 2011)) using a butter-
worth band pass filter of order six. All the processing
of the EEG signals was done offline using MATLAB
R2016a (Matlab, 2016).
3.2 Common Spatial Pattern
The CSP is a special filter that aims to maximize the
variance between two different classes. Although this
algorithm is usually applied between two classes, it
can be extended to an arbitrary number N of classes.
The objective of the CSP filter is to return a transfor-
mation matrix W with respect to a group of EEG data
matrices X
i
. The first step is to calculate the normal-
ized spatial covariance matrices of X
i
where i is the
type of class being analyzed.
R
i
=
X
i
X
T
i
trace(X
i
X
T
i
)
(1)
where T is the transpose operator and trace is the sum
of the diagonal elements.
Next, it is necessary create the covariance matrix.
R
c
=
N
i=1
R
i
(2)
where N is the number of classes. Here, we used N =
7. The corresponding matrices of eigenvectors are:
R
i
= V λV
T
(3)
where V is the diagonal matrix of eigenvalues. Fi-
nally, W is constructed as:
Q = V
λ
1
(4)
W = (V
T
Q)
T
(5)
Common Spatial Pattern for the Classification of Imagined Geometric Objects
153
To create the feature vector, we must transform the
signals in the following way:
Z
i
= W X
i
(6)
where x
i
is the set that contains the signals EEG that
belong to class i. Finally is necessary calculate the
variance for each component of Z
i
:
f
i
= log(var(Z
i
( j)) (7)
where j is the number of channels.
With this method we build feature vectors of di-
mension equal to the number of channels of the EEG
signals. The advantage that this procedure has is that
it creates small vectors and therefore does not need
many trials to train the classifier, because if the size
of feature vectors is very large, more trials will be
needed (Trunk, 1979).
3.3 Classification
The last stage of the BCI systems is usually the clas-
sification of the vector of features that we have gener-
ated. Nowadays there are several types of classifiers
that have been proven to be useful when classifying
EEG signals, but one of the most used are the support
vector machines (SVM). This type of classifier tries
to identify the optimal hyperplane to separate the dif-
ferent classes, although currently we can find linear
or non-linear SVMs: the difference lies in that, in the
non-linear SVMs case, the data is mapped into higher
dimensionality using a kernel function. This process
is known as ”implicit mapping” (DaSalla et al., 2007).
In this work, we had used a Radial Basis Functions
(RBF) (Teukolsky and Vetterling, 2007), the form of
this kernel is show below:
K(x, x
0
) = e
γ||xx
0
||
2
(8)
γ =
1
2σ
2
(9)
where K is a kernel function of support vectors x and
σ is a free parameter.
The classification has been done offline, using the
k-fold cross validation algorithm. Data is partitioned
into k groups, where k 1 groups are used to create
the model (called train) and one group to test it (called
test). Finally, all the results are averaged and the fi-
nal accuracy is calculated. This process is intended to
eliminate overfitting when training the classifier. In
this work we used k = 5.
4 RESULTS
The results in Figure 1 were obtained by applying and
without applying the CSP algorithm before calculat-
ing the variance of the channels. When the CSP was
not applied, we calculated only the time variance of
the EEG signal channels.
Figure 1: Result of applying CSP (orange) and without ap-
plying CSP (blue), the dotted line indicates value for a ran-
dom selection.
It can be seen that applying the CSP algorithm re-
sults in more significant results than without applying
it, obtaining a mean accuracy of 52% with CSP and
18% without applying CSP. The subject S3 is the best
one, with an 83% of accuracy and a 0.78 kappa value.
The accuracy of the subject S2 is the 30% and 0.20
kappa value, which is the lowest accuracy. It should
be noted that in all three users the results are higher
than we would expect if selections were random.
Figure 2: Distribution of the features depending on the geo-
metric object. Dark blue: Triangle, Orange: Circle, Yellow:
Square, Lilac: Trapeze, Green: Line, Light blue: Hexagon,
Red: Parallelogram.
In Figure 2 we can see the distribution of the fea-
tures according to each user, where the y axis is the
P3 channel and the x axis is the PO4. These two
channels seem to be the most appropriate to differen-
tiate the geometric objects imagined. Subject 3 (S3) is
where the accuracy of the classification is greater: in
this subject it can be observed that the Pentagon, line,
hexagon and parallelogram objects have a high sepa-
rability rate, hence the accuracy is much higher than
that of the rest of users. This can be attributed to the
CHIRA 2019 - 3rd International Conference on Computer-Human Interaction Research and Applications
154
level of concentration of the user at the time of doing
the test, or that the user has more facility to visualize
imagined objects.
5 CONCLUSIONS
In this work we have demonstrated the possibility of
using visual imagination for the construction of BCI
systems, specifically using the imagination of simple
geometrical figures. A methodology for this task has
also been presented using the CSP filter together with
the calculation of the variance of the transformations
made with the CSP filter.
As future work it would be interesting to register
more people, study what frequency range and which
electrodes are better to perform the classification of
the geometrical figures, and study the impact of the
different geometrical shapes in the classification.
ACKNOWLEDGMENTS
The authors would like to thank the people who have
volunteered to make the EEG records, without them this
study would not have been possible. This work was par-
tially funded by the project TIN2017-88515-C2-2-R from
Ministerio de Ciencia, Inovaci
´
on y Universidades, Spain.
REFERENCES
Abiyev, R., Akkaya, N., Aytac, E., Gunsel, I., and C¸ agman,
A. (2016). Brain-computer interface for control of
wheelchair using fuzzy neural networks. BioMed Re-
search International, 2016, 1–9.
Bobrov, P., Frolov, A., Cantor, C., Fedulova, I., Bakhnyan,
M., and Zhavoronkov, A. (2011). Brain-computer in-
terface based on generation of visual images. PLoS
ONE, 6(6).
Chen, X., Wang, Y., Nakanishi, M., Gao, X., Jung, and
(2015), S. G. (2015). High-speed spelling with
a noninvasive brain–computer interface. Proceed-
ings of the National Academy of Sciences, 112(44),
E6058–E6067.
DaSalla, C., Kambara, H., Sato, M., and Koike, Y. (2009).
Single-trial classification of vowel speech imagery us-
ing common spatial patterns. Neural Networks 22
(2009) 1334–1339.
DaSalla, C., Sato, M., and Koike, Y. (2007). Emg vowel
recognition using a support vector machine. Interna-
tional symposium on measurement, analysis and mod-
eling of human functions (pp. 227–232).
Edlinger, G., Holzner, C., and (2011), C. G. (2011). A
hybrid brain-computer interface for smart home con-
trol. Lecture Notes in Computer Science, vol 6762.
Springer, Berlin, Heidelberg.
Ferreira, A., Bastos-Filho, T., Sarcinelli-Filho, M., Mart
´
ın-
S
´
anchez, J., Garc
´
ıa-Garc
´
ıa, J., and (2010), M. M.-Q.
(2010). Improvements of a brain–computer interface
applied to a robotic wheelchair. Communications in
Computer and Information Science 52 (2010) 64–73.
Gal
´
an, F., Nuttin, M., Lew, E., P.W. Ferrez, G. V.,
Philips, J., and (2008), J. M. (2008). A brain-
actuated wheelchair: asynchronous and non-invasive
brain–computer interfaces for continuous control
of robots. Clinical Neurophysiology 119 (2008)
2159–2169.
Guger, C., Harkam, W., Hertnaes, C., and Pfurtscheller, G.
(2002). Prosthetic control by an eeg-based brain- com-
puter interface (bci). AAATE 5th European Confer-
ence for the Advancement of Assistive Technology.
Lo, M., P.Huang, Tsai, Tsai, P. H., Lin, P., and Yue-Loong,
H. (2009). The nonlinear and nonstationary properties
in eeg signals: Probing the complex fluctuations by
hilbert-huang transform. Advances in Adaptive Data
Analysis 1(03):461-482.
Lotte, F., Bougrain, L., Cichocki, A., Clerc, M., Congedo,
M., Rakotomamonjy, A., and (2018), F. Y. (2018).
A review of classification algorithms for EEG-based
brain–computer interfaces: a 10 year update. Jour-
nal of Neural Engineering, 15(3), 031005, (November
2012).
Mariko, M. and Junichi, H. (2014). Classification of silent
speech using support vector machine and relevance
vector machine. Applied Soft Computing Volume 20,
pp 95-102.
Matlab (2016). version 9.0.0 (R2016a). The MathWorks
Inc., Natick, Massachusetts.
Mensh, B., Werfel, J., and Seung, H. (2004). Bci com-
petition 2003-data set ia: Combining gamma-band
power with slow cortical potentials to improve single-
trial classification of electroencephalographic signals.
IEEE Trans. Biomed. Eng., vol. 51, no. 6, pp. 1052–
1056.
Ramoser, H., M
¨
uller-Gerking, J., and Pfurtscheller, G.
(2000). Optimal spatial filtering of single trial eeg dur-
ing imagined hand movement. EEE Transactions on
Rehabilitation Engineering.
Singla, R. and Haseena, B. (2013). Bci based wheelchair
control using steady state visual evoked potentials and
support vector machines. International Journal of Soft
Computing and Engineering (IJSCE).
Song, X., Xie, S., and Meng, W. (2017). Signal process-
ing methods for ssvep-based bcis. Biomechatronics in
Medical Rehabilitation pp 53-70.
Teukolsky, S. and Vetterling, W. (2007). Radial Basis Func-
tion Interpolation.
Trunk (1979). A problem of dimensionality: A simple ex-
ample. IEEE Transactions on Pattern Analysis and
Machine Intelligence.
Wang, Y., Gao, S., and Gao, X. (2005). Common spatial
pattern method for channel selelction in motor im-
agery based brain-computer interface. IEEE Engi-
neering in Medicine and Biology 27th Annual Con-
ference.
Common Spatial Pattern for the Classification of Imagined Geometric Objects
155