This article presents the intermediate results of the work of a group of authors, which includes doctors, mathematicians and programmers, on the implementation of a tool for automatic detection of absence epilepsy episodes and assessment of the level of consciousness of the subject at the time of the ictal event into a computer program for recording and analyzing EEG. The algorithm operates on the basis of a trained neural network in real time during EEG video monitoring.
The results of this work are published in the first issue of the journal "Epilepsy and Paroxysmal States" for 2024.
MODERN NEURAL NETWORK ALGORITHMS
An artificial neural network (ANN) is a mathematical model and its software implementation, built on the principle of organization and functioning of biological neural networks, i.e. networks of nerve cells of a living organism.
The concept of ANN was introduced back in 1943, and in the 90s of the last century, neural network algorithms began to develop especially actively.
However, ANNs have reached the peak of their development and mass implementation only in recent years thanks to the creation of new neural network models, the emergence of large computing capacities and the accumulation of training data, which together have significantly accelerated the performance and accuracy of neural network algorithms.
Essentially, a neural network is a set of nodes and connections between them. Each connection is a coefficient by which the input must be multiplied to obtain the output. The simplest neural network must contain at least two layers: input and output, but as a rule, real networks contain a number of intermediate layers. The capacity of the neural network depends on the number of layers and nodes in each of them.
Let's look at a simple example: we need to create a neural network that can calculate the sum of two terms. In this case, this network will contain two input nodes and one output node, as well as several intermediate layers. To train such a network, you will need a training sample of expressions with known answers. During the training process, the neural network selects the coefficients between the elements in such a way that the answers of the known expressions coincide as accurately as possible with the data in the training sample. As a result of training, the neural network will be able to add not only those terms that were included in the training sample, but also any others. The more intermediate layers the network contains, the more expressions it can remember and the wider range it can work in. The larger the training sample, the more accurately all the coefficients will be selected during the training process..
The main problems in training a neural network:
- Insufficient training sample - occurs when there is not enough training data to qualitatively select all network coefficients. The accuracy of such a network will be low.
- Network overtraining - occurs when the number of intermediate layers or nodes in them is not enough to store the entire diversity of the training sample. In this case, each new element of the training sample begins to affect the previously formed set of coefficients and reduce the accuracy of the resulting network. In this case, you need to increase the number of intermediate layers or nodes in them. However, it is worth remembering that the more layers the network contains, the more coefficients it contains and the slower it will work.
NOTE: Training a serious neural network on a large training sample is a complex optimization task that requires a lot of computing power. For example, in this work, one training stage took several days of high-performance computer operation. More than a hundred such trainings were performed.
FEATURES OF APPLICATION OF NEURAL NETWORK ALGORITHMS
- Neural network algorithms are usually used to solve non-deterministic problems, the solution of which cannot be programmed using logic.
- To apply a neural network model, it must first be trained on a prepared set of training data.
- After training, the neural network is able to independently solve problems that were not in the training sample.
Advantages of neural network algorithms:
- Solving non-deterministic problems.
- No need to program complex behavior logic.
Disadvantages of neural network algorithms:
- It is difficult to predict or explain the solution found.
- To correct the algorithm, it is necessary to retrain the neural network.
- If the neural network configuration is incorrectly selected or the input data is insufficient, the neural network training process may not yield the expected result.
NOTE: Currently, the listed shortcomings are being eliminated using various mathematical approaches.
APPLICATION OF ARTIFICIAL INTELLIGENCE IN MEDICINE
Areas of application of AI in medicine today:
- Automatic analysis of medical images.
- Computer vision.
- Recognition of X-rays, MRI images.
- Assistance in making medical decisions.
- Automated analysis of genetic information.
- Automatic search for episodes (e.g. epileptiform activity).
NOTE: The scope of application of artificial intelligence in medicine is constantly expanding.
AUTOMATIC SEARCH FOR EPISODES OF PAROXYSMAL ACTIVITY ON EEG
Automatic algorithms for searching for epileptiform activity on EEG appeared in almost the first computer systems for recording electroencephalography. These algorithms are constantly being improved, but nevertheless, in practice such algorithms are not often used yet, since they have several significant shortcomings:
- Accuracy of response (many false episodes).
- Time of analysis of long-term examinations.
The use of neural network algorithms for searching and identifying epileptiform activity on EEG has every chance of eliminating these shortcomings.
FEATURES OF REGISTRATION OF ABSENCE SEIZURES
Typical absences (TA) are short generalized epileptic seizures characterized by a sudden change in the level of consciousness, freezing.
According to the definition, absences consist of two main components: a disturbance of consciousness, which is synchronously accompanied by electroencephalographic changes in the form of generalized discharges of acute-slow wave complexes with a frequency of 3 Hz or more.
Typical absences are characterized by a sudden onset and an equally sudden end. The patient instantly freezes, his gaze is directed to one point. There is an interruption of the initiated activity. The duration of such episodes can range from two to several tens of seconds (rarely more than 15 seconds).
The EEG pattern of typical absences has an extremely similar morphological structure on the electroencephalogram, namely the appearance of rhythmic regular high-amplitude generalized bilaterally synchronous discharges of acute-slow wave complexes on the EEG.
For the diagnosis of typical absences, it is fundamentally important to identify the fact of a change in the level of consciousness at the time of the attack.
EEG VIDEO MONITORING - THE GOLD STANDARD IN EPILEPSY DIAGNOSTICS
EEG video monitoring is the "gold standard" in epilepsy diagnostics.
This method allows:
- To confirm or refute the diagnosis of epilepsy.
- To assess the frequency of epileptiform activity.
- To assess the lateralization and localization of epileptiform activity.
- To classify epilepsy.
NOTE: compared to routine EEG recording, continuous EEG video monitoring allows for the detection of epilepsy with higher reliability. The 2018 IFCN clinical guidelines also suggest video monitoring during short EEG examinations.
To assess the patient's level of consciousness during an ictal event in a video-EEG laboratory, the technician conducting the examination usually tests the patient by asking him questions and/or giving simple commands. The work of technicians in assessing the level of consciousness is complicated by the fact that the duration of absences is fleeting, and clinical manifestations are sometimes insignificant.
Therefore, in a video-EEG monitoring laboratory, errors in testing by EEG technicians are possible in diagnosing absences.
The most common errors include:
- testing the patient after the ictal event;
- complete lack of testing;
- unclearly proposed tasks.
OVERVIEW OF THE PROPOSED SOLUTION
Given the difficulties in identifying absences and assessing the level of consciousness in patients with epilepsy, it is extremely important to develop digital programs for the automatic registration and testing of this type of epileptic seizures and their EEG patterns, including those based on artificial intelligence.
The following algorithm was proposed:
REQUIREMENTS TO THE ABSENCE SEIZURE DETECTION ALGORITHM:
- High sensitivity – should ensure reliable triggering of the detector when an absence seizure occurs.
- High specificity – minimum number of false alarms.
- Response speed – the detector should detect the onset of an absence seizure in the first one or two seconds of its occurrence in order to promptly issue a voice command to the patient (many detection algorithms do not meet this requirement).
WHAT WAS DONE
- EEG recordings of patients with a confirmed diagnosis of absence epilepsy were selected (15 patients, 58 hours of recording, 313 episodes of absence seizures, labeled by two experts).
- A data set was formed for training the neural network (As a result of synthesizing episodes, 500,000 elements of the training set were formed).
- The architecture of the neural network was selected experimentally (using convolutional and fully connected layers).
- The neural network was trained (The model was trained 100 times with different initial approximations. Of the trained models, the best model with the smallest error on the validation set was selected).
- The neural network algorithm was tested on data that was not included in the training set (The trained model had a classification accuracy of 99.15% on the training set and 98.05% on the test set).
ETHICAL ASPECTS: Since this work used EEG examinations of patients with a confirmed diagnosis of epilepsy, all examination data were anonymized at the selection stage before inclusion in the processing. During the work, only EEG signals were used without linking them to personal data. Also, publicly available databases of EEG examinations of healthy individuals and patients with a confirmed diagnosis of epilepsy were used to test the accuracy of the neural network algorithm. It should be noted that there are currently active discussions about the legality of using patients' medical data without their consent, but a consensus on this issue has not yet been reached. Nevertheless, the collection and structuring of large arrays of anonymized medical data opens up new opportunities in the creation of advanced diagnostic and treatment methods.
COMPARATIVE EVALUATION OF THE RESULTS OBTAINED
The accuracy of the obtained algorithm was compared with similar publications:
* Petersen, E. B., Duun-Henriksen, J., Mazzaretto, A., Kjær, T. W., Thomsen, C. E., & Sørensen, H. B. D. (2011). Generic Single-Channel Detection of Absence Seizures. In Proceedings of the 33rd Annual International Conference of the IEEE EMBS (pp. 4820-4823). IEEE. https://doi.org/10.1109/IEMBS.2011.6091194
** K. Giannakaki, G. Giannakakis, P. Vorgia, M. Klados and M. Zervakis, "Automatic Absence Seizure Detection Evaluating Matching Pursuit Features of EEG Signals," 2019 IEEE 19th International Conference on Bioinformatics and Bioengineering (BIBE), Athens, Greece, 2019, pp. 886-889, doi: 10.1109/BIBE.2019.00165
*** Glaba P, Latka M, Krause MJ, Kroczka S, Kuryło M, Kaczorowska-Frontczak M, Walas W, Jernajczyk W, Sebzda T and West BJ (2021) Absence Seizure Detection Algorithm for Portable EEG Devices. Front. Neurol. 12:685814. doi: 10.3389/fneur.2021.685814
**** Li, L., Zhang, H., Liu, X. et al. Detection method of absence seizures based on Resnet and bidirectional GRU. Acta Epileptologica 5, 7 (2023). https://doi.org/10.1186/s42494-022-00117-w
The comparison results confirm that the obtained results of accuracy, sensitivity and specificity of the trained neural network are comparable with other works, and in some respects they are superior.
IMPLEMENTATION RESULTS
The resulting neural network algorithm was implemented in the Neuron-Spectrum.NET software and tested on previously recorded surveys, both those included and those not included in the training sample.
VIDEO
This video shows an example of the resulting algorithm in action:
PLANS AND PERSPECTIVES
So far, these are only the interim results of the team's work. The authors' future plans include:
- Clinical testing of the algorithm in practice.
- Issuing voice commands to the patient through the speaker in the IP-video camera (already DONE).
- Recruiting a more representative sample of examinations, further training the neural network model and increasing the accuracy of its work.