Giter Club home page Giter Club logo

mhyeeg's Introduction

Hypercomplex Multimodal Emotion Recognition from EEG and Peripheral Physiological Signals ๐ŸŽญ

Official PyTorch repository for Hypercomplex Multimodal Emotion Recognition from EEG and Peripheral Physiological Signals, ICASSPW 2023.

Eleonora Lopez, Eleonora Chiarantano, Eleonora Grassucci and Danilo Comminiello

[IEEEXplore][ArXiv Preprint]

Abstract ๐Ÿ˜Š

Multimodal emotion recognition from physiological signals is receiving an increasing amount of attention due to the impossibility to control them at will unlike behavioral reactions, thus providing more reliable information. Existing deep learning-based methods still rely on extracted handcrafted features, not taking full advantage of the learning ability of neural networks, and often adopt a single-modality approach, while human emotions are inherently expressed in a multimodal way. In this paper, we propose a hypercomplex multimodal network equipped with a novel fusion module comprising parameterized hypercomplex multiplications. Indeed, by operating in a hypercomplex domain the operations follow algebraic rules which allow to model latent relations among learned feature dimensions for a more effective fusion step. We perform classification of valence and arousal from electroencephalogram (EEG) and peripheral physiological signals, employing the publicly available database MAHNOB-HCI surpassing a multimodal state-of-the-art network.

HyperFuseNet ๐Ÿ˜

How to use ๐Ÿ˜ฑ

Install requirements

pip install -r requirements.txt

Data preprocessing

  1. Download the data from the official website.

  2. Preprocess the data: python data/preprocessing.py

    • This will create a folder for each subject with CSV files containing the preprocessed data and save everything inside args.save_path.
  3. Create torch files with augmented and split data: python data/create_dataset.py

    • This performs data splitting and augmentation from the preprocessed data in step 2.
    • You can specify which label to consider by setting the parameter label_kind to either Arsl or Vlnc.
    • The data is saved as .pt files which are used for training.

Training

  • To train with specific hyperparameters run: python main.py
    • Optimal hyperparameters for arousal and valence can be found in the arguments descriprion.
  • To run a sweep run: python sweep.py

Experiments will be directly tracked on Weight&Biases.

Cite

Please, cite our work if you found it useful.

@inproceedings{lopez2023hypercomplex,
  title={Hypercomplex Multimodal Emotion Recognition from EEG and Peripheral Physiological Signals},
  author={Lopez, Eleonora and Chiarantano, Eleonora and Grassucci, Eleonora and Comminiello, Danilo},
  booktitle={2023 IEEE International Conference on Acoustics, Speech, and Signal Processing Workshops (ICASSPW)},
  pages={1--5},
  year={2023},
  organization={IEEE}
}

Want more of hypercomplex models? ๐Ÿ‘ฅ

Check out:

  • Multi-View Breast Cancer Classification via Hypercomplex Neural Networks, under review at TPAMI, 2023 [Paper][GitHub]
  • PHNNs: Lightweight neural networks via parameterized hypercomplex convolutions, IEEE Transactions on Neural Networks and Learning Systems, 2022 [Paper][GitHub].
  • Hypercomplex Image-to-Image Translation, IJCNN, 2022 [Paper][GitHub]

mhyeeg's People

Contributors

elelo22 avatar eleonorachiarantano avatar

Stargazers

 avatar  avatar  avatar Cesar Coelho avatar Noah avatar Yiming Wang avatar Superbean_w avatar  avatar  avatar  avatar  avatar  avatar wujunye avatar  avatar Asige avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar cgh avatar  avatar  avatar  avatar ziyuemu avatar  avatar fooooooolman avatar Yue Wang avatar  avatar  avatar

Watchers

Kostas Georgiou avatar Cesar Coelho avatar

mhyeeg's Issues

pandas.errors.ParserError: Error tokenizing data. C error: Expected 44 fields in line 3169, saw 56

Hello, when I reproduce the code, when I run preprocessing.py file, I get the following error:

