Code Monkey home page Code Monkey logo

bci-data-augmentation's Introduction

Analyzing Data Augmentation Methods for Convolutional Neural Network-based Brain-Computer Interfaces

Gabriel Faria, Gabriel Henrique de Souza, Heder Bernardino, Luciana Motta, Alex Vieira

This repository provides code, visualizations, and supplementary information about the paper.

Installation

To install the project, run the following commands:

# Install requirements
conda env create --file=environment.yml

# Clone repository
git clone https://github.com/gabriel-dev/bci-data-augmentation

Alternatively, use pip and requirements.txt, which contains detailed package information.

Usage

To run the project, execute:

python -m project <DATASET> [optional-arguments]

positional arguments:
  DATASET                          # the dataset to be used. Available options: 2a and 2b

optional arguments:
  -h, --help                       # show help message and exit
  --sfreq SFREQ                    # the sampling frequency of the signals after preprocessing. Defaults to 250 Hz
  --l_freq L_FREQ                  # lowest allowed frequency in Hertz after band-pass filtering. Defaults to 4 Hz
  --h_freq H_FREQ                  # highest allowed frequency in Hertz after band-pass filtering. Disabled by default
  --tmin TMIN                      # the start of the crop in seconds, relative to the cue onset. Defaults to 0.5
  --tmax TMAX                      # the end of the crop in seconds, relative to the cue onset. Defaults to 2.5
  --model MODEL                    # the neural network model to be used. Check experiments/util.py for available options. Defaults to eegnet-82
  --n_classes N_CLASSES            # the number of output classes to be used. Defaults to the dataset's default configuration
  --n_electrodes N_ELECTRODES      # the number of electrodes to be used. Defaults to the dataset's default configuration
  --train_size TRAIN_SIZE          # determines the max number of training samples in an epoch. Defaults to the size of the training set
  --transform TRANSFORM            # the data augmentation method to be used. Check experiments/util.py for available options. Defaults to none
  --crop_after                     # crop the trials only after applying data augmentation. Necessary for Sliding Window and SW+SR. Disabled by default
  --augment_probability PROBA      # probability of the transform being applied to a training sample during an epoch. Defaults to 1
  --keep_train KEEP_TRAIN          # the number training samples per class to keep (the rest is ignored). Defaults to the maximum
  --keep_valid KEEP_VALID          # the number validation samples per class to keep (the rest is ignored). Defaults to the maximum
  --intrasession                   # use data from one session at a time (within-session). By default, all available data is used (cross-session)
  --batch_size BATCH_SIZE          # sets the batch size. Defaults to 32
  --epochs EPOCHS                  # sets the number of training epochs. Defaults to 500
  --device DEVICE                  # sets which PyTorch device to use. Defaults to "cuda"

An example of a run performed during our experiments is shown in run-example.sh.

The results obtained in our experiments are available in data/results.csv. The accuracy and loss curve history of the experiments is available here.

bci-data-augmentation's People

Contributors

gbrlfaria avatar

Stargazers

 avatar

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.