From 075a46ad3b1347a0b99646fec68d4d0edec5a0de Mon Sep 17 00:00:00 2001 From: Junyi Date: Mon, 2 Aug 2021 14:46:13 +0800 Subject: [PATCH 1/2] update doc && add Dockerfile --- Dockerfile | 44 +++++++++++++++++++++++++++++ docs/INSTALL.md | 73 +++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 109 insertions(+), 8 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..89d01f8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,44 @@ +# Install ALL Modules without Pytorch3D +# CUDA 10.2, cuDNN 8 +# PyTorch 1.9.0, TorchVision 0.10.0 + +FROM nvidia/cuda:10.2-cudnn8-devel-ubuntu18.04 + +ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 +ENV PATH=${PATH}:/usr/local/cuda/bin +ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64 + + +WORKDIR /root + +# ninja-build is required by `detectron` +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates grep sed dpkg\ + git vim curl wget sudo\ + python3 python3-dev python3-setuptools python3-pip ninja-build\ + gcc-8 g++-8 cmake build-essential \ + ffmpeg libosmesa6-dev libglu1-mesa libxi-dev libxmu-dev libglu1-mesa-dev freeglut3-dev xvfb && \ + rm /usr/bin/python; ln -s /usr/bin/python3 /usr/bin/python + +RUN git clone https://github.com/facebookresearch/frankmocap.git /root/frankmocap + +WORKDIR /root/frankmocap + +RUN python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple torch==1.9.0 torchvision==0.10.0 scikit-build torchgeometry +RUN python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r ./docs/requirements.txt +RUN python -m pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.9/index.html + +RUN sh ./scripts/install_frankmocap.sh && \ + sh ./scripts/install_pose2d.sh && \ + sh scripts/download_data_body_module.sh && \ + sh scripts/download_data_hand_module.sh + +CMD [ "/bin/bash" ] + +# Docker image build finished +# Type the following command to enter the docker env: +# ``` +# docker run -it --rm --gpus all frankmocap:latest +# ``` + diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 22cd56e..caf0125 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -1,5 +1,7 @@ # Installation + + ## Installing All Modules - The entire modules can be installed following the instruction below. @@ -9,17 +11,17 @@ ``` conda create -n venv_frankmocap python=3.7 conda activate venv_frankmocap - + # Install ffmpeg - sudo apt-get install ffmpeg libosmesa6-dev - + sudo apt-get install ffmpeg libosmesa6-dev libglu1-mesa libxi-dev libxmu-dev libglu1-mesa-dev freeglut3-dev + # Install cuda # Choose versions based on your system. For example: # conda install cudatoolkit=10.1 cudnn=7.6.0 - + # Install pytorch and torchvision conda install -c pytorch pytorch==1.6.0 torchvision cudatoolkit=10.1 - + # Install other required libraries pip install -r docs/requirements.txt ``` @@ -91,14 +93,14 @@ ``` conda create -n venv_frankmocap python=3.7 conda activate venv_frankmocap - + # Install cuda # Choose versions based on your system. For example: # conda install cudatoolkit=10.1 cudnn=7.6.0 - + # Install pytorch and torchvision conda install -c pytorch pytorch==1.6.0 torchvision cudatoolkit=10.1 - + # Install other required libraries pip install -r docs/requirements.txt ``` @@ -126,3 +128,58 @@ ``` - Setting SMPL/SMPL-X Models - You only need SMPL model. See above + + + +## Installing with Docker + +You need to build your own docker image, since the size of the image is about 11GiB. (too large to download) + +- Prerequisites + - [NVIDIA Docker](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker) + +- The basic steps + + ```bash  + # clone the repo + git clone https://github.com/facebookresearch/frankmocap.git + cd frankmocap + + # build docker image + docker build -t frankmocap . + + # wait docker to finish + + # (base) junyi@ubuntu:~/docker$ docker build -t frankmocap . + # Sending build context to Docker daemon 75.4MB + # Step 1/13 : FROM nvidia/cuda:10.2-cudnn8-devel-ubuntu18.04 + # Step 2/13 : ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 + # Step 3/13 : ENV PATH=${PATH}:/usr/local/cuda/bin + # Step 4/13 : ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64 + # Step 5/13 : WORKDIR /root + # Step 6/13 : RUN apt-get update && .... + # Get:3 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB] + # Get:4 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB] + # ... + # ... + # Step 13/13 : CMD [ "/bin/bash" ] + # Successfully built eeb0a77f487f + # Successfully tagged frankmocap:latest + + # run a docker container + docker run -it --gpus all frankmocap:latest /bin/bash + # root@09b5e84241a8:~/frankmocap# + + # Then, put your SMPL models into ./extra_data/smpl + # For example, you can use 'scp' to transfer files or 'docker volumes' to mapping. + ``` + +- Run body motion capture (See README.md) + + ```bash + # screenless mode (e.g., a remote server) + xvfb-run -a python -m demo.demo_bodymocap --input_path ./sample_data/han_short.mp4 --out_dir ./mocap_output + ``` + + + From d97c08d4b1354a87728cac1e3fe220b39e5ed2a4 Mon Sep 17 00:00:00 2001 From: Junyi Date: Mon, 2 Aug 2021 15:04:14 +0800 Subject: [PATCH 2/2] update doc --- docs/INSTALL.md | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index caf0125..5cffbda 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -166,7 +166,7 @@ You need to build your own docker image, since the size of the image is about 11 # Successfully built eeb0a77f487f # Successfully tagged frankmocap:latest - # run a docker container + # run a docker container (-it means create an interactive tty) docker run -it --gpus all frankmocap:latest /bin/bash # root@09b5e84241a8:~/frankmocap# @@ -174,12 +174,27 @@ You need to build your own docker image, since the size of the image is about 11 # For example, you can use 'scp' to transfer files or 'docker volumes' to mapping. ``` -- Run body motion capture (See README.md) +- Optional (for users who want to copy SMPL model into container) ```bash - # screenless mode (e.g., a remote server) - xvfb-run -a python -m demo.demo_bodymocap --input_path ./sample_data/han_short.mp4 --out_dir ./mocap_output + # make sure that you are in the container env + apt-get update && apt-get install openssh-client + mkdir ./extra_data/smpl + + # TL;DR, the basic scp usage: + # scp + # scp username@host:path target_path + scp junyi@192.168.1.2:/home/junyi/SMPLX_NEUTRAL.pkl ./extra_data/smpl/SMPLX_NEUTRAL.pkl + scp junyi@192.168.1.2:/home/junyi/basicmodel_neutral_lbs_10_207_0_v1.1.0.pkl ./extra_data/smpl/basicModel_neutral_lbs_10_207_0_v1.0.0.pkl + + # Your are all set! ``` +- Run body motion capture + ```bash + # screenless mode (e.g., a remote server) + xvfb-run -a python -m demo.demo_bodymocap --input_path ./sample_data/han_short.mp4 --out_dir ./mocap_output + ``` +