Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Add Dockerfile and fix #144 #146

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
44 changes: 44 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
# ```

88 changes: 80 additions & 8 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Installation



## Installing All Modules

- The entire modules can be installed following the instruction below.
Expand All @@ -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
```
Expand Down Expand Up @@ -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
```
Expand Down Expand Up @@ -126,3 +128,73 @@
```
- 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 (-it means create an interactive tty)
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.
```

- Optional (for users who want to copy SMPL model into container)

```bash
# 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 <copy from> <copy to>
# 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
```