Abstract: Accurate detection and classification of high-frequency oscillations (HFOs) in electroencephalography (EEG) recordings have become increasingly important for identifying epileptogenic zones in patients with drug-resistant epilepsy. However, few open-source platforms offer comprehensive and accessible tools that integrate conventional signal processing with modern deep learning approaches for biomarker analysis. We introduce PyHFO 2.0, an enhanced platform designed for automated detection, classification, and expert annotation of neural events. PyHFO 2.0 includes three commonly used detection methods: short-term energy (STE), the Montreal Neurological Institute (MNI) approach, and a Hilbert transform-based detector. For classification, the platform incorporates deep learning models for artifact rejection, spike-associated HFO (spkHFO) detection, and epileptogenic HFO (eHFO) identification. These models are integrated with the Hugging Face ecosystem for seamless loading and can be replaced with custom-trained alternatives. Furthermore, PyHFO 2.0 features an interactive annotation interface that enables clinicians and researchers to inspect, verify, and refine automated results. The platform was validated using clinical EEG datasets from both human and rodent models of epilepsy, confirming its reliability. PyHFO 2.0 aims to simplify the use of computational neuroscience tools in both research and clinical environments by combining methodological rigor with a user-friendly graphical interface. Its scalable architecture and model integration capabilities support a range of applications in biomarker discovery, epilepsy diagnostics, and clinical decision support, bridging advanced computation and practical usability.
Introduction
High-Frequency Oscillations (HFOs) are critical biomarkers for identifying the "epileptogenic zone"—the specific area of the brain where seizures originate. Identifying these zones is vital for successful surgical intervention in drug-resistant epilepsy. Despite their clinical value, HFO analysis faces two major hurdles: a high rate of false positives, where automated detectors mistake noise or artifacts for real neural events, and significant workflow gaps. Existing open-source tools often lack a user-friendly way to integrate modern deep learning (DL) classifiers with expert clinical review.
PyHFO 2.0 addresses these challenges by providing a scalable, accessible platform that handles the entire pipeline from raw data loading to DL-powered classification and expert annotation. It facilitates a "human-in-the-loop" workflow, allowing clinicians to automate analysis while maintaining the ability to manually verify and refine results.
System Architecture and Methods
The platform operates through a modular three-stage pipeline designed for both flexibility and rigor.
1. Detection Stage
PyHFO 2.0 includes three standard algorithms to identify potential HFO events: Short-Term Energy (STE), the Montreal Neurological Institute (MNI) approach, and a newly integrated Hilbert transform-based detector. These algorithms allow for broad initial identification of candidate events across different EEG recording types.
2. Classification Stage
Following detection, the software utilizes deep learning models to categorize events into four distinct types: artifacts, real HFOs, spike-associated HFOs (spkHFO), and epileptogenic HFOs (eHFO). A significant technical contribution of this version is the model distillation of the eHFO classifier. By distilling a complex model into a lighter version using only time-frequency plots, the authors reduced computational complexity (MACs) by 73% while maintaining high predictive accuracy. This optimization ensures the platform can run efficiently on standard clinical workstations without specialized hardware.
3. Expert Annotation Stage
The final stage involves a dedicated Graphical User Interface (GUI) for expert review. This interface allows users to inspect events through multiple lenses, including raw signals, filtered traces, time-frequency plots, and Fast Fourier Transform (FFT) plots, ensuring that automated suggestions can be verified or corrected by a clinician.
Validation Datasets
The platform was validated using a diverse array of clinical and experimental data to ensure cross-species and cross-institutional utility:
- UCLA iEEG Dataset: Intracranial EEG from 19 pediatric patients with drug-resistant focal epilepsy.
- Zurich iEEG HFO Dataset: Interictal sleep EEG from 20 adult patients.
- UCLA Rodent Dataset: Intracranial EEG from rats (traumatic brain injury model vs. sham control) to demonstrate utility in translational research.
- Open-iEEG Dataset: A massive dataset comprising 185 patients and over 686,000 events, used specifically for the deep learning model distillation process.
Human-in-the-Loop Annotation
A core philosophy of PyHFO 2.0 is that AI should assist, not replace, the clinician. The interactive annotation interface is designed to build trust by allowing experts to "sanity check" automated results easily. This interface provides synchronized visualizations that are essential for distinguishing pathological HFOs from physiological noise.
Key Results and Performance
- Detection Consistency: The new Hilbert detector showed strong agreement with established tools like RIPPLELAB across both human and rodent datasets.
- Classification Accuracy: The artifact classification model achieved 96.4% accuracy, while the spike-associated HFO model reached 90.5%.
- Clinical Utility: Using the "resection ratio" (the proportion of detected eHFOs removed during surgery), the platform's biomarkers successfully predicted postoperative seizure outcomes with an Area Under the Curve (AUC) of up to 0.86.
- Computational Efficiency: The distilled eHFO model requires only 486.95 M MACs compared to the original's 1.822 G MACs, facilitating faster processing times.
- Hugging Face Integration: By hosting models on the Hugging Face Hub, PyHFO 2.0 allows for seamless, automated model updates and sharing, fostering a collaborative ecosystem for neural biomarkers.
Limitations and Future Directions
While PyHFO 2.0 represents a significant step forward, several areas for improvement remain. Currently, the tool supports EDF and BrainVision formats; future updates will aim to include other common types like BioSemi’s .bdf. The authors also plan to expand the platform's scope to detect other neural events, such as sleep spindles and epileptiform discharges. Additionally, future versions will focus on enhancing GUI interactivity with features like precise measurement cursors and improved navigation tools. While performance is high, users with highly specialized datasets may still benefit from fine-tuning the provided DL models for optimal local results.
Summary updated