Task-oriented Self-supervised Learning for Anomaly Detection in Electroencephalography

Yaojia Zheng, Zhouwu Liu, Rong Mo, Ziyi Chen, Wei-Shi Zheng, Ruixuan Wang · DOI

Abstract

Electroencephalography (EEG) is a critical diagnostic tool for monitoring brain health, yet the manual interpretation of long-duration waveforms is labor-intensive and prone to human error. While supervised deep learning models can identify specific neurological conditions, they often struggle to generalize to novel or rare pathologies. This paper presents a task-oriented self-supervised learning (SSL) framework for EEG anomaly detection. By leveraging expert knowledge to simulate synthetic anomalies during training, the proposed method creates a robust feature extractor capable of identifying real-world abnormalities without the need for labeled disease data. The framework achieves state-of-the-art results, including an AUC of 0.95 on clinical datasets.

Introduction

The detection of anomalies in EEG data is essential for identifying "brain storms," seizures, and other neurological red flags. Traditional anomaly detection (AD) models are typically trained only on "normal" data, leaving them without a conceptual framework for what an abnormality looks like. This "blindness" often limits their discriminative power.

This research addresses this gap by introducing a "task-oriented" approach to SSL. Instead of using generic pretext tasks designed for natural images, the authors incorporate medical domain knowledge to create synthetic anomalies that mimic the properties of actual brain pathologies—such as sudden spikes in amplitude or shifts in frequency. This allows the model to learn the boundary between normal and abnormal activity more effectively than traditional unsupervised methods.

Methodology

1. Task-Oriented Self-Supervised Learning

The core of the framework is a two-stage process. In the first stage, the model's feature extractor is trained using synthetic anomalies. The researchers apply two specific transformations to normal EEG signals:

  • Amplitude Transformation: Locally scaling the signal height to simulate pathological spikes.
  • Frequency Transformation: Using interpolation to speed up or slow down the signal, simulating rhythmic slowing or abrupt frequency changes.

Rather than a simple binary classification, the model is tasked with a 3-way classification: identifying whether a signal is normal, amplitude-abnormal, or frequency-abnormal. This multi-class pretext task forces the model to learn more nuanced features of the EEG waveform.

2. Dual-Branch CNN Architecture

The authors designed a custom architecture to handle the unique temporal and spatial characteristics of EEG data:

  • Main Branch: Utilizes a ResNet34 backbone with larger 1D kernels (1x7). These larger kernels are specifically chosen to capture the long-duration, low-frequency patterns often associated with brain pathology.
  • Shortcut Branch: Employs 2D kernels to capture spatial correlations across different brain electrodes (channels) over short time intervals. This ensures that transient, small-scale anomalies are not lost during deep processing.

3. Anomaly Detection Mechanism

Once the feature extractor is trained, the second stage involves defining the "normal" distribution. The researchers use a generative approach based on the Mahalanobis distance. By measuring how far a new, unseen EEG sample sits from the distribution of normal features in the latent space, the model can assign an anomaly score to the data.

Experimental Evaluation

The model was evaluated across three diverse datasets to test its generalizability:

  1. Internal Dataset: Clinical data from a national hospital featuring complex waveforms like triphasic waves.
  2. CHB-MIT: A public dataset focusing on pediatric seizure detection.
  3. UPMC: Data from the UPenn and Mayo Clinic Seizure Detection Challenge.

Key Results

The proposed method significantly outperformed established baselines, including One-Class SVM (OC-SVM), standard Autoencoders, and previous SSL methods like ScaleNet. On the Internal dataset, the model achieved an AUC of 0.95, a substantial improvement over the 0.75 achieved by OC-SVM and the 0.90 achieved by ScaleNet. The model also demonstrated high stability across different sampling rates (256Hz to 1024Hz) and robustness to the specific parameters used to generate synthetic anomalies.

Discussion and Insights

Several key findings emerged from this study:

  • Expert Knowledge vs. Generic SSL: Pretext tasks designed specifically for the modality (EEG) are far more effective than generic tasks like CutPaste or SimCLR, which were originally intended for computer vision.
  • Kernel Size Optimization: The shift from standard 1x3 kernels to 1x7 kernels was crucial for capturing the temporal scale of neurological events.
  • Atomic Transformations: The researchers found that training the model to recognize amplitude and frequency anomalies separately worked better than combining them into complex transformations. This suggests that learning the "atomic" properties of an anomaly allows for better generalization to the multifaceted irregularities found in real patients.

Conclusion and Future Work

This paper demonstrates that task-oriented SSL is a powerful tool for medical signal analysis. While the current synthetic transformations are mathematically simple, they provide a strong foundation for anomaly detection. Future research may explore more physiologically inspired transformations and address the challenge of inter-subject variability—the natural differences in "normal" brain activity between individuals—to further refine the model's accuracy in clinical settings.

Summary updated

BibTeX
@inproceedings{zheng2022task,
  author = {Yaojia Zheng and Zhouwu Liu and Rong Mo and Ziyi Chen and Wei-Shi Zheng and Ruixuan Wang},
  title = {{Task-oriented Self-supervised Learning for Anomaly Detection in Electroencephalography}},
  booktitle = {International Conference on Medical Image Computing and Computer-Assisted Intervention},
  year = {2022},
  url = {https://openreview.net/forum?id=zl09V7AXXcl},
}
Figure