Skip to content

Commit b2bb0c2

Browse files
committed
initial commit
0 parents  commit b2bb0c2

31 files changed

+916
-0
lines changed

LICENSE

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
License
2+
3+
Software Copyright License for non-commercial scientific research purposes
4+
Please read carefully the following terms and conditions and any accompanying documentation before you download and/or use the SMPL-X/SMPLify-X model, data and software, (the "Model & Software"), including 3D meshes, blend weights, blend shapes, textures, software, scripts, and animations. By downloading and/or using the Model & Software (including downloading, cloning, installing, and any other use of this github repository), you acknowledge that you have read these terms and conditions, understand them, and agree to be bound by them. If you do not agree with these terms and conditions, you must not download and/or use the Model & Software. Any infringement of the terms of this agreement will automatically terminate your rights under this License
5+
6+
Ownership / Licensees
7+
The Software and the associated materials has been developed at the
8+
9+
Max Planck Institute for Intelligent Systems (hereinafter "MPI").
10+
11+
Any copyright or patent right is owned by and proprietary material of the
12+
13+
Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (hereinafter “MPG”; MPI and MPG hereinafter collectively “Max-Planck”)
14+
15+
hereinafter the “Licensor”.
16+
17+
License Grant
18+
Licensor grants you (Licensee) personally a single-user, non-exclusive, non-transferable, free of charge right:
19+
20+
To install the Model & Software on computers owned, leased or otherwise controlled by you and/or your organization;
21+
To use the Model & Software for the sole purpose of performing non-commercial scientific research, non-commercial education, or non-commercial artistic projects;
22+
Any other use, in particular any use for commercial purposes, is prohibited. This includes, without limitation, incorporation in a commercial product, use in a commercial service, or production of other artifacts for commercial purposes. The Model & Software may not be reproduced, modified and/or made available in any form to any third party without Max-Planck’s prior written permission.
23+
24+
The Model & Software may not be used for pornographic purposes or to generate pornographic material whether commercial or not. This license also prohibits the use of the Model & Software to train methods/algorithms/neural networks/etc. for commercial use of any kind. By downloading the Model & Software, you agree not to reverse engineer it.
25+
26+
No Distribution
27+
The Model & Software and the license herein granted shall not be copied, shared, distributed, re-sold, offered for re-sale, transferred or sub-licensed in whole or in part except that you may make one copy for archive purposes only.
28+
29+
Disclaimer of Representations and Warranties
30+
You expressly acknowledge and agree that the Model & Software results from basic research, is provided “AS IS”, may contain errors, and that any use of the Model & Software is at your sole risk. LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE MODEL & SOFTWARE, NEITHER EXPRESS NOR IMPLIED, AND THE ABSENCE OF ANY LEGAL OR ACTUAL DEFECTS, WHETHER DISCOVERABLE OR NOT. Specifically, and not to limit the foregoing, licensor makes no representations or warranties (i) regarding the merchantability or fitness for a particular purpose of the Model & Software, (ii) that the use of the Model & Software will not infringe any patents, copyrights or other intellectual property rights of a third party, and (iii) that the use of the Model & Software will not cause any damage of any kind to you or a third party.
31+
32+
Limitation of Liability
33+
Because this Model & Software License Agreement qualifies as a donation, according to Section 521 of the German Civil Code (Bürgerliches Gesetzbuch – BGB) Licensor as a donor is liable for intent and gross negligence only. If the Licensor fraudulently conceals a legal or material defect, they are obliged to compensate the Licensee for the resulting damage.
34+
Licensor shall be liable for loss of data only up to the amount of typical recovery costs which would have arisen had proper and regular data backup measures been taken. For the avoidance of doubt Licensor shall be liable in accordance with the German Product Liability Act in the event of product liability. The foregoing applies also to Licensor’s legal representatives or assistants in performance. Any further liability shall be excluded.
35+
Patent claims generated through the usage of the Model & Software cannot be directed towards the copyright holders.
36+
The Model & Software is provided in the state of development the licensor defines. If modified or extended by Licensee, the Licensor makes no claims about the fitness of the Model & Software and is not responsible for any problems such modifications cause.
37+
38+
No Maintenance Services
39+
You understand and agree that Licensor is under no obligation to provide either maintenance services, update services, notices of latent defects, or corrections of defects with regard to the Model & Software. Licensor nevertheless reserves the right to update, modify, or discontinue the Model & Software at any time.
40+
41+
Defects of the Model & Software must be notified in writing to the Licensor with a comprehensible description of the error symptoms. The notification of the defect should enable the reproduction of the error. The Licensee is encouraged to communicate any use, results, modification or publication.
42+
43+
Publications using the Model & Software
44+
You acknowledge that the Model & Software is a valuable scientific resource and agree to appropriately reference the following paper in any publication making use of the Model & Software.
45+
46+
Citation:
47+
48+
49+
@inproceedings{STAR:ECCV:2020,
50+
title = {STAR: Sparse Trained Articulated Human Body Regressor},
51+
author = {Ahmed A. A. Osman, Timo Bolkart, Michael J. Black},
52+
booktitle = {European Conference on Computer Vision (ECCV) },
53+
month = aug,
54+
year = {2020},
55+
month_numeric = {8}
56+
}
57+
58+
Commercial licensing opportunities
59+
For commercial uses of the Software, please send email to ps-license@tue.mpg.de
60+
61+
This Agreement shall be governed by the laws of the Federal Republic of Germany except for the UN Sales Convention.

README.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
## STAR: Sparse Trained Articulated Human Body Regressor
2+
3+
<!-- TODO: Replace with our arxiv link -->
4+
<!-- [![report](https://img.shields.io/badge/arxiv-report-red)](https://arxiv.org/abs/1912.05656) -->
5+
6+
[[Project Page](https://star.is.tue.mpg.de/)]
7+
[[Paper](https://ps.is.tuebingen.mpg.de/uploads_file/attachment/attachment/618/star_paper.pdf)]
8+
[[Supp. Mat.](https://ps.is.tuebingen.mpg.de/uploads_file/attachment/attachment/619/star_supmat.pdf)]
9+
10+
<p align="center">
11+
<img src="./images/main_teaser.png" />
12+
</p>
13+
14+
15+
## Table of Contents
16+
* [License](#license)
17+
* [Description](#description)
18+
* [Content](#content)
19+
* [Dependencies](#dependencies)
20+
* [SMPL Comparison](#SMPLComparison)
21+
* [Profiling](#Profiling)
22+
* [Citation](#citation)
23+
* [Acknowledgments](#acknowledgments)
24+
* [Contact](#contact)
25+
26+
27+
## License
28+
29+
Software Copyright License for non-commercial scientific research purposes.
30+
Please read carefully the following terms and conditions and any accompanying
31+
documentation before you download and/or use the ExPose data, model and
32+
software, (the "Data & Software"), including 3D meshes, images, videos,
33+
textures, software, scripts, and animations. By downloading and/or using the
34+
Data & Software (including downloading, cloning, installing, and any other use
35+
of the corresponding github repository), you acknowledge that you have read
36+
these terms and conditions, understand them, and agree to be bound by them. If
37+
you do not agree with these terms and conditions, you must not download and/or
38+
use the Data & Software. Any infringement of the terms of this agreement will
39+
automatically terminate your rights under this License
40+
41+
42+
## Description
43+
44+
STAR - **S**parse **T**rained **A**rticulated Human Body **R**egressor is a generateive 3D human body model, that is designed to be a drop in replacement to the widely used SMPL model.
45+
STAR trained on largest dataset of more than 10,000 human body scans, with a learned set of sparse spatially local pose corrective
46+
blend shapes. In the Figure below, a single joint movement only influence a sparse set of the model vertices. The mesh vertices in
47+
gray are not affected by the joint movement, in contrast to SMPL. <br/>
48+
STAR is publicly avaiable with the full 300 principal component
49+
shape space for research purposes from our [website][https://star.is.tue.mpg.de/]
50+
51+
<p align="center">
52+
<img src="./images/sparse_pose_correctives.png" />
53+
</p>
54+
55+
56+
For more details, please see our ECCV paper
57+
[STAR: Sparse Trained Articulated Human Body Regressor](https://ps.is.mpg.de/uploads_file/attachment/attachment/618/star_paper.pdf).
58+
59+
## Content
60+
This repository contains the model loader in the following frameworks:
61+
* A PyTorch.
62+
* A Tensorflow 2.0.
63+
* A Chumpy.
64+
65+
Code tested on Python 3.69, CUDA 10.1, CuDNN 7.6.5 and PyTorch 1.6.0, Tensorflow 2.3 , Chumpy 0.69 on Ubuntu 18.04
66+
67+
## SMPL Comparison
68+
STAR is designed to be a drop in replacement for SMPL, similar to SMPL it is parameterised with pose and shape parameters.
69+
70+
<p align="center">
71+
<img src="./images/star_talk amazon.053.jpeg" />
72+
</p>
73+
74+
### STAR Kinematic Tree
75+
<p align="center">
76+
<img src="./images/star_kinematic_tree.png" />
77+
</p>
78+
79+
80+
81+
82+
## Citation
83+
84+
If you find this Model & Software useful in your research we would kindly ask you to cite:
85+
86+
```bibtex
87+
@inproceedings{STAR:ECCV:2020,
88+
title = {STAR: Sparse Trained Articulated Human Body Regressor},
89+
author = {Ahmed A. A. Osman, Timo Bolkart, Michael J. Black},
90+
booktitle = {European Conference on Computer Vision (ECCV) },
91+
month = aug,
92+
year = {2020},
93+
month_numeric = {8}
94+
}
95+
```
96+
97+
## Acknowledgments
98+
We thank Naureen M. Mahmood, Talha Zaman, Nikos Athanasiou, Muhammed Kocabas, Nikos Kolotouros and Vassilis Choutas for the discussions.
99+
and Lea Muller, Amir Ahmad and Nitin Saini for proof reading the script and Joachim Tesch for help with game engines plug-ins.
100+
and Mason Laundry for the voice over.
101+
102+
## Contact
103+
104+
For questions, please contact [star@tue.mpg.de](mailto:star@tue.mpg.de).
105+
106+
For commercial licensing (and all related questions for business applications), please contact [ps-licensing@tue.mpg.de](mailto:ps-licensing@tue.mpg.de).

__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Copyright (C) 2020 Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG),
4+
# acting on behalf of its Max Planck Institute for Intelligent Systems and the
5+
# Max Planck Institute for Biological Cybernetics. All rights reserved.
6+
#
7+
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is holder of all proprietary rights
8+
# on this computer program. You can only use this computer program if you have closed a license agreement
9+
# with MPG or you get the right to use the computer program from someone who is authorized to grant you that right.
10+
# Any use of the computer program without a valid license is prohibited and liable to prosecution.
11+
# Contact: ps-license@tuebingen.mpg.de
12+
#
13+
#
14+
# If you use this code in a research publication please consider citing the following:
15+
#
16+
# STAR: Sparse Trained Articulated Human Body Regressor <https://arxiv.org/pdf/2008.08535.pdf>
17+
#
18+
#
19+
# Code Developed by:
20+
# Ahmed A. A. Osman

ch/__init__.py

Whitespace-only changes.

ch/serialization.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Copyright (C) 2020 Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG),
4+
# acting on behalf of its Max Planck Institute for Intelligent Systems and the
5+
# Max Planck Institute for Biological Cybernetics. All rights reserved.
6+
#
7+
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is holder of all proprietary rights
8+
# on this computer program. You can only use this computer program if you have closed a license agreement
9+
# with MPG or you get the right to use the computer program from someone who is authorized to grant you that right.
10+
# Any use of the computer program without a valid license is prohibited and liable to prosecution.
11+
# Contact: ps-license@tuebingen.mpg.de
12+
#
13+
#
14+
# If you use this code in a research publication please consider citing the following:
15+
#
16+
# STAR: Sparse Trained Articulated Human Body Regressor <https://arxiv.org/pdf/2008.08535.pdf>
17+
#
18+
#
19+
# Code Developed by:
20+
# Ahmed A. A. Osman
21+
22+
import chumpy as ch
23+
import numpy as np
24+
import os
25+
from .verts import verts_decorated_quat
26+
from config import cfg
27+
28+
def load_model(gender='female',num_betas=10):
29+
if gender not in ['male','female']:
30+
raise RuntimeError('Invalid model gender!')
31+
fname = os.path.join(cfg.path_star,gender,'model.npy')
32+
model_dict = np.load(fname,allow_pickle=True,encoding='latin1')[()]
33+
trans = ch.array(np.zeros(3))
34+
posedirs = ch.array(model_dict['posedirs'])
35+
v_tempalate = ch.array(model_dict['v_template'])
36+
37+
J_regressor = model_dict['J_regressor'] #Regressor of the model
38+
weights = ch.array(model_dict['weights']) #Weights
39+
num_joints = weights.shape[1]
40+
kintree_table = model_dict['kintree_table']
41+
f = model_dict['f']
42+
43+
betas = ch.array(np.zeros((model_dict['shapedirs'].shape[-1]))) #Betas
44+
shapedirs = ch.array(model_dict['shapedirs']) #Shape Corrective Blend shapes
45+
pose = ch.array(np.zeros((num_joints*3))) #Pose Angles
46+
47+
model = verts_decorated_quat(trans=trans,
48+
pose=pose,
49+
v_template=v_tempalate,
50+
J=J_regressor,
51+
weights=weights,
52+
kintree_table=kintree_table,
53+
f=f,
54+
posedirs=posedirs,
55+
betas=betas,
56+
shapedirs=shapedirs,
57+
want_Jtr=True)
58+
return model

ch/utils.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/usr/bin/env python
2+
# encoding: utf-8
3+
# Copyright (c) 2016 Max Planck Society. All rights reserved.
4+
# Modified by Ahmed A. A. Osman Feb 2020
5+
6+
import chumpy as ch
7+
import numpy as np
8+
import cv2
9+
10+
def axis2quat(p):
11+
angle = ch.sqrt(ch.clip(ch.sum(ch.square(p),1), 1e-16,1e16))
12+
norm_p = p / angle[:,np.newaxis]
13+
cos_angle = ch.cos(angle/2)
14+
sin_angle = ch.sin(angle/2)
15+
qx = norm_p[:,0]*sin_angle
16+
qy = norm_p[:,1]*sin_angle
17+
qz = norm_p[:,2]*sin_angle
18+
qw = cos_angle -1
19+
return ch.concatenate([qx[:,np.newaxis],qy[:,np.newaxis],qz[:,np.newaxis],qw[:,np.newaxis]],axis=1)
20+
21+
22+
class Rodrigues(ch.Ch):
23+
dterms = 'rt'
24+
25+
def compute_r(self):
26+
return cv2.Rodrigues(self.rt.r)[0]
27+
28+
def compute_dr_wrt(self, wrt):
29+
if wrt is self.rt:
30+
return cv2.Rodrigues(self.rt.r)[1].T
31+
32+
33+
def global_rigid_transformation(pose, J, kintree_table):
34+
results = {}
35+
pose = pose.reshape((-1, 3))
36+
id_to_col = {kintree_table[1, i]: i for i in range(kintree_table.shape[1])}
37+
parent = {i: id_to_col[kintree_table[0, i]] for i in range(1, kintree_table.shape[1])}
38+
def with_zeros(x):
39+
return ch.vstack((x, ch.array([[0.0, 0.0, 0.0, 1.0]])))
40+
41+
results[0] = with_zeros(ch.hstack((Rodrigues(pose[0, :]), J[0, :].reshape((3, 1)))))
42+
43+
for i in range(1, kintree_table.shape[1]):
44+
results[i] = results[parent[i]].dot(
45+
with_zeros(ch.hstack(
46+
(Rodrigues(pose[i, :]), ((J[i, :] - J[parent[i], :]).reshape((3, 1))))
47+
)))
48+
49+
def pack(x):
50+
return ch.hstack([np.zeros((4, 3)), x.reshape((4, 1))])
51+
52+
results = [results[i] for i in sorted(results.keys())]
53+
results_global = results
54+
55+
if True:
56+
results2 = [
57+
results[i] - pack(results[i].dot(ch.concatenate(((J[i, :]), 0))))
58+
for i in range(len(results))]
59+
60+
results = results2
61+
62+
result = ch.dstack(results)
63+
return result, results_global
64+
65+
def verts_core(pose, v, J, weights, kintree_table, want_Jtr=False):
66+
A, A_global = global_rigid_transformation(pose, J, kintree_table)
67+
T = A.dot(weights.T)
68+
69+
rest_shape_h = ch.vstack((v.T, np.ones((1, v.shape[0]))))
70+
71+
v = (T[:, 0, :] * rest_shape_h[0, :].reshape((1, -1)) +
72+
T[:, 1, :] * rest_shape_h[1, :].reshape((1, -1)) +
73+
T[:, 2, :] * rest_shape_h[2, :].reshape((1, -1)) +
74+
T[:, 3, :] * rest_shape_h[3, :].reshape((1, -1))).T
75+
76+
v = v[:, :3]
77+
78+
class result_meta(object):
79+
pass
80+
81+
if not want_Jtr:
82+
Jtr = None
83+
else:
84+
Jtr = ch.vstack([g[:3, 3] for g in A_global])
85+
86+
meta = result_meta()
87+
meta.Jtr = Jtr
88+
meta.A = A
89+
meta.A_global = A_global
90+
meta.A_weighted = T
91+
92+
return v, meta

0 commit comments

Comments
 (0)