GithubHelp home page GithubHelp logo

rmutegeki / deephar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nhammerla/deephar

0.0 1.0 0.0 101 KB

Code repository for experiments on deep architecture for HAR in ubicomp

License: BSD 2-Clause "Simplified" License

Lua 92.90% Python 7.10%

deephar's Introduction

deepHAR

Code repository for experiments on deep architectures for HAR in ubicomp. Using this code you will be able to replicate some of the experiments described in our IJCAI 2016 paper:

@article{hammerla2016deep,
  title={Deep, convolutional, and recurrent models for human activity recognition using wearables},
  author={Hammerla, Nils Y and Halloran, Shane and Ploetz, Thomas},
  journal={IJCAI 2016},
  year={2016}
}

Disclaimer

This code is still incomplete. At the moment only the bi-directional RNN will work on the opportunity data-set.

Installation

git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; bash install-deps;
./install.sh

# after installation, we need some additional packages
#HDF5 luarock
sudo apt-get install libhdf5-serial-dev hdf5-tools
git clone https://github.com/deepmind/torch-hdf5
cd torch-hdf5
luarocks make hdf5-0-0.rockspec LIBHDF5_LIBDIR="/usr/lib/x86_64-linux-gnu/"

# json
luarocks install json

# RNN support
luarocks install torch
luarocks install nn
luarocks install dpnn
luarocks install torchx
luarocks install rnn

# we use python3
pip3 install h5py
pip3 install simplejson
pip3 install numpy

Usage

First download and extract the Opportunity dataset. Then use the provided python script in the data directory to prepare the training/validation/test sets.

cd data
python3 data_reader.py opportunity /path/to/OpportunityUCIDataset

This will generate two hdf5-files that are read by the lua scripts, opportunity.h5 and opportunity.h5.classes.json.

To train the bi-directional RNN that we have found to work best on this set run the following commands:

cd models/RNN
th main_brnn.lua -data ../../data/opportunity.h5 -cpu \
                 -layerSize 179 -maxInNorm 2.283772707 \
                 -learningRate 0.02516758 -sequenceLength 81 \
                 -carryOverProb 0.915735543 -numLayers 1 \
                 -logdir EXP_brnn

This will train a model only using your CPUs, which will take a while (make sure you have some form of BLAS library installed). On my laptop this will take approx. 5 min per epoch, and it will likely not converge before epoch 60. If your environment is set up for gpu-based computation, try using -gpu 1 instead of the -cpu flag for a significant speedup.

Other models

The python-based data_reader.py is new and substitutes for the original but unmaintainable Matlab-scripts used previously. So far it only supports opportunity and sample-based evaluation, which will be addressed shortly.

deephar's People

Contributors

nhammerla avatar shaneh2 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.