Spaces:
Build error
Build error
Commit
·
b8976d5
1
Parent(s):
fd0812c
Upload 10 files
Browse files- app.py +4 -4
- visualise/__pycache__/rendering.cpython-37.pyc +0 -0
- visualise/rendering.py +5 -5
- voca/__pycache__/rendering.cpython-37.pyc +0 -0
- voca/rendering.py +4 -4
app.py
CHANGED
@@ -10,10 +10,10 @@ sys.path.append(os.getcwd())
|
|
10 |
# os.system(r"apt-get update")
|
11 |
# os.system(r"apt-get install sudo")
|
12 |
#
|
13 |
-
os.system(r"apt-get install libboost-dev")
|
14 |
-
# os.system(r"sudo apt-get install gcc")
|
15 |
-
# os.system(r"sudo apt-get install g++")
|
16 |
-
os.system(r"make -C ./mesh-master all")
|
17 |
# os.system(r"cd ..")
|
18 |
# os.system("pip install --no-deps --verbose --no-cache-dir /home/user/app/mesh-fix-MSVC_compilation")
|
19 |
|
|
|
10 |
# os.system(r"apt-get update")
|
11 |
# os.system(r"apt-get install sudo")
|
12 |
#
|
13 |
+
# os.system(r"apt-get install libboost-dev")
|
14 |
+
# # os.system(r"sudo apt-get install gcc")
|
15 |
+
# # os.system(r"sudo apt-get install g++")
|
16 |
+
# os.system(r"make -C ./mesh-master all")
|
17 |
# os.system(r"cd ..")
|
18 |
# os.system("pip install --no-deps --verbose --no-cache-dir /home/user/app/mesh-fix-MSVC_compilation")
|
19 |
|
visualise/__pycache__/rendering.cpython-37.pyc
CHANGED
Binary files a/visualise/__pycache__/rendering.cpython-37.pyc and b/visualise/__pycache__/rendering.cpython-37.pyc differ
|
|
visualise/rendering.py
CHANGED
@@ -11,7 +11,7 @@ import numpy as np
|
|
11 |
from scipy.io import wavfile
|
12 |
import pyrender
|
13 |
|
14 |
-
from psbody.mesh import Mesh
|
15 |
|
16 |
import librosa
|
17 |
|
@@ -95,11 +95,11 @@ def add_image_text(img, text, color=(0,0,255), w=800, h=800):
|
|
95 |
|
96 |
class RenderTool():
|
97 |
def __init__(self, out_path):
|
98 |
-
self.template_mesh = Mesh()
|
99 |
path = os.path.join(os.getcwd(), 'visualise/smplx/SMPLX_NEUTRAL.npz')
|
100 |
model_data = np.load(path, allow_pickle=True)
|
101 |
data_struct = Struct(**model_data)
|
102 |
-
self.
|
103 |
self.out_path = out_path
|
104 |
if not os.path.exists(self.out_path):
|
105 |
os.makedirs(self.out_path)
|
@@ -182,10 +182,10 @@ class RenderTool():
|
|
182 |
cur_img = []
|
183 |
for i in range(len(v_list)):
|
184 |
if face:
|
185 |
-
img = render_mesh_helper(
|
186 |
r=r, xmag=0.15, y=1, z=1.0, camera='o')
|
187 |
else:
|
188 |
-
img = render_mesh_helper(
|
189 |
# sen = get_sen(i, num_video, i_frame, pos)
|
190 |
# if transcript is not None:
|
191 |
# sen = str(int(transcript[i_frame].item()))
|
|
|
11 |
from scipy.io import wavfile
|
12 |
import pyrender
|
13 |
|
14 |
+
# from psbody.mesh import Mesh
|
15 |
|
16 |
import librosa
|
17 |
|
|
|
95 |
|
96 |
class RenderTool():
|
97 |
def __init__(self, out_path):
|
98 |
+
# self.template_mesh = Mesh()
|
99 |
path = os.path.join(os.getcwd(), 'visualise/smplx/SMPLX_NEUTRAL.npz')
|
100 |
model_data = np.load(path, allow_pickle=True)
|
101 |
data_struct = Struct(**model_data)
|
102 |
+
self.f = data_struct.f
|
103 |
self.out_path = out_path
|
104 |
if not os.path.exists(self.out_path):
|
105 |
os.makedirs(self.out_path)
|
|
|
182 |
cur_img = []
|
183 |
for i in range(len(v_list)):
|
184 |
if face:
|
185 |
+
img = render_mesh_helper((v_list[i][i_frame], self.f), center,
|
186 |
r=r, xmag=0.15, y=1, z=1.0, camera='o')
|
187 |
else:
|
188 |
+
img = render_mesh_helper((v_list[i][i_frame], self.f), center, camera='o',r=r, y=0.7)
|
189 |
# sen = get_sen(i, num_video, i_frame, pos)
|
190 |
# if transcript is not None:
|
191 |
# sen = str(int(transcript[i_frame].item()))
|
voca/__pycache__/rendering.cpython-37.pyc
CHANGED
Binary files a/voca/__pycache__/rendering.cpython-37.pyc and b/voca/__pycache__/rendering.cpython-37.pyc differ
|
|
voca/rendering.py
CHANGED
@@ -25,7 +25,7 @@ import tempfile
|
|
25 |
import numpy as np
|
26 |
import matplotlib as mpl
|
27 |
import matplotlib.cm as cm
|
28 |
-
from psbody.mesh import Mesh
|
29 |
|
30 |
|
31 |
def get_unit_factor(unit):
|
@@ -48,8 +48,8 @@ def render_mesh_helper(mesh, t_center, rot=np.zeros(3), tex_img=None, v_colors=N
|
|
48 |
|
49 |
frustum = {'near': 0.01, 'far': 3.0, 'height': 800, 'width': 800}
|
50 |
|
51 |
-
|
52 |
-
|
53 |
|
54 |
texture_rendering = tex_img is not None and hasattr(mesh, 'vt') and hasattr(mesh, 'ft')
|
55 |
if texture_rendering:
|
@@ -86,7 +86,7 @@ def render_mesh_helper(mesh, t_center, rot=np.zeros(3), tex_img=None, v_colors=N
|
|
86 |
color = np.array([0.3, 0.5, 0.55])
|
87 |
|
88 |
if not texture_rendering:
|
89 |
-
tri_mesh = trimesh.Trimesh(vertices=
|
90 |
render_mesh = pyrender.Mesh.from_trimesh(tri_mesh,
|
91 |
smooth=True,
|
92 |
material=pyrender.MetallicRoughnessMaterial(
|
|
|
25 |
import numpy as np
|
26 |
import matplotlib as mpl
|
27 |
import matplotlib.cm as cm
|
28 |
+
# from psbody.mesh import Mesh
|
29 |
|
30 |
|
31 |
def get_unit_factor(unit):
|
|
|
48 |
|
49 |
frustum = {'near': 0.01, 'far': 3.0, 'height': 800, 'width': 800}
|
50 |
|
51 |
+
v, f = mesh
|
52 |
+
v = cv2.Rodrigues(rot)[0].dot((v - t_center).T).T + t_center
|
53 |
|
54 |
texture_rendering = tex_img is not None and hasattr(mesh, 'vt') and hasattr(mesh, 'ft')
|
55 |
if texture_rendering:
|
|
|
86 |
color = np.array([0.3, 0.5, 0.55])
|
87 |
|
88 |
if not texture_rendering:
|
89 |
+
tri_mesh = trimesh.Trimesh(vertices=v, faces=f, vertex_colors=rgb_per_v)
|
90 |
render_mesh = pyrender.Mesh.from_trimesh(tri_mesh,
|
91 |
smooth=True,
|
92 |
material=pyrender.MetallicRoughnessMaterial(
|