/pytorch-hdf5-example

Very Simple Data Loading Example using HDF5 (h5py) for Pytorch

Primary LanguagePython

pytorch-hdf5-example

Very Simple Data Loading Example using HDF5 (h5py) for Pytorch.

Tested on Ubuntu 18.04 with Python 3.8 and Pytorch 1.7

0. Prepare Environment

Clone this repository, and you may create a separate conda environment using the provided environment.yml file:

conda env create --file environment.yml
conda activate pytorch-ex

0. Prepare Dataset

In this tutorial, we use dataset from the paper Ingraham et al. (2019). Please download the dataset first from here, and store at any location you want to. You may download a subset (e.g., a single MAT file) for now.

1. Generate HDF5 Dataset File

python 1_generate_h5.py

See 1_generate_h5.py for details, e.g., path setup.

2. Build Index File

python 2_build_index.py

See 2_build_index.py for details, e.g., path setup.

3. Train a (stupid) Model

python 3_train_model.py

See 3_train_model.py for details, e.g., path setup, we use argparse for this file.

References

(Ingraham et al., 2019) Ingraham, Kimberly A., Daniel P. Ferris, and C. David Remy. "Evaluating physiological signal salience for estimating metabolic energy cost from wearable sensors." Journal of Applied Physiology 126.3 (2019): 717-729.