Approximately 50 million people worldwide have epilepsy, making it one of the most common neurological diseases globally. In one of our recent projects for the Ghent University Hospital, we had to tackle the problem of detecting epileptic seizures in EEG signal recordings of rats and mice. In this project, we go one step further than the other existing epilepsy detection projects; every sample of the EEG signal needs to be classified, resulting in the exact start and end times of seizures. These annotations provide valuable insights in the effectiveness of a medical treatment.
Our proposed solution was based on the Wavenet architecture, originally developed by Google DeepMind. By using these techniques, it is possible to learn based on a raw signal, instead of using engineered features. To achieve the exact detection of seizures, the input and output signal has the same length, this way we classify each time sample separately.
The output of the Wavenet model can be interpreted as the probability of “the animal having a seizure at time t”. Converting this output to actual seizure start and end times, can be done in numerous ways, e.g. by fixing a simple threshold. However, such a simple approach will generate lots of small false-positive peaks which generate incorrect seizure-timings.
Our proposed solution was further improved by using an adaptation of the Hidden Markov Model as a probabilistic post processing engine. The HMM model consists of only two states, namely the ictal and interictal phase (i.e. in-seizure and between-seizure). This second model will simulate the subject (rat or mouse) using estimated transition probabilities between the two states. Given the emission samples of an HMM model, it is possible to calculate the most probable state sequence using the Viterbi algorithm. After calculating all transition and emission probabilities on test data, this algorithm makes it possible to compute the start and end times of seizures given the output of the trained WaveNet.
Reviewing the output of the model, it became clear that defining what exactly defines an epileptic seizures needs to be standardized and agreed upon between the observers. This includes a definition of exact start and end times and minimum seizure length. By reducing this inter-observer variance, the model can learn from consistently annotated data. The use of the HMM as postprocessing step makes it possible to add extra parameters like minimum seizure length by conditioning the transition probabilities.
For a more in-depth explanation, take a look at our Medium blog.