How noor-fatima-afzal/eeg-emotion-detection works
Main components
• User Interface (Streamlit frontend)
• Data Ingestion (EDF upload & temp file handler)
• Preprocessing Pipeline (notch filter, bandpass filter, re-reference)
• Epoching Module (windowing with length/overlap, optional resample)
• Feature Extraction Engine (band powers, ratios, Hjorth, entropy, aggregate stats)
• Inference Engine
• Optional scikit-learn classifier (.pkl)
• Heuristic fallback
• Visualization Module
• Channel explorer (raw trace)
• Spectrogram
• PSD (Welch)
• Bandpower bar charts
• Topographic maps
• Export Module (CSV download of per-epoch predictions & probabilities)
• Configuration Store (sidebar controls)
Relationships and data flow
• User interacts with the Streamlit UI →
• UI invokes the Data Ingestion component →
• Raw EDF data flows into Preprocessing →
• Preprocessed signal passed to Epoching →
• Each epoch → Feature Extraction → Feature vectors →
• Vectors feed into the Inference Engine → Predictions →
• Results sent both to Visualization Module and Export Module →
• UI renders visuals and provides download link.
• Configuration Store feeds parameters into Preprocessing, Epoching, Visualization.
Architectural patterns & design principles
• Pipeline pattern: distinct, ordered stages (Ingestion → Preprocessing → …)
• Separation of concerns: UI vs. processing vs. inference vs. export
• Dependency injection via configuration sidebar
• Pluggable model: external scikit-learn .pkl or internal heuristic
Key technologies & libraries
• Streamlit: UI & app server
• MNE: EDF ingestion, montage handling
• SciPy signal: notch, bandpass, spectrogram, Welch PSD
• NumPy / pandas: array manipulation, CSV export
• scikit-learn: optional classifier
• Matplotlib / Plotly: plots & topographic maps