Q-EEGNet: an Energy-Efficient 8-bit Quantized Parallel EEGNet Implementation for Edge Motor-Imagery Brain-Machine Interfaces

Tibor Schneider, Xiaying Wang, Michael Hersche, Lukas Cavigelli, Luca Benini · DOI

Abstract

Motor-Imagery Brain–Machine Interfaces (MI-BMIs) promise direct and accessible communication between human brains and machines by analyzing brain activities recorded with Electroencephalography (EEG). Latency, reliability, and privacy constraints make it unsuitable to offload the computation to the cloud. Practical use cases demand a wearable, battery-operated device with low average power consumption for long-term use. Recently, sophisticated algorithms, in particular deep learning models, have emerged for classifying EEG signals. While reaching outstanding accuracy, these models often exceed the limitations of edge devices due to their memory and computational requirements. In this paper, we demonstrate algorithmic and implementation optimizations for EEGNET, a compact Convolutional Neural Network (CNN) suitable for many BMI paradigms. We quantize weights and activations to 8-bit fixed-point with a negligible accuracy loss of 0.4% on 4-class MI, and present an energy-efficient hardware-aware implementation on the Mr.Wolf parallel ultra-low power (PULP) System-on-Chip (SoC) by utilizing its custom RISC-V ISA extensions and 8-core compute cluster. With our proposed optimization steps, we can obtain an overall speedup of 64x and a reduction of up to 85% in memory footprint with respect to a single-core layer-wise baseline implementation. Our implementation takes only 5.82 ms and consumes 0.627 mJ per inference. With 21.0GMAC/s/W, it is 256x more energy-efficient than an EEGNET implementation on an ARM Cortex-M7 (0.082GMAC/s/W).

Introduction

Brain-Machine Interfaces (BMIs) that utilize Motor-Imagery (MI)—the process of imagining movement to control external devices—hold significant potential for assisting individuals with physical disabilities. However, transitioning these systems from laboratory settings to wearable, everyday devices presents substantial technical hurdles. High-performing models like EEGNet are computationally intensive, often requiring off-device processing that introduces latency and privacy risks.

Existing attempts to deploy these models on "edge" hardware typically involve scaling down the model, which leads to significant accuracy degradation. This research introduces Q-EEGNet, an 8-bit quantized version of the full EEGNet model optimized for ultra-low-power parallel architectures, enabling high-performance inference without sacrificing accuracy or battery life.

Architecture and Optimization Methods

The researchers implemented several layers of optimization to bridge the gap between complex neural networks and resource-constrained microcontrollers. The core of the approach involves converting the model’s weights and activations from 32-bit floating-point to 8-bit fixed-point using Quantization-Aware Training (QAT) and Random Partition Relaxation (RPR).

The EEGNet architecture optimized for 8-bit quantization, featuring temporal, spatial, and separable convolution layers.

Beyond quantization, the implementation leverages the Mr. Wolf System-on-Chip (SoC), a PULP-based platform featuring an 8-core RISC-V compute cluster. Key algorithmic innovations include:

  • Interleaved Layers: By processing data in "columns" across the first two convolutional layers rather than storing entire intermediate feature maps, the team reduced the memory footprint by 85%.
  • Mathematical Merging: Batch Normalization (BN) layers were mathematically folded into the preceding convolutions and pooling layers, eliminating thousands of expensive division operations.
  • Custom 1D Kernels: While most libraries focus on 2D images, the authors developed custom 1D kernels to better handle EEG signal data, utilizing SIMD instructions to process four 8-bit values simultaneously.

Experimental Results

The system was evaluated using the BCI Competition IV-2a dataset, which contains 22-channel EEG recordings from 9 subjects performing 4-class motor imagery tasks.

Q-EEGNet achieved an accuracy of 70.9%, representing a negligible 0.4% drop from the 32-bit floating-point baseline (71.3%). More importantly, the hardware-aware optimizations resulted in a 64x speedup over a single-core baseline. As shown in the comparison below, the parallel RISC-V implementation on Mr. Wolf vastly outperforms standard high-end microcontrollers in energy efficiency.

Performance comparison between the proposed Mr. Wolf implementation and an ARM Cortex-M7 baseline.

At 350 MHz, the system completes a full inference in just 5.82 ms, consuming only 0.627 mJ. This results in an energy efficiency of 21.0 GMAC/s/W, which is 256x more efficient than an equivalent implementation on an ARM Cortex-M7.

Conclusion and Future Work

Q-EEGNet demonstrates that high-precision floating-point math is often an unnecessary luxury for BMI applications. By combining quantization with hardware-aware parallelization, complex deep learning models can be run locally on wearable devices.

Future research will explore integrating these manual optimizations into automatic code generators and testing the architecture on other BMI paradigms, such as P300 event-related potentials. Additionally, the team aims to investigate even lower bit-widths, such as binary or ternary weights, to further push the boundaries of ultra-low-power edge computing.

Summary updated

BibTeX
@inproceedings{schneider2020q,
  author = {Tibor Schneider and Xiaying Wang and Michael Hersche and Lukas Cavigelli and Luca Benini},
  title = {{Q-EEGNet: an Energy-Efficient 8-bit Quantized Parallel EEGNet Implementation for Edge Motor-Imagery Brain-Machine Interfaces}},
  booktitle = {SMARTCOMP},
  year = {2020},
  doi = {10.1109/smartcomp50058.2020.00065},
}
Figure