Installation

  • Requirements

  • A from-scratch setup script

  • Prepare environment

  • Run with docker image

  • Test environment

  • Frequently Asked Questions

Requirements

  • Linux

  • ffmpeg

  • Python 3.7+

  • PyTorch 1.6.0, 1.7.0, 1.7.1, 1.8.0, 1.8.1, 1.9.0 or 1.9.1.

  • CUDA 9.2+

  • GCC 5+

  • XRPrimer

  • MMHuman3D

  • MMCV

Optional:

Name When it is required What's important
MMPose Keypoints 2D estimation. Install mmcv-full, instead of mmcv.
MMDetection Bbox 2D estimation. Install mmcv-full, instead of mmcv.
MMTracking Multiple object tracking. Install mmcv-full, instead of mmcv.
Aniposelib Triangulation. Install from github, instead of pypi.

A from-scratch setup script

conda create -n xrmocap python=3.8
source activate xrmocap

# install ffmpeg for video and images
conda install -y ffmpeg

# install pytorch
conda install -y pytorch==1.8.1 torchvision==0.9.1 cudatoolkit=10.1 -c pytorch

# install pytorch3d
conda install -y -c fvcore -c iopath -c conda-forge fvcore iopath
conda install -y -c bottler nvidiacub
conda install -y pytorch3d -c pytorch3d

# install mmcv-full
pip install mmcv-full==1.5.3 -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.8.1/index.html

# install xrprimer
pip install xrprimer

# clone xrmocap
git clone https://github.com/openxrlab/xrmocap.git
cd xrmocap

# install requirements for build
pip install -r requirements/build.txt
# install requirements for runtime
pip install -r requirements/runtime.txt

# install xrmocap
rm -rf .eggs && pip install -e .

Prepare environment

Here are advanced instructions for environment setup. If you have run A from-scratch setup script successfully, please skip this.

a. Create a conda virtual environment and activate it.

conda create -n xrmocap python=3.8 -y
conda activate xrmocap

b. Install MMHuman3D.

Here we take torch_version=1.8.1 and cu_version=10.2 as example. For other versions, please follow the official instructions

# install ffmpeg from main channel
conda install ffmpeg
# install pytorch
conda install -y pytorch==1.8.1 torchvision==0.9.1 cudatoolkit=10.2 -c pytorch
# install pytorch3d
conda install -c fvcore -c iopath -c conda-forge fvcore iopath -y
conda install -c bottler nvidiacub -y
conda install pytorch3d -c pytorch3d
# install mmcv-full for human_perception
pip install mmcv-full==1.5.3 -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.1/index.html
# install mmhuman3d
pip install git+https://github.com/open-mmlab/mmhuman3d.git

Note1: Make sure that your compilation CUDA version and runtime CUDA version match.

Note2: The package mmcv-full(gpu) is essential if you are going to use human_perception modules.

Note3: Do not install optional requirements of mmhuman3d in this step.

c. Install XRPrimer.

pip install xrprimer

If you want to edit xrprimer, please follow the official instructions to install it from source.

d. Install XRMoCap to virtual environment, in editable mode.

git clone https://github.com/openxrlab/xrmocap.git
cd xrmocap
pip install -r requirements/build.txt
pip install -r requirements/runtime.txt
pip install -e .

e. Run unittests or demos

If everything goes well, try to run unittest or go back to run demos

Run with Docker Image

We provide a Dockerfile to build an image. Ensure that you are using docker version >=19.03 and "default-runtime": "nvidia" in daemon.json.

# build an image with PyTorch 1.8.1, CUDA 10.2
docker build -t xrmocap .

Run it with

docker run --gpus all --shm-size=8g -it -v {DATA_DIR}:/xrmocap/data xrmocap

Or pull a built image from docker hub.

docker pull openxrlab/xrmocap_runtime
docker run --gpus all --shm-size=8g -it -v {DATA_DIR}:/xrmocap/data openxrlab/xrmocap_runtime

Test environment

To test whether the environment is well installed, please refer to test doc.

Frequently Asked Questions

If your environment fails, check our FAQ first, it might be helpful to some typical questions.