Notes on SMPLify-X

Windows环境下SMPLify-X的运行配置.

Run openpose

首先要使用OpenPose生成图像的关键点(keypoints)数据.

先进入Releases, 下载一个Windows Portable Demo, 如我下载的是openpose-1.7.0-binaries-win64-gpu-python3.7-flir-3d_recommended.zip, 解压后进入openpose文件夹

按照Instructions, 进入models文件夹, 运行getCOCO_and_MPII_optional.bat下载模型.

(在与models文件夹同级目录下) 创建新的文件夹my_test, 在里面放入想要生成关键点的图像, 如image.png.

命令行中运行以下代码, 详细参数见OpenPose Demo - Overview

1
2
3
4
5
6
bin\OpenPoseDemo.exe --image_dir my_test ^
--write_json output/ ^
--display 0 ^
--render_pose 0 ^
--face^
--hand

output文件夹中查看结果, 如image_keypoints.json.

Run smplify-x

克隆项目后进入smplify-x-master文件夹, (在与smplifyx文件夹同级目录下) 创建四个新文件夹:

  • data. 在data文件夹中创建子文件夹imageskeypoints分别存放OpenPose的输入图像和输出关键点.

  • output. 存放输出.

  • model. 到项目官网注册, 下载models_smplx_v1_1.zip, 解压后将smplx文件夹整个复制进model中.

  • vposer. 到项目官网注册, 下载vposer_v1_0.zip, 解压后将vposer_v1_0中的所有文件复制进vposer中.

使用以下两种方式中的任一种, 创建并进入一个新的Python环境

使用virtualenv创建, 其中smplify-x为该环境所在文件夹的名称, 其与其所在路径均可替换.

1
2
3
virtualenv -p python3.6 D:\python-envs\smplify-x  # 创建python3.6.8环境, 命名为smplify-x
cd D:\python-envs\smplify-x\Scripts\ # 进入activate脚本所在目录
.\activate # 激活环境

若要在激活环境后解除激活, 运行

1
deactivate

若要移除已创建的环境, 需先解除激活后, 运行

1
rmvirtualenv smplify-x

使用anaconda创建, 其中smplify-x可以替换为其他新环境名称, 详细可见Creating an environment with commands.

1
2
conda create --name smplify-x python=3.6  # 创建python3.6.8环境, 命名为smplify-x
conda activate smplify-x # 激活环境

若要在激活环境后解除激活, 运行

1
deactivate

若要移除已创建的环境, 需先解除激活后, 运行以下代码, 具体见Removing an environment.

1
conda remove --name smplify-x --all
1
pip install torch==1.1.0 -f https://download.pytorch.org/whl/torch_stable.html
  • Tensorflow 1.15.2
1
pip install tensorflow==1.15.2
  • Homogenus

在命令行中运行以下代码.

1
2
3
4
5
6
7
8
python smplifyx/main.py --config cfg_files/fit_smplx.yaml ^
--data_folder data ^
--output_folder output ^
--visualize=True ^
--model_folder model ^
--vposer_ckpt vposer ^
--part_segm_fn smplx_parts_segm.pkl ^
--interpenetration False

output文件夹中查看结果.

Error Shooting

Error Installing homogenus

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(base) C:\Users\Carlos>pip install git+https://github.com/nghorbani/homogenus
Collecting git+https://github.com/nghorbani/homogenus
Cloning https://github.com/nghorbani/homogenus to c:\users\carlos\appdata\local\temp\pip-req-build-gm0fqp6u
Running command git clone -q https://github.com/nghorbani/homogenus 'C:\Users\Carlos\AppData\Local\Temp\pip-req-build-gm0fqp6u'
ERROR: Command errored out with exit status 1:
command: 'D:\anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Carlos\\AppData\\Local\\Temp\\pip-req-build-gm0fqp6u\\setup.py'"'"'; __file__='"'"'C:\\Users\\Carlos\\AppData\\Local\\Temp\\pip-req-build-gm0fqp6u\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Carlos\AppData\Local\Temp\pip-pip-egg-info-17dqe7hw'
cwd: C:\Users\Carlos\AppData\Local\Temp\pip-req-build-gm0fqp6u\
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Carlos\AppData\Local\Temp\pip-req-build-gm0fqp6u\setup.py", line 34, in <module>
long_description=open("README.md").read(),
UnicodeDecodeError: 'gbk' codec can't decode byte 0x94 in position 754: illegal multibyte sequence
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Solution

下载homogenus-master.zip后运行

1
pip install homogenus-master.zip

Error Installing human_body_prior

1
2
3
4
(smplify-x) C:\Users\Carlos>pip install human_body_prior-master.zip
Processing c:\users\carlos\human_body_prior-master.zip
ERROR: Could not find a version that satisfies the requirement torch==1.1.0 (from human-body-prior)
ERROR: No matching distribution found for torch==1.1.0

Solution

1
pip install torch==1.1.0 -f https://download.pytorch.org/whl/torch_stable.html

Error Installing torch-mesh-isect (UNSOLVED)

1
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Solution 1 (UNVERIFIED)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
venv_dir=~/venvs/smplify-x
python3 -m venv $venv_dir
source ~/venvs/smplify-x/bin/activate
pip install -U pip
# pip install https://download.pytorch.org/whl/cu100/torch-1.1.0-cp36-cp36m-linux_x86_64.whl
pip install https://download.pytorch.org/whl/cu100/torch-1.1.0-cp36-cp36m-win_amd64.whl
pip install smplx
pip install human_body_prior
rm -fr homogenus
git clone https://github.com/nghorbani/homogenus.git
cd homogenus
python setup.py install
cd ..
rm torch-mesh-isect -fr
git clone https://github.com/vchoutas/torch-mesh-isect
cd torch-mesh-isect/
export CUDA_SAMPLES_INC=~/NVIDIA_CUDA-10.0_Samples/common/inc/
python setup.py install
pip install trimesh
pip install pyrender
pip install pyaml
pip install tqdm
pip install configargparse
pip install shapely

Solution 2

运行smplifyx/main.py时将interpenetration设置为False, 可以保证运行程序时不使用torch-mesh-isect.