This repository provides a production-style inference API for EEG motor-imagery classification, built on top of a classical CSP + LDA pipeline.
Training and feature-generation pipeline: EEG-BCI-Pipeline
- Task: EEG motor-imagery classification (left hand, right hand, foot, tongue)
- Model: Common Spatial Patterns (CSP) + Linear Discriminant Analysis (LDA)
- Role of API: Inference only (no training performed here)
- Framework: FastAPI
- Server: Uvicorn (ASGI)
- Deployment: Docker (multi-stage build)
Training is performed separately in the EEG pipeline project.
Raw EEG epochs
→ band-pass filtering (8–30 Hz)
→ CSP.fit / CSP.transform
→ LDA.fit
Outputs (exported offline):
- Trained CSP transformer (used client-side at inference time)
- Trained LDA classifier (loaded server-side by this API)
Client:
Raw EEG epoch
→ CSP.transform
→ feature vector (floats)
Server (this API):
feature vector
→ LDA.predict
→ class label (0–3)
Important:
- The API does not accept raw EEG
- The API does not perform training
- Only CSP feature vectors are accepted
Predict motor-imagery class from CSP features.
Input:
{
"features": [0.12, -0.34, 1.56]
}Output:
{
"prediction": 2
}docker build -t eeg-mi-api .
docker run --rm -p 8000:8000 eeg-mi-apiAPI available at http://localhost:8000
MIT