Coder Social home page Coder Social logo

kritical007 / painattnnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zhenyuanlu/painattnnet

0.0 0.0 0.0 1.69 MB

Transformer Encoder with Multiscale Deep Learning for Pain Classification Using Physiological Signals

License: MIT License

Shell 0.92% Python 99.08%

painattnnet's Introduction

Transformer Encoder with Multiscale Deep Learning for Pain Classification Using Physiological Signals

Directory Structure

PainAttnNet
|   environment.yml # Requirements for conda environment
|   LICENSE
|   README.md
|   requirments.txt # Requirements for pip environment
|          
+---jq
|       jq-win64.exe
|       
\---src
    |   batch_train.sh # Training script
    |   config.json # Training configurations
    |   logger_config.json # Logger configurations
    |   parser.py # Parser for training configurations
    |   train_kfold_cv.py # Main training script
    |  __init__.py
    |   
    +---models
    |   |   main_painAttnNet.py # Main model wrapper
    |   |   module_mscn.py* # Multiscale convolutional network
    |   |   module_se_resnet.py # Squeeze-and-excitation residual network
    |   |   module_transformer_encoder.py # Transformer encoder block
    |   \   __init__.py
    |           
    +---tests # Unit tests
    |   |   test_generate_kfolds_index.py
    |   |   test_mscn.py
    |   |   test_PainAttnNet_output.py
    |   |   test_process_bioVid.py
    |   |   test_se_resnet.py
    |   |   test_transformer_encoder.py
    |   \   __init__.py
    |           
    +---trainers # Training modules
    |   |   checkpoint_handler.py # Checkpoint handler
    |   |   device_prep.py # Device preparation, CPU or GPU
    |   |   main_trainer.py # Main trainer scripts
    |   |   metrics_manager.py # Metrics manager and other metrics functions
    |   \   __init__.py
    |           
    \---utils
        |   process_bioVid.py # Data processing for BioVid
        |   utils.py # Other utility functions
        \   __init__.py

Get Started

torchaudio==0.13.0
python==3.10.8
pytorch-cuda==11.7
pytorch==1.13.0
torchvision==0.14.0
scikit-learn==1.0.1
pandas
matplotlib
openpyxl

For Linux users, install jq package via conda or pip.

For Windows users, install jq package from here, and put the jq.exe file in the local directory.

Training

Training k-fold cross validation with script

sh batch_train.sh

Training individual fold in terminal

python train_kfold_cv.py --fold_i {fold index}

You can change settings at main_painAttnNet.py for tuning model structure, config.py for training configurations and train_kfold_cv.py for others.

Dataset

The dataset is available at BioVid Heat Pain Database.

painattnnet's People

Contributors

zhenyuanlu avatar kritical007 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.