Numpy, TensorFlow and PyTorch implementation of SMPL model. For C++ implementation (with PyTorch), please see this repo.
Important: I do not provide model file due to copyright reasons.
Now we have a faster PyTorch implementation, and we also support SMIL model. For more details, please check this PR.
The author-provided implementation was mainly based on chumpy in Python 2, which is kind of unpopular. Meanwhile, the official version cannot run on GPU. This project provides Numpy, TensorFlow and PyTorch implementation of SMPL model.
For more details about SMPL model, see SMPL.
Contributor: CalciferZh.
The numpy version is faster (since some computations were rewrote in a vectorized manner) and easier to understand (hope so), and the TensorFlow version can run on GPU.
Contributor: Lotayou and sebftw
The PyTorch version is derived from the Tensorflow version, and in addition supports batch processing and GPU training. The implementation is hosted in smpl_torch.py
along with the testing example.
The implementation is tested under Ubuntu 18.04, Python 3.6 and Pytorch 1.0.0 stable. The output is the same as the original Tensorflow implementation, as can be tested with test.py
.
SMIL_torch_batch.py
can be very fast, but limited by the memory. It also works with sparse tensors. (Saving a lot of said memory)
-
Download the model file here.
-
Run
python preprocess.py /PATH/TO/THE/DOWNLOADED/MODEL
to preprocess the official model.preprocess.py
will create a new filemodel.pkl
.smpl_np.py
andsmpl_tf.py
both rely onmodel.pkl
. NOTE: the official pickle model containschumpy
object, soprerocess.py
requireschumpy
to extract official model. You need to modify chumpy's cource code a little bit to make it compatible topreprocess.py
(and Python 3). Here is an instruction in Chinese about this. -
Run
python smpl_np.py
orpython smpl_tf.py
orpython smpl_torch.py
to see the example. Additionally, runpython smpl_torch_batch.py
for batched support.