Skip to content

TensorFlow implementation of SMPL (A Skinned Multi-Person Linear Model)

Notifications You must be signed in to change notification settings

opendeeple/tf-smpl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TensorFlow implementation of SMPL (A Skinned Multi-Person Linear Model)

This repository contains the code to easy use SMPL with TensorFlow.

Installation

$ pip install git+https://github.com/opendeeple/tf-smpl.git

Download SMPL model

  • Sign in into https://smpl.is.tue.mpg.de
  • Download SMPL version 1.0.0 for Python 2.7 (10 shape PCs)
  • Extract SMPL_python_v.1.0.0.zip

Run

$ smpl --config configs/example.conf --motion motions\*.npz

Usage

import tensorflow as tf
from tf_smpl import SMPL

smpl = SMPL("<smpl_model_extraced_folder>/basicModel_f_lbs_10_207_0_v1.0.0.pkl")
# calculate SMPL vertices
batch_size = 16
v_body = smpl(
  shapes=tf.zeros(shape=[batch_size, 10]), # sample shapes (betas)
  poses=tf.zeros(shape=[batch_size, 72]), # sample poses
  trans=tf.zeros(shape=[batch_size, 3]) # sample trans
)
# calculate SMPL vertices for sequences
sequence_size = 3
v_body = smpl(
  shapes=tf.zeros(shape=[batch_size, sequence_size, 10]), # sample shapes (betas)
  poses=tf.zeros(shape=[batch_size, sequence_size, 72]), # sample poses
  trans=tf.zeros(shape=[batch_size, sequence_size, 3]) # sample trans
)

Calculate SMPL vertices with get middle variables

List of midle variables

  • v_shaped
  • v_posed
  • J_rotations
  • J_locations
  • J_transforms
v_body, body_dict = smpl(
  ...,
  includes=["v_shaped", "J_locations"] # for get middle variables
)
print(body_dict) # display body_dict:middle variables

Calculate SMPL normals

v_normals = smpl.normals(v_body)

Calculate neighbours of SMPL with Outfit

neighbours = smpl.neighbours(v_body, v_outfit)

About

TensorFlow implementation of SMPL (A Skinned Multi-Person Linear Model)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages