diff --git a/README.md b/README.md index 46365b7..672d251 100644 --- a/README.md +++ b/README.md @@ -12,26 +12,55 @@ Please see 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`. diff --git a/docker/Dockerfile b/docker/Dockerfile index a067549..6b8b30a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,5 @@ -FROM answeror/mxnet:f2684a6 +# Self Made mxnet docker container +FROM lif3line/mxnet:latest MAINTAINER answeror RUN apt-get install -y python-pip python-scipy @@ -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 diff --git a/docker/mxnet/Dockerfile b/docker/mxnet/Dockerfile index 1b1f4c9..7112f1a 100644 --- a/docker/mxnet/Dockerfile +++ b/docker/mxnet/Dockerfile @@ -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 RUN echo "deb http://mirrors.zju.edu.cn/ubuntu/ trusty main restricted universe multiverse" > /etc/apt/sources.list && \ @@ -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 && \ diff --git a/scripts/runsrep b/scripts/runsrep index 736b0d5..df52f4b 100755 --- a/scripts/runsrep +++ b/scripts/runsrep @@ -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 $@