Skip to content
forked from shihan-ma/BioMime

A deep latent generative model for learning biosystems.

Notifications You must be signed in to change notification settings

3kevin5/BioMime

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BioMime

Pytorch implementation and pretrained models for BioMime. For details, see Human Biophysics as Network Weights: Conditional Generative Models for Dynamic Simulation

Requirements

  • Operating System: Linux.
  • Python 3.7.11
  • PyTorch >= 1.6
  • torchvision >= 0.8.0
  • CUDA toolkit 10.1 or newer, cuDNN 7.6.3 or newer.

Conda environment

environment.yml contains all the dependencies required to run BioMime. Create the new environment by:

conda env create --file environment.yml

Data for training

Please contact neurodec for the dataset.

Pretrained models

Download model.pth and put them under ckp/.

Quick Start

Train

When you have your data ready, please follow the instructions below to train your own BioMime:

  1. Edit utils/data.py to specify the path for dataset.
  2. Configure the models and setting up in config/config.yaml.
  3. Run the training script by:
python scripts/train.py --exp=test

Define your own experiment id by changing the argument --exp.

Test

The checkpoints at snapshot epochs will be saved in res/exp/. You can test the model by:

python scripts/test.py --ckp_pth=./ckp/linear_anneal.pth --num_sample=32 --plot=1

Generate

You can generate your own MUAPs by sampling from the standard Normal Distribution:

python scripts/generate.py --cfg config.yaml --mode sample --model_pth ./ckp/model_linear.pth --res_path ./res

Or by morphing the existing MUAPs:

python generate.py --cfg config.yaml --mode morph --model_pth ./ckp/model_linear.pth --res_path ./res

Make sure you have the file containing MUAPs in the format of [num, nrow, ncol, ntime] and set the argument --data_path. Examples of MUAP files will be provided in the future.

We also allow users to generate dynamic MUAPs during a realistic forearm movement defined by a musculoskeletal model. This new function will be available soon.

Install BioMime as a python package

pip install git+https://github.com/shihan-ma/BioMime.git

Uninstall BioMime before updating it.

pip uninstall BioMime

Licenses

This repository is released under the GNU General Public License v3.0.

Citation

@article{ma2022human,
  title={Human Biophysics as Network Weights: Conditional Generative Models for Ultra-fast Simulation},
  author={Ma, Shihan and Clarke, Alexander Kenneth and Maksymenko, Kostiantyn and Deslauriers-Gauthier, Samuel and Sheng, Xinjun and Zhu, Xiangyang and Farina, Dario},
  journal={arXiv preprint arXiv:2211.01856},
  year={2022}
}

About

A deep latent generative model for learning biosystems.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%