/SMPL-Estimators

This repository contains the code for SMPL body estimators for the COCO and AMASS 3D keypoint body structures.

Primary LanguagePython

Getting started

This code has been assembled from the following 3 repositories:

  1. COCO to SMPL Estimator: https://github.com/google/aistplusplus_api
  2. Visualize 3D Keypoints: https://github.com/Daniil-Osokin/lightweight-human-pose-estimation-3d-demo.pytorch
  3. SMPL-to-FBX: https://github.com/softcat477/SMPL-to-FBX.git

The code has been tested on Ubuntu 20.04 and requires:

  1. Python 3.7
  2. Conda
  3. CUDA capable GPU

Setup for keypoints visualizer

Set up the Anaconda environment:

conda create -n VisDemo python=3.7
conda activate VisDemo
setup_visualizer.sh

Visualize 3D Keypoints

cd lightweight-human-pose-estimation-3d-demo.pytorch 
python plot_AIST_Keypoints.py --joints ../aist_sample.npy

COCO 3D Body Keypoints to SMPL Estimation

conda create -n COCO_Estimator python=3.7
conda activate COCO_Estimator
setup_coco.sh

Further steps:

  1. Download SMPL body model: https://download.is.tue.mpg.de/download.php?domain=smpl&sfile=SMPL_python_v.1.0.0.zip and place the "m" body as SMPL_MALE.pkl in COCO_to_SMPL_Estimation/smpl_body/
  2. Replace aist_plusplus_api-1.1.0-py3.7.egg in the created Anaconda env in site-packages/ with the one provided in this repository
  3. Place the aist_sample.pkl in the COCO_to_SMPL_Estimation/keypoints_dir/keypoints3d

Command to estimate:

python processing/run_estimate_smpl.py --anno_dir ./keypoints_dir/ --smpl_dir ./smpl_body/ --save_dir ./keypoints_dir/motions/ --data_type internal

SMPL Motion to FBX

conda create -n FBX python=3.7
conda activate FBX
setup_fbx.sh

Setting up Python FBX:

  1. Download Python FBX SDK: https://www.autodesk.com/developer-network/platform-technologies/fbx-sdk-2020-3
  2. Extract from the folder
  3. Run and extract the FBX files into your directory (Eg. MY_FBX_FILES)
  4. Copy the files to site-packages of the conda env

Further steps:

  1. Download the SMPL fbx model for Unity from: https://smpl.is.tue.mpg.de/
  2. Place inside SMPL-to-FBX

Run code:

python3 Convert.py --input_pkl_base Pkls/aist_downsampled.pkl --fbx_source_path ./SMPL_m_unityDoubleBlends_lbs_10_scale5_207_v1.0.0.fbx --output_base ./