Inspiration Neurological monitoring is expensive, slow, and often reactive. We wanted to show that with synthetic yet realistic multi-channel EEG and modern ML, a team can prototype a real-time brain-state classifier and anomaly detector in a hackathon weekend—no specialized hardware required. The goal was to make neural signal intelligence feel as accessible as any web dashboard.
What it does NeuroPulse AI simulates a 6-channel EEG stream (Fp1, Fp2, C3, C4, P3, P4) at 256 Hz, cleans it with a Butterworth bandpass filter (0.5–45 Hz), and extracts Power Spectral Density across Delta, Theta, Alpha, Beta, and Gamma plus statistical features (variance, peak-to-peak, RMS). It then runs two models in tandem: a RandomForestClassifier labels the brain state as "Calm / Relaxed", "Focused / Active", "Fatigued", or "Abnormal Spike", while an IsolationForest flags anomalous/seizure-like spikes. The Streamlit dashboard displays live KPI cards (brain state, anomaly risk Low/Medium/Critical with percentage, dominant frequency band, processing latency), an interactive multi-channel waveform, a band-power bar chart, a live anomaly alert feed, an event timeline, and a downloadable CSV session report. Sidebar controls let users tune noise, inject anomalies, change simulation speed/refresh rate, auto-cycle states, and export data.
How we built it We built the entire pipeline in Python. ml_pipeline.py handles signal generation, scipy-based Butterworth filtering, Welch PSD feature extraction, and model training/inference. Models (IsolationForest + RandomForestClassifier) are trained automatically on startup using ~280 synthetic baseline sessions. app.py is a Streamlit app with custom dark-mode CSS and Plotly visualizations, using session state to keep models and logs persistent across reruns. A lightweight rerun loop drives the real-time feel with configurable refresh intervals.
Challenges we ran into Balancing synthetic signal realism with clearly separable states for the classifier. Keeping inference latency low while computing Welch PSD per channel on every frame. Managing Streamlit's rerun model so trained models and logs persist without retraining each frame. Handling numpy 2.x API changes (e.g., np.trapz → np.trapezoid). Designing risk scoring that combines unsupervised anomaly scores with supervised class probabilities into an intuitive Low/Medium/Critical scale. Accomplishments that we're proud of Fully end-to-end, runnable out of the box with one command. Real-time multi-model inference with sub-200 ms latency on a laptop. A polished, dark-mode dashboard with KPIs, waveforms, spectrum, alert feed, timeline, and CSV export. No external data or hardware required—everything is synthetic and self-contained. What we learned How to extract meaningful EEG features (band powers + stats) and feed them to classical ML for strong baselines. How IsolationForest complements supervised classifiers for anomaly detection. Streamlit session-state patterns for stateful real-time apps. Practical signal-processing details like bandpass filtering and Welch's method. What's next for NeuroPulse AI Integrate real EEG hardware (OpenBCI, Muse) and stream live data. Add deep learning (1D-CNN/Transformer) for higher accuracy. Implement per-user baselines and adaptive thresholds. Add clinician-facing alerts, trend analytics, and FHIR/HL7 export. Deploy as a web service with authentication and multi-patient monitoring.