Skip to content

Commit 7c27108

Browse files
author
Soubhik Sanyal
committed
neutralize mesh
1 parent e0db42f commit 7c27108

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

requirements.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
numpy
2+
scipy
3+
matplotlib
4+
scikit-image
5+
chumpy
6+
opencv-python
7+
absl-py
8+
tensorflow-gpu==1.12.0
9+
ipdb

util/using_flame_parameters.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
Author: Soubhik Sanyal
3+
Copyright (c) 2019, Soubhik Sanyal
4+
"""
5+
# This function Netralize the pose and expression of the predicted mesh and generates a template mesh with only the identity information
6+
import numpy as np
7+
import chumpy as ch
8+
from smpl_webuser.serialization import load_model
9+
from smpl_webuser.verts import verts_decorated
10+
from psbody.mesh import Mesh
11+
12+
13+
def make_prdicted_mesh_neutral(predicted_params_path, flame_model_path):
14+
params = np.load(predicted_params_path, allow_pickle=True)
15+
params = params[()]
16+
pose = np.zeros(15)
17+
expression = np.zeros(100)
18+
shape = np.hstack((params['shape'], np.zeros(300-params['shape'].shape[0])))
19+
flame_genral_model = load_model(flame_model_path)
20+
generated_neutral_mesh = verts_decorated(ch.array([0.0,0.0,0.0]),
21+
ch.array(pose),
22+
ch.array(flame_genral_model.r),
23+
flame_genral_model.J_regressor,
24+
ch.array(flame_genral_model.weights),
25+
flame_genral_model.kintree_table,
26+
flame_genral_model.bs_style,
27+
flame_genral_model.f,
28+
bs_type=flame_genral_model.bs_type,
29+
posedirs=ch.array(flame_genral_model.posedirs),
30+
betas=ch.array(np.hstack((shape,expression))),#betas=ch.array(np.concatenate((theta[0,75:85], np.zeros(390)))), #
31+
shapedirs=ch.array(flame_genral_model.shapedirs),
32+
want_Jtr=True)
33+
neutral_mesh = Mesh(v=generated_neutral_mesh.r, f=generated_neutral_mesh.f)
34+
return neutral_mesh

0 commit comments

Comments
 (0)