Link: https://arxiv.org/abs/2111.15569
Citation:
@misc{nagarajan2021scalable,
title={Scalable Machine Learning Architecture for Neonatal Seizure Detection on Ultra-Edge Devices},
author={Vishal Nagarajan and Ashwini Muralidharan and Deekshitha Sriraman and Pravin Kumar S},
year={2021},
eprint={2111.15569},
archivePrefix={arXiv},
primaryClass={eess.SP}
}
This repository contains code for the implementation of the paper titled "Scalable Machine Learning Architecture for Neonatal Seizure Detection on Ultra-Edge Devices", which has been accepted at the AISP '22: 2nd International Conference on Artificial Intelligence and Signal Processing. A typical neonatal seizure and non-seizure event is illustrated below. Continuous EEG signals are filtered and segmented with varying window lengths of 1, 2, 4, 8, and 16 seconds. The data used here for experimentation can be downloaded from here.
This end-to-end architecture receives raw EEG signal, processes it and classifies it as ictal or normal activity. After preprocessing, the signal is passed to a feature extraction engine that extracts the necessary feature set Fd. It is followed by a scalable machine learning (ML) classifier that performs prediction as illustrated in the figure below.
- dataprocessing.ipynb -> Notebook for converting edf files to csv files.
- filtering.ipynb -> Notebook for filtering the input EEG signals in order to observe the specific frequencies.
- segmentation.ipynb -> Notebook for segmenting the input into appropriate windows lengths and overlaps.
- features_final.ipynb -> Notebook for extracting relevant features from segmented data.
- protoNN_example.py -> Script used for running protoNN model using .npy files.
- inference_time.py -> Script used to record and report inference times.
- knn.ipynb -> Notebook used to compare results of ProtoNN and kNN models.
If you are using conda, it is recommended to switch to a new environment.
$ conda create -n myenv
$ conda activate myenv
$ conda install pip
$ pip install -r requirements.txt
If you wish to use virtual environment,
$ pip install virtualenv
$ virtualenv myenv
$ source myenv/bin/activate
$ pip install -r requirements.txt
-
Clone the ProtoNN package from here, antropy package from here, and envelope_derivative_operator package from here.
-
Replace the protoNN_example.py with protoNN_example.py.
-
Prepare the train and test data .npy files and save it in a DATA_DIR directory.
-
Execute the following command in terminal after preparing the data files. Create an output directory should you need to save the weights of the ProtoNN object as OUT_DIR.
$ python protoNN_example.py -d DATA_DIR -e 500 -o OUT_DIR
ProtoNN built using EdgeML provided by Microsoft. Features extracted using antropy and otoolej repositories.
[1] Nathan Stevenson, Karoliina Tapani, Leena Lauronen, & Sampsa Vanhatalo. (2018). A dataset of neonatal EEG recordings with seizures annotations [Data set]. Zenodo. https://doi.org/10.5281/zenodo.1280684.
[2] Gupta, Ankit et al. "ProtoNN: Compressed and Accurate kNN for Resource-scarce Devices." Proceedings of the 34th International Conference on Machine Learning, Sydney, Australia, PMLR 70.