Preprocessing: 33%|โ–ˆโ–ˆโ–ˆโ–Ž | 185/565 [00:52<01:48, 3.49it/s]
Traceback (most recent call last):
File "D:\Codes\MHyEEG-main\data\preprocessing.py", line 252, in
preprocess(sessions_dir, args.save_path, args.verbose)
File "D:\Codes\MHyEEG-main\data\preprocessing.py", line 125, in preprocess
gaze_df = pd.read_csv(gaze_file, sep='\t', skiprows=23)
File "D:\anaconda3\envs\pytorch_thesis\lib\site-packages\pandas\io\parsers\readers.py", line 948, in read_csv
return _read(filepath_or_buffer, kwds)
File "D:\anaconda3\envs\pytorch_thesis\lib\site-packages\pandas\io\parsers\readers.py", line 617, in _read
return parser.read(nrows)
File "D:\anaconda3\envs\pytorch_thesis\lib\site-packages\pandas\io\parsers\readers.py", line 1748, in read
) = self._engine.read( # type: ignore[attr-defined]
File "D:\anaconda3\envs\pytorch_thesis\lib\site-packages\pandas\io\parsers\c_parser_wrapper.py", line 234, in read
chunks = self._reader.read_low_memory(nrows)
File "parsers.pyx", line 843, in pandas._libs.parsers.TextReader.read_low_memory
File "parsers.pyx", line 904, in pandas._libs.parsers.TextReader._read_rows
File "parsers.pyx", line 879, in pandas._libs.parsers.TextReader._tokenize_rows
File "parsers.pyx", line 890, in pandas._libs.parsers.TextReader._check_tokenize_status
File "parsers.pyx", line 2058, in pandas._libs.parsers.raise_parser_error
pandas.errors.ParserError: Error tokenizing data. C error: Expected 44 fields in line 3169, saw 56

This error indicates that an error occurred while parsing the data using Pandas. Specifically, it encountered a data row that was parsed to have 56 fields, but the program expected that the row should have 44 fields. This may be caused by some lines in the data file that do not match the format expected by the program.

Excuse me, is there a corresponding solution? If so, please let me know and I would be very grateful.

RuntimeError: weight tensor should be defined either for all 3 classes or no classes but got weight tensor of shape: [2]

While running the main file I am getting this error.

----Loading dataset----
Dataset: MAHNOB-HCI
#Traning samples: 360
#Validation samples: 3
#Training distribution: [210 150]
wandb: Currently logged in as: vanshuagarwal11-03 (vanshuagarwal11-03-SRM Institute of Science and Technology). Use wandb login --relogin to force relogin
wandb: Tracking run with wandb version 0.17.4
wandb: Run data is saved locally in /content/wandb/run-20240708_111041-0am4ciyg
wandb: Run wandb offline to turn off syncing.
wandb: Syncing run proud-leaf-49
wandb: โญ๏ธ View project at https://wandb.ai/vanshuagarwal11-03-SRM%20Institute%20of%20Science%20and%20Technology/MHyEEG
wandb: ๐Ÿš€ View run at https://wandb.ai/vanshuagarwal11-03-SRM%20Institute%20of%20Science%20and%20Technology/MHyEEG/runs/0am4ciyg
Number of parameters: 19663747

Running on GPU? True - gpu_num: 0
Train round: 0% 0/45 [00:00<?, ?batch/s]tensor([[ 0.0504, -0.0277, -0.0015],
[-0.1052, -0.0144, 0.0084],
[-0.1097, 0.0798, 0.0005],
[-0.0701, -0.0238, -0.0405],
[-0.0034, 0.0291, 0.0478],
[-0.0992, 0.0290, -0.0440],
[-0.1483, -0.0215, -0.0354],
[-0.0660, 0.0021, -0.0198]], device='cuda:0',
grad_fn=)
tensor([2, 1, 2, 2, 1, 1, 2, 1], device='cuda:0')
Traceback (most recent call last):
File "/content/drive/MyDrive/MHyEEG-main-share/MHyEEG-main/main.py", line 88, in
main(args, n_workers)
File "/content/drive/MyDrive/MHyEEG-main-share/MHyEEG-main/main.py", line 47, in main
trainer.train(train_loader, eval_loader)
File "/content/drive/MyDrive/MHyEEG-main-share/MHyEEG-main/training.py", line 92, in train
loss = self.criterion(outputs, labels)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1541, in _call_impl
return forward_call(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/loss.py", line 1185, in forward
return F.cross_entropy(input, target, weight=self.weight,
File "/usr/local/lib/python3.10/dist-packages/torch/nn/functional.py", line 3086, in cross_entropy
return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
RuntimeError: weight tensor should be defined either for all 3 classes or no classes but got weight tensor of shape: [2]
wandb: ๐Ÿš€ View run proud-leaf-49 at: https://wandb.ai/vanshuagarwal11-03-SRM%20Institute%20of%20Science%20and%20Technology/MHyEEG/runs/0am4ciyg
wandb: โญ๏ธ View project at: https://wandb.ai/vanshuagarwal11-03-SRM%20Institute%20of%20Science%20and%20Technology/MHyEEG
wandb: Synced 5 W&B file(s), 0 media file(s), 0 artifact file(s) and 0 other file(s)
wandb: Find logs at: ./wandb/run-20240708_111041-0am4ciyg/logs
wandb: WARNING The new W&B backend becomes opt-out in version 0.18.0; try it out with wandb.require("core")! See https://wandb.me/wandb-core for more information.

About Datasets

Can you share information about the dataset please? Our lab has applied for this dataset but no information till now. Hope to get your help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.