Teknos

View Original

StrokeSave: Diagnosing Strokes With Deep Learning and Computer Vision

StrokeSave: A Novel, High-Performance Mobile Application for Stroke Diagnosis using Deep Learning and Computer Vision

Ankit Gupta and Chris Jose
Thomas Jefferson High School for Science and Technology

This paper was originally included in the 2019 print publication of the Teknos Science Journal.

Abstract

Epilepsy, a neurological disorder characterized by recurrent seizures, impacts the lives of 50 million people around the world. Current diagnostic protocol involves trained medical personnel meticulously analyzing electroencephalogram (EEG) data to identify epileptiform abnormalities symptomatic of seizures. This process not only requires trained clinical providers and their time, but is also subject to human error and can lead to the misdiagnosis of seizures. Prior research using machine learning has led to certain seizure prediction models based on EEG data. While these models can identify a seizure with some accuracy, they can not identify the type of seizure. Distinguishing between generalized seizures, which affect the entire brain, and focal seizures, which affect only a localized brain region, can be crucial for effective treatment. This study describes the development of SeizureSight, one of the first machine learning classification models to predict the type of seizure using only raw EEG data by performing a multitaper transformation and using a Convolutional Neural Network. SeizureSight provides a cost-effective model to detect various types of epileptic seizures. 

Background

Epilepsy is a chronic neurologic disease in which abnormal brain electrophysiology causes recurrent seizures. Seizures occur when the brain's normal electrical rhythms are disrupted by sudden and synchronized bursts of excessive electrical energy. An electroencephalograms (EEGs) is a noninvasive epilepsy diagnostic test, because it can detect these surges of electrical activity. It records electrical activity on the surface of the brain to identify the location of the abnormally firing neurons that cause seizures. Small electrodes are attached to various parts of the patient's scalp, and the EEG records the electrical power passing between two nodes, known as a channel. The result of this process is a record of numerous channels of electrical activity in different parts of the brain over time [4]. To detect seizures, trained medical professionals must meticulously read EEG data and find abnormalities consistent with seizures. However, this process of  seizure detection is time-consuming and also expends many human resources. Moreover, this process itself is subject to human error and can lead to misdiagnosis [6].

Thus, there is an acute need for a method to automate seizure detection. A rising trend in the medical field involves using machine learning to classify human data, by creating models that can find patterns in data and discriminate between classes beyond what a human eye might be able to see. One of the first successful automated classifications of seizures with EEG data was done in 2016 by Thodoroff, Pineau, and Lin. They created a Recurrent Convolutional Neural Network that converted 969 hours of signal data from 23 epileptic child patients into images. Their model segmented the signal based on time and passed this in as sequential data to predict the classes in future time steps. Other major advances in this field include models for neonatal or newborn EEG data [11], and an implantable microcontroller model that is practical enough to be used in a real commercial setting [8]. More recent research generated the largest known database of EEG seizure data, called the TUH EEG Seizure Corpus, and built a model to classify whether the data represented a seizure or not [7]. However, most prior work in this field has only utilized binary, rather than multi-label, classification of seizures. The aim of this project was to devise a more efficient method for analyzing EEG data, thus assisting with the overall diagnosis of a potential epileptic patient.

Methods

First, the EEG data was transformed into an image or visual representation for the model to process using the Fast-Fourier Transformation (FFT). This common decomposes a signal into its different frequencies and plots them onto the time-frequency domain by passing each time segment into a convolution. A potential problem may occur due to noise or artifacts in the EEG signal. These irregularities are due to non-seizure events such as blinking or chewing that disrupt the EEG signal and may confound the detection of seizures.. To combat this problem, this model uses a multitaper transformation. A multitaper transformation takes the convolution of the FFT and continuously moves it along the signal’s length to create a rolling average of the data, resulting in a smoother curve [13]. This multitaper transformation is then converted to a spectrogram, plotting the time, frequency, and the power of the EEG signals onto one image. 

The model applied a multitaper transformation onto ten second segments of EEG signals, generating 677 background, 218 complex partial seizure, 259 focalized onset seizure, and 110 generalized seizure images. The model trained on 80% of this data and tested its accuracy on the remaining 20% of the data, which is a common division for machine learning models. To ensure that the testing process was valid, the total data was randomly split up into two different groups for training and testing data. The model only trained on the training data and its accuracy was only evaluated on the testing data, which means it did not use any of the testing data for learning. This ensures that the model was actually creating correlations within the data and not simply memorizing the data. To classify these images, the model used a Convolutional Neural Network (CNN), a state of the art model used in image processing and signal processing. The method was revised after running the program by adding more layers and regularization techniques to the CNN to create a model that would be able to uncover deeper correlations embedded in the data.

Engineering Design

The model uses a Convolutional Neural Network trained on multitaper transformations of ten second intervals of EEG data, centered on the frequencies of 225 Hz to 275 Hz since the sampling frequency of the data was at 250 Hz. The model itself used five convolutional layers and then three flattened layers, with one additional layer at the end for the prediction of one of the four classes. The activation function for all the layers was the Rectified Linear Unit, which has been generally shown to be successful for updating weights and biases in a Convolutional Neural Network. The final layer uses an activation of Softmax, which is used for predicting one of the four labels. Each layer, other than the last two, has a Dropout of 0.2, which means that for every iteration forward, 20% of the nodes are “turned off.” This has the effect of creating a more robust model that allows each node to learn unique information. The images that would be passed into the model were rescaled by reducing each pixel value by a factor of 1/255, which made the model parameters easier to update. The images were also turned into gray-scale to provide for faster computation. The images were shifted by a factor of 0.2 on the x-axis randomly when training, which artificially created more samples to train on.

Results

The first model tested achieved an accuracy of 86.056% by the first epoch on the first run through. This model used an Adam Optimizer, Mean-Squared Error for the loss function, grayscale for the images, a rescaling factor of 1/255, and a Dropout value of 0.2 for the layers. The next model tested removed the Dropout altogether, and ran using the previous weights that were adjusted from the first model. This model also used Categorical Cross-Entropy, rather than Mean-Squared Error, as Categorical Cross-Entropy is better fitted for multi-label classification problems. The model accurately detected seizures 88.446% of the time by the 3rd epoch, 88.845% by the 7th epoch, and 89.243% by the 8th epoch. After implementing a 0.2 factor shift in the horizontal direction for the training images, a high of 91.235% accuracy was obtained.

Discussion and Conclusions

SeizureSight obtained an optimal accuracy of 91.235% for the classification of seizures from four different classes: three different types of seizures and one non-seizure class. The experiment demonstrates that it is possible to create a computer model that classifies seizures by creating correlations in data to perform multi-label classification on EEG signals. The high accuracy of the multitaper transformations of EEG signals is a promising breakthrough in the commercial setting. The confusion matrix indicates that the model is extremely successful in binary classification, achieving a 96.83% success rate. In addition, the model is 100% accurate when predicting a focalized onset seizure. However, the accuracy for the generalized onset seizures can be improved with further experimentation. 

Seizure detection is often limited by the amount of data available to the public. Even with the small sample size, this project indicates multi-label seizure detection is feasible despite this limitation. The results of this experiment pave the way for models detecting epileptic seizures by demonstrating the promising use of this model to predict the type and presence of a seizure. Hopefully, an improved model will provide medical aid to patients with epilepsy in the near future. 


References

[1] Gramfort, A., Luessi, M., Larson, E., Engemann, D., Strohmeier, D., Brodbeck, C., Parkkonen, L., Hämäläinen, M. (February 2014). MNE software for processing MEG and EEG data. NeuroImage, 86, 446-460. https://doi.org/10.1016/j.neuroimage.2013.10.027

[2] Gramfort, A., Luessi, M., Larson, E., Engemann, D., Strohmeier, D., Brodbeck, C., Goj R., Jas M., Brooks T., Parkkonen, L., Hämäläinen, M. (December 2013) MEG and EEG data analysis with MNE-Python. Frontiers in Neuroscience, 7, 267. https://doi.org/10.3389/fnins.2013.00267

[3] Ahmedt-Aristizabal, D., Fookes, C., Nguyen, K., Sridharan, S. (2018). Deep Classification of Epileptic Signals. 2018 40th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), 332-335.

[4] Electroencephalogram (EEG). (n.d.). Retrieved December 10, 2018, from https://www.hopkinsmedicine.org/healthlibrary/test_procedures/neurological/electroencephalogram_eeg_92,p07655

[5] Epilepsy. (2018, February 8). Retrieved December 10, 2018, from https://www.who.int/news-room/fact-sheets/detail/epilepsy

[6] Ghayab, H.R., Li, Y., Abdulla, S.A., Diykh, M., Wan, X. (2016). Classification of epileptic EEG signals based on simple random sampling and sequential feature selection. Brain Informatics. https://doi.org/10.1007/s40708-016-0039-1

[7] Golmohammadi, M., Ziyabari, S., Shah, V., Diego, S.L., Obeid, I., Picone, J. (2017). Deep Architectures for Automated Seizure Detection in Scalp EEGs. CoRR, abs/1712.09776.

[8] Hügle, M., Heller, S., Watter, M., Blum, M., Manzouri, F., Dümpelmann, M., Schulze-Bonhage, A., Woias, P., Boedecker, J. (2018). Early Seizure Detection with an Energy-Efficient Convolutional Neural Network on an Implantable Microcontroller. 2018 International Joint Conference on Neural Networks (IJCNN), 1-7.

[9] Hussein, R., Palangi, H., Ward, R.K., Wang, Z.J. (2018). Epileptic Seizure Detection: A Deep Learning Approach.

[10] Kiriakopoulos, E., Shafer, P. (2017, March 20). Types of Seizures (R. Fisher J. Sirven, Eds.). Retrieved December 12, 2018, from https://www.epilepsy.com/learn/types-seizures

[11] O’Shea, A., Lightbody, G., Boylan, G.B., Temko, A. (2017). Neonatal seizure detection using convolutional neural networks. 2017 IEEE 27th International Workshop on Machine Learning for Signal Processing (MLSP), 1-6. [12] Pierre, T., Pineau, J., Lim, A. (2016) Learning Robust Features using Deep Learning for Automatic Seizure Detection. Journal of Machine Learning Research, 56.

[13] van Drongelen, W. (2014) Multitaper Power Spectrum Estimation. University of Chicago Epilepsy Lab.