Recognition of Epileptic Seizures in EEG Records: A Transfer Learning Approachand
Seizure is a transient phenomenon with genesis in excessive abnormal or synchronous neuronal electrical activity in the brain, while epilepsy is defined as a brain dysfunction characterized by persistent predisposition to generate seizures. The identification of epileptogenic electroencephalographic patterns can be performed using machine learning. The present study aimed to develop a transfer learning based classifier able to detect epileptic seizures in images generated from electroencephalographic data graphic representation.
Material and Methods:
We used the Epileptic Seizure Recognition Data Set, which consists of 500 brain activity records for 23.6 seconds comprising 23 chunks of 178 data points, and transformed the resulting 11500 instances into images by graphically plotting its data points. Those images were then splitted in training and test set and used to build and assess, respectively, a transfer learning-based deep neural network, which classified the images according the presence or absence of epileptic seizures.
The model achieved 100% accuracy, sensitivity and specificity, with AUC-score of 1.0, demonstrating the great potential of transfer learning for the analysis of graphically represented electroencephalographic data.
Seizure is an abnormal neuronal event that will be experienced by 5-10% of the world population at least once in the course of life. Seizure is a transient phenomenon with genesis in excessive abnormal or synchronous neuronal electrical activity in the brain, which will originate signs and symptoms . Epilepsy was defined by Fisher et al.  as a brain dysfunction characterized by persistent predisposition to generate seizures and by the neurological, cognitive and social consequences of this condition. Based on this concept, epilepsy is clinically defined as the occurrence of two unprovoked convulsive events that are temporally separated by at least 24 hours . The incidence of epilepsy in different populations around the world ranges from 0.3-0.5 with an estimated prevalence of 5-30 individuals per 1000 .
The electroencephalogram (EEG) is a propaedeutic element of fundamental importance in the diagnosis of epilepsy, given that it offers signs of epileptiform activity caused by neuronal dysfunction both in asymptomatic patients and in the period between or after crises . The recording of epileptiform electrical activity performed by the EEG is the result of the sum of post-synaptic, inhibitory and excitatory neuronal potentials. The cellular influx of Na +, called depolarization, leads to a reduction in cellular negativity. During the epileptiform event, there is a relatively prolonged depolarization followed by an action potential induced by this slowness. This moment is recorded in the EEG as a spike activity. This event is followed by hyperpolarization that could be observed on the EEG as a slow wave .
The identification of epileptogenic electroencephalographic patterns can be performed using machine learning. The interest in using machine learning in the health field has been gaining attention, especially after the development and validation of a deep learning algorithm for detecting diabetic retinopathy by Gushal et al. [5, 6] Deep learning represents the state of the art with regard to technologies based on artificial intelligence, allowing the cognitive processing capacity of the human mind to be mimicked by increasingly sophisticated and independent machines .
Traditionally, machine learning is characterized by the existence of two different databases, one for training the machine and another for the tests themselves, which share the same data entry and distribution space. After completing the training stage, weights are obtained for analysis of test data. However, in certain situations, obtaining data that share the same data entry and distribution space can be extremely arduous and expensive .
Considering this circumstance, it is possible to choose the transfer learning technique, which is based on the use of data obtained in similar, but distinct, domains to perform machine training . Based on this principle, it is possible to use a pre-trained weight scale in models for the analysis of medical images . However, the use of a scale of pre-trained weights in the model does not exempt the realization of a new training, especially aiming at the improvement of the deep layers, with the data of the new training coming from the same database of the data to be tested .
Given the above, the present study aimed to develop a transfer learning based model able to classify images generated from electroencephalographic data graphic representation according the absence or presence of epileptic seizures.
MATERIAL AND METHODS
We used the Epileptic Seizure Recognition Data Set [10, 11], collected in the UCI Machine Learning Repository , which consists of 500 brain activity records for 23.6 seconds comprising 23 chunks of 178 data points (500 time series, each lasting approximately 23 seconds, and each second being represented by 178 data points). Thus, the dataset is composed of 11500 instances, each of which consists of 178 features and one label representing the class of the record (0 for the absence of epileptic seizure in the record and 1 for the presence of epileptic seizure in the record).
For this study, we have chosen to transform the collected numerical data into images by graphically plotting the 178 data points of each instance, without any previous regularization or manipulation of the numeric values. Among the 11500 images, 2300 were labeled as 1 and 9200 were labeled as 0. Fig 1 shows examples of generated images representing records with absence and of records with presence of epileptic seizures.
The images were converted to arrays of dimension 299x299x3 (with the units being rescaled through division by 255), so they would be suitable to the image classification approach intended, and used as input for the transfer learning-based deep neural network summarized in Table 1. This neural network consists in a binary classifier, which predicts if the input shows presence or absence of epileptic seizure.
Synthesis of the deep neural network used to classify images generated from EEG data according the presence or absence of epileptic seizures.
The functional layer “Xception” instantiates the Xception architecture with weights pre-trained on the ImageNet data set. This architecture consists of a convolutional neural network (CNN) composed of 126 layers (of which 36 are convolutional) based entirely on depth wise separable convolution layers . Since this architecture was originally designed to classify between 1000 different classes using the softmax classification activator, the last network layer (top layer) was excluded.
The data were divided in proportion of 75%/25% in training (N=8625) and test set (N=2875) respectively, being the accuracy, sensitivity, specificity and AUC-score of the model (that is, of the prediction regarding the absence or presence of epileptic seizure) evaluated in the test data.
The final model consisted of the conjunction of: (1) the Xception architecture with pre-trained weights in the ImageNet dataset, composed of 126 layers, the first 26 of which had no weights trained in the training set, while the others had; (2) a dropout layer with a rate of 0.2; (3) a dense final layer consisting of one unit using the sigmoid activation function, responsible for the classification in absence or presence of epileptic seizure for each instance.
The optimizer algorithm used in the Adam model, with a learning rate of 0.0001, and the loss function adopted was binary cross entropy. In order to address the imbalance between classes, class weights (inversely proportional to the frequencies) were assigned.
In the test set, the model achieved 100% accuracy, sensitivity and specificity, with AUC-score of 1.0. The result achieved by the model in the test set is represented in a confusion matrix showed in Table 2.
In this work, we built a model based on transfer learning capable of detecting epileptic seizures with 100% accuracy in images generated from the graphic representation of electroencephalographic records. The data set used in this study has also been used in the construction of other diverse binary predictive models (presence vs. absence of epileptic seizure) reported in the literature, using different approaches and reaching different accuracy values.
For instance, Kumar & Kolekar  and Wang et al.  used discrete wavelet transform followed support vector machine (SVM) classification, obtaining accuracy values of 98% and 99.25%, respectively. Subasi et al.  also used hybrid SVM models, obtaining a maximum accuracy of 99.38% with the model that incorporated particle swarm optimization algorithm. Yuan et al.  have developed a multi-feature fusion framework combining features from global handcrafted engineering, deep learning and embedding models together into a fixed-length feature vector, which has achieved a 100% accuracy. Hussein et al.  were also able to achieve a 100% accuracy value, using a Long Short-Term Memory model. Bizopoulos et al.  used, like us, the conversion to the image followed by classification (through deep convolutional architectures) approach; however, they converted the signals to image using learnable parameters (applying one and two layer CNN modules) instead of a static procedure. Their best accuracy, 85.3%, was achieved using the one layer CNN signal to image module combined to the DenseNet121 architecture.
Thus, the model developed by us reached maximum accuracy from a simple and straightforward approach to pre-processing and data transformation, which is a positive point regarding the potential of applicability in different scenarios. However, given the restricted dimension of the dataset, in contrast with the depth of the neural network and the large volume of data in which its parameters were pre-trained, it is necessary to put the methodology to the test in other related sets, especially considering the concern with the possibility of overfitting.
The use of deep learning, especially the transfer learning technique, has great potential in the medical field for the analysis of data and clinical images. This paper used this technique to recognize epileptogenic electroencephalographic patterns in images obtained from the conversion of electrical signals for their graphic representation.
The algorithm used in this paper achieved a remarkable result of 100% in accuracy, sensitivity and specificity in the test set. The potential of machine learning and, specifically, transfer learning for the analysis of graphically represented electroencephalographic data becomes evident. In view of this, it is opportune to raise new studies involving transfer learning for the analysis of related data (signal data), with the aim of improving, disseminating and validating its use for daily clinical practice.
The authors agree on this final form of the manuscript, and attested that all authors contributed in the final draft of the manuscript.
CONFLICTS OF INTEREST
The authors declare no conflicts of interest regarding the publication of this study.
No financial interests related to the material of this manuscript have been declared.