Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 34 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,55 @@ Please see <http://zju-capg.org/myo> for details.
* [Docker](http://docker.io/)
* [Nvidia Docker](https://github.com/NVIDIA/nvidia-docker)

## Usage
## Quick Usage

Following commands will
(1) pull docker image (see `docker/Dockerfile` for details);
(2) train ConvNets on the training sets of NinaPro DB1, CapgMyo DB-a and CSL-HDEMG, respectively;
and (3) test trained ConvNets on the test sets.

Navigate to the downloaded version of this repo then run the following commands to use images from Docker Hub
```
mkdir .cache
# put NinaPro DB1 in .cache/ninapro-db1
# put CapgMyo DB-a in .cache/dba
# put CSL-HDEMG in .cache/csl
docker pull answeror/sigr:2016-09-21
scripts/trainsrep.sh
scripts/testsrep.sh
docker pull lif3line/sigr:latest
sudo scripts/trainsrep.sh
sudo scripts/testsrep.sh
```

## Building from Source

Alternatively you can rebuild the images from the dockerfiles in this repo:
```
mkdir .cache
# put NinaPro DB1 in .cache/ninapro-db1
# put CapgMyo DB-a in .cache/dba
# put CSL-HDEMG in .cache/csl
cd docker/mxnet
sudo docker build .
# Note #ID of image on completion
cd ..
```
Edit the `Dockerfile` in this directory replacing `FROM lif3line/mxnet:latest` with `FROM #ID:latest`
```
sudo docker build .
# Note #ID of this new image
cd ..
cd scripts
```
Edit `runsrep` replacing `lif3line/sigr:latest` with `#ID:latest`
```
cd ..
sudo scripts/trainsrep.sh
sudo scripts/testsrep.sh
```

## Notes
Training on NinaPro and CapgMyo will take 1 to 2 hours depending on your GPU.
Training on CSL-HDEMG will take several days.
You can accelerate traning and testing by distribute different folds on different GPUs with the `gpu` parameter.
You can accelerate training and testing by distribute different folds on different GPUs with the `gpu` parameter.

The NinaPro DB1 should be segmented according to the gesture labels and stored in Matlab format as follows.
`.cache/ninapro-db1/data/sss/ggg/sss_ggg_ttt.mat` contains a field `data` (frames x channels) represents the trial `ttt` of gesture `ggg` of subject `sss`.
Expand Down
7 changes: 6 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM answeror/mxnet:f2684a6
# Self Made mxnet docker container
FROM lif3line/mxnet:latest
MAINTAINER answeror <[email protected]>

RUN apt-get install -y python-pip python-scipy
Expand Down Expand Up @@ -27,6 +28,10 @@ RUN cd /mxnet && \
make clean && \
make -j8 ADD_LDFLAGS=-L/usr/local/cuda/lib64/stubs

# Necessary for newer modules
RUN pip install --upgrade setuptools pip
# Hack to avoid needing python 2.7.9 security features
RUN pip install tornado==4.0
RUN pip install jupyter pandas matplotlib seaborn scikit-learn
RUN mkdir -p -m 700 /root/.jupyter/ && \
echo "c.NotebookApp.ip = '*'" >> /root/.jupyter/jupyter_notebook_config.py
Expand Down
7 changes: 5 additions & 2 deletions docker/mxnet/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM nvidia/cuda:7.5-cudnn5-devel
# Use CUDA 8.0 to avoid issue on newer GPUs
FROM nvidia/cuda:8.0-cudnn5-devel-ubuntu14.04
MAINTAINER answeror <[email protected]>

RUN echo "deb http://mirrors.zju.edu.cn/ubuntu/ trusty main restricted universe multiverse" > /etc/apt/sources.list && \
Expand All @@ -23,7 +24,9 @@ RUN apt-get update && apt-get install -y \
wget \
unzip
RUN git clone --recursive https://github.com/dmlc/mxnet/ && cd mxnet && \
git checkout f2684a6 && \
git checkout 25720d0 && \
git submodule update --init && \
git submodule update --recursive && \
sed -i -e 's/CHECK(ksize_x <= dshape\[3\] && ksize_y <= dshape\[2\])/CHECK(ksize_x <= dshape[3] + 2 * param_.pad[1] \&\& ksize_y <= dshape[2] + 2 * param_.pad[0])/' src/operator/convolution-inl.h && \
cp make/config.mk . && \
echo "USE_CUDA=1" >>config.mk && \
Expand Down
2 changes: 1 addition & 1 deletion scripts/runsrep
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

nvidia-docker run -ti -v $(pwd):/code answeror/sigr:2016-09-21 $@
nvidia-docker run -ti -v $(pwd):/code lif3line/sigr:latest $@