Skip to content

Repository files navigation

NeuroEmotion: Brainwave Interpretation for Emotion Analysis

Model Training Repository

Repository containing model training scripts and experimental results for EEG-based emotion classification using various Machine Learning and Deep Learning approaches.


📁 Repository Structure

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

📂 Folders

training-code/

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

trained-models/

Contains ready-to-use exported models in multiple formats (e.g., .keras for TensorFlow/Keras and .tflite for mobile/edge deployment).

results/

Directory containing training logs, visualization of results, and performance benchmarks.


📊 Model Benchmark Results

The following models were trained and evaluated on the DREAMER dataset for 4-class emotion classification:

Model Accuracy Comparison

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

💾 Trained Models

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.

Data Preprocessing (Scaler)

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)

⚡ Inference Pipeline

The inference.py script provides a complete end-to-end pipeline for predicting emotions from raw EEG data.

Features:

  • Preprocessing: Automatic channel selection and Power Spectral Density (PSD) feature extraction.
  • Data Scaling: Uses scaler.pkl to 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.)


🎯 Project Overview

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

🚀 Getting Started

  1. Clone this repository
  2. Install required dependencies
  3. Download the required dataset
  4. Run the training notebooks in training-code/

📄 License

Part of the NeuroEmotion FYP.

About

Repository of model training scripts and results of multiple datasets on multiple ML and DL models

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages