  Implanted devices providing real-time neural activity classification and
control are increasingly used to treat neurological disorders, such as epilepsy
and Parkinson's disease. Classification performance is critical to identifying
brain states appropriate for the therapeutic action. However, advanced
algorithms that have shown promise in offline studies, in particular deep
learning (DL) methods, have not been deployed on resource-restrained neural
implants. Here, we designed and optimized three embedded DL models of commonly
adopted architectures and evaluated their inference performance in a case study
of seizure detection. A deep neural network (DNN), a convolutional neural
network (CNN), and a long short-term memory (LSTM) network were designed to
classify ictal, preictal, and interictal phases from the CHB-MIT scalp EEG
database. After iterative model compression and quantization, the algorithms
were deployed on a general-purpose, off-the-shelf microcontroller. Inference
sensitivity, false positive rate, execution time, memory size, and power
consumption were quantified. For seizure event detection, the sensitivity and
FPR (h-1) for the DNN, CNN, and LSTM models were 87.36%/0.169, 96.70%/0.102,
and 97.61%/0.071, respectively. Predicting seizures for early warnings was also
feasible. The implemented compression and quantization achieved a significant
saving of power and memory with an accuracy degradation of less than 0.5%. Edge
DL models achieved performance comparable to many prior implementations that
had no time or computational resource limitations. Generic microcontrollers can
provide the required memory and computational resources, while model designs
can be migrated to ASICs for further optimization. The results suggest that
edge DL inference is a feasible option for future neural implants to improve
classification performance and therapeutic outcomes.
