Code Monkey home page Code Monkey logo

bci-toolbox's Introduction

BCI-ToolBox

1. Introduction

BCI-ToolBox is deep learning pipeline for motor-imagery classification.
This repo contains five models: ShallowConvNet, DeepConvNet, EEGNet, FBCNet, BCI2021.
(BCI2021 is not an official name.)

2. Installation

Environment

  • Python == 3.7.10
  • PyTorch == 1.9.0
  • mne == 0.23.0
  • braindecode == 0.5.1
  • CUDA == 11.0

Create conda environment

conda install pytorch=1.9.0 cudatoolkit=11.1 -c pytorch -c nvidia
conda install numpy pandas matplotlib pyyaml ipywidgets
pip install torchinfo braindecode moabb mne

3. Directory structure

.
├── README.md
├── base
│   ├── constructor.py
│   └── layers.py
├── configs
│   ├── BCI2021
│   │   └── default.yaml
│   ├── DeepConvNet
│   │   └── default.yaml
│   ├── EEGNet
│   │   └── default.yaml
│   ├── FBCNet
│   │   └── default.yaml
│   ├── ShallowConvNet
│   │   └── default.yaml
│   └── demo
│       ├── arch.yaml
│       ├── bci2021.yaml
│       ├── test.yaml
│       ├── train.yaml
│       └── training_params.yaml
├── data_loader
│   ├── data_generator.py
│   ├── datasets
│   │   ├── __init__.py
│   │   ├── bnci2014.py
│   │   ├── cho2017.py
│   │   ├── folder_dataset.py
│   │   ├── openbmi.py
│   │   └── tmp_dataset.py
│   └── transforms.py
├── main.py
├── models
│   ├── BCI2021
│   │   ├── BCI2021.py
│   │   └── __init__.py
│   ├── DeepConvNet
│   │   ├── DeepConvNet.py
│   │   └── __init__.py
│   ├── EEGNet
│   │   ├── EEGNet.py
│   │   └── __init__.py
│   ├── FBCNet
│   │   ├── FBCNet.py
│   │   └── __init__.py
│   ├── ShallowConvNet
│   │   ├── ShallowConvNet.py
│   │   └── __init__.py
│   ├── __init__.py
│   └── model_builder.py
├── trainers
│   ├── __init__.py
│   ├── cls_trainer.py
│   └── trainer_maker.py
└── utils
    ├── calculator.py
    ├── painter.py
    └── utils.py

4. Dataset

5. Get Started

Create wandb_key.yaml file

  • Create wandb_key.yaml file in configs directory.
    # wandb_key.yaml
    key: WANDB API keys
  • WANDB API keys can be obtained from your W&B account settings.

train

Use W&B

python main.py --config_file=configs/demo/train.yaml

Not use W&B

python main.py --config_file=configs/demo/train.yaml --no_wandb

USE GPU

python main.py --config_file=configs/demo/train.yaml --device=0  # Use GPU 0
python main.py --config_file=configs/demo/train.yaml --device=1  # Use GPU 1
python main.py --config_file=configs/demo/train.yaml --device=2  # Use GPU 2
  • GPU numbers depend on your server.

USE Sweep

# W&B
sweep_file: configs/demo/training_params.yaml
project: Demo
tags: [train]
  • Add this block to config file for finding training parameters.
# W&B
sweep_file: configs/demo/arch.yaml
sweep_type: arch
project: Demo
tags: [train]
  • Add this block to config file for finding model architecture.

test

python main.py --config_file=configs/demo/test.yaml

5. References

bci-toolbox's People

Contributors

high-east avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.