A state-of-the-art neural decoding pipeline that translates raw brain activity (EEG) directly into human-readable text.
Explore the Demo • Architecture • Dataset • Documentation • Slides
Welcome to Brain2Text '25! This project was developed as part of the Kaggle Brain-to-Text competition. It demonstrates a complete end-to-end pipeline capable of taking neural signals (512-dimensional features extracted per 20ms bin), decoding them into phonemes using a deep Recurrent Neural Network (GRU), and finally translating those phonemes into English text using the CMU Pronouncing Dictionary.
This repository provides everything you need to run the model:
- A pre-trained GRU neural decoder.
- A Flask backend optimized for easy deployment on Google Colab.
- A modern React frontend for real-time inference visualization and presentations.
The pipeline consists of three major stages: feature extraction, neural decoding, and text reconstruction.
graph LR
A[Raw Neural Data <br/> shape: T x 512] --> B(Adapter Layer)
B --> C(5-Layer GRU)
C --> D(Fully Connected)
D --> E[CTC Greedy Decoder]
E -->|Phonemes| F(CMU Dict Lookup)
F --> G[Final Text]
style A fill:#2b2b2b,stroke:#fff,stroke-width:1px,color:#fff
style G fill:#2ea44f,stroke:#fff,stroke-width:1px,color:#fff
| Component | Detail |
|---|---|
| Model Architecture | 5-Layer GRU (768 hidden units) |
| Input Shape | [T, 512] float32 (512-dim features) |
| Output Vocabulary | 40 ARPAbet phonemes + 1 blank token |
| Decoder | CTC Greedy Decode + Word-Frequency Ranked CMU Dict |
| Inference Latency | ~40–70 ms on standard CPU |
| Best PER | 95.03% (Training data) |
| Dataset | Kaggle Brain-to-Text 2025 Competition (t15) |
Experience the pipeline yourself! Follow these steps to spin up the entire stack.
To avoid local GPU requirements, the backend is designed to run in Google Colab and expose an API via ngrok.
- Open a new Google Colab notebook.
- Upload
colab_app.py,server/phoneme_to_text.py, and your.pklmodel weights to the Colab environment. - Copy the contents of
colab_setup.pyinto a notebook cell. - Replace
"YOUR_NGROK_AUTH_TOKEN_HERE"with your free ngrok token. - Run the cell. You will get a live URL:
🚀 API IS LIVE AT: https://[random-string].ngrok.app
This project includes a sleek React/Vite frontend.
cd frontend
npm install
npm run dev- Open
http://localhost:5173in your browser. - Switch to LIVE API MODE.
- Paste your ngrok URL into the connection box.
- Upload an
.npyneural trial file and hit RUN INFERENCE.
The model was trained on the Kaggle Brain-to-Text 2025 Competition (t15) dataset. It expects .npy files containing matrices of shape [T, 512]. For demonstration purposes, we have included pre-configured trial files in the demo_data/ directory.
If the backend is offline, the frontend includes a DEMO MODE. This mode runs purely in the browser and simulates real API responses using pre-baked phoneme outputs from the competition dataset.
Available Demo Trials:
trial_01: "Water bottle."trial_02: "Hello world."trial_03: "Good morning."trial_04: "Open the door."
For detailed information on handling raw .hdf5 files and converting them, see the Demo Guide.
Read the full research paper and documentation in brain2Text Merged.pdf
View the project presentation slides in Brain2Text.pptx
Built with ❤️ for Brain-to-Text '25