Giter Club home page Giter Club logo

fairseq-signals's Introduction

Fairseq-signals

Fairseq-signals is a collection of deep learning models for ECG data processing based on the fairseq.

We provide implementations of various deep learning methods on ECG data, including official implementations of our works.

Implemented Paper:

Requirements and Installation

  • PyTorch version == 1.13.1+cu117
  • Python version == 3.9
  • For training new models, you'll also need an NVIDIA GPU and NCCL
  • To install fairseq-signals from source and develop locally:
git clone https://github.com/Jwoo5/fairseq-signals
cd fairseq-signals
pip install --editable ./
pip install scikit-learn transformers
  • To preprocess ECG datasets: pip install scipy wfdb
  • To build cython components: python setup.py build_ext --inplace
  • For large datasets install PyArrow: pip install pyarrow

Getting Started

For uni-modal tasks (ECG Classification, ...)

Prepare ECG dataset

We provide pre-processing codes for various ECG datasets.

- physionet_org
      |===> training
               |----> chapman_shaoxing		
               |----> cpsc_2018		
               |----> cpsc_2018_extra		
               |----> georgia		
               |----> ningbo		
               |----> ptb		
               |----> ptb-xl		
               |----> st_petersburg_incart
      |===> dx_mapping_scored.csv
      |===> dx_mapping_unscored.csv
      |===> evaluate_model.m
      |===> evaluate_model.py
      |===> helper_code.py
      |===> weights.csv
      |===> weights_abbreviations.csv

Pre-process

Given a directory that contains WFDB directories to be pre-processed for PhysioNet2021:

$ python fairseq_signals/data/ecg/preprocess/preprocess_physionet2021.py \
    /path/to/physionet2021/ \
    --dest /path/to/output \
    --workers $N

Prepare data manifest

Given a directory that contains pre-processed data:

$ python fairseq_signals/data/ecg/preprocess/manifest.py \
    /path/to/data/ \
    --dest /path/to/manifest \
    --pretrain-valid-percent $valid

Prepare training data manifest

Before training, you should prepare training data manifest required for training CLOCS model.

$ python /path/to/fairseq_signals/data/ecg/preprocess/convert_to_clocs_manifest.py \
    /path/to/pretrain/train.tsv \
    --dest /path/to/manifest

The expected results are like:

/path/to/manifest
├─ cmsc
│  └─ train.tsv
├─ cmlc
│  └─ train.tsv
└─ cmsmlc
   └─ train.tsv

Pre-training a new model

This configuration was used for the W2V+CMSC+RLM model pre-trained on the PhysioNet2021 dataset in the original paper.

$ fairseq-hydra-train \
    task.data=/path/to/manifest/cmsc \ #Absolute path in windows
    --config-dir examples/w2v_cmsc/config/pretraining \
    --config-name w2v_cmsc_rlm

fairseq-signals's People

Contributors

jwoo5 avatar hungrygeek16 avatar gustmd0121 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.