Repository containing model training scripts and experimental results for EEG-based emotion classification using various Machine Learning and Deep Learning approaches.
model-training/
├── README.md
├── inference.py # Main inference pipeline for real-time EEG prediction
├── scaler.pkl # Saved StandardScaler for data normalization
├── trained-models/ # Exported model files (Keras, TFLite)
├── training-code/
│ └── models_training_dreamer.ipynb # Training notebook for emotion classification models
└── results/
└── results_on_dreamer.png # Benchmark comparison of all trained models
Contains Jupyter notebooks with training pipelines for emotion classification models. The main notebook includes:
- Data loading and preprocessing
- Feature extraction from EEG signals
- Multiple ML/DL model implementations
- Training, evaluation, and visualization
Contains ready-to-use exported models in multiple formats (e.g., .keras for TensorFlow/Keras and .tflite for mobile/edge deployment).
Directory containing training logs, visualization of results, and performance benchmarks.
The following models were trained and evaluated on the DREAMER dataset for 4-class emotion classification:
| Rank | Model | Accuracy |
|---|---|---|
| 1 | Hybrid (GRU+BiLSTM+LSTM) | 82.99% |
| 2 | LSTM | 82.43% |
| 3 | BiLSTM | 82.31% |
| 4 | TCN | 81.44% |
| 5 | GRU | 79.03% |
| 6 | Transformer | 76.10% |
| 7 | CNN | 76.03% |
| 8 | XGBoost | 70.02% |
| 9 | SVM | 66.68% |
Key Findings:
- The Hybrid model (GRU+BiLSTM+LSTM) achieved the best performance at 82.99%
- Deep learning models significantly outperformed traditional ML approaches
- Recurrent architectures (LSTM, BiLSTM, GRU) showed strong performance for sequential EEG data
The models are exported in the trained-models/ directory for integration into applications:
| File | Format | Description |
|---|---|---|
lstm_model.keras |
Keras v3 | Native Keras format for high-level API usage and further training. |
lstm_model.tflite |
TFLite | Optimized format for low-latency inference on mobile and embedded devices. |
The scaler.pkl file contains the StandardScaler (or equivalent) used during training. It is required to normalize real-time EEG data before passing it to the models.
Usage Example (Python):
import joblib
import tensorflow as tf
# Load scaler and model
scaler = joblib.load('scaler.pkl')
model = tf.keras.models.load_model('trained-models/lstm_model.keras')
# Preprocess new data
# X_new_scaled = scaler.transform(X_new)The inference.py script provides a complete end-to-end pipeline for predicting emotions from raw EEG data.
- Preprocessing: Automatic channel selection and Power Spectral Density (PSD) feature extraction.
- Data Scaling: Uses
scaler.pklto normalize features. - TFLite Integration: Optimized for low-latency inference using
lstm_model.tflite. - Sliding Window: Processes data in segments to form the mandatory time-sequence for the LSTM.
How to Run:
python inference.py(Ensure you have numpy, tensorflow, joblib, and scipy installed.)
This repository is part of the NeuroEmotion Final Year Project focusing on:
- Processing EEG brainwave signals
- Extracting meaningful features from neural data
- Classifying emotions using state-of-the-art models
- Comparing performance across different approaches
- Clone this repository
- Install required dependencies
- Download the required dataset
- Run the training notebooks in
training-code/
Part of the NeuroEmotion FYP.
