add ploting
This commit is contained in:
@@ -4,6 +4,7 @@ os.environ["CUDA_VISIBLE_DEVICES"] = '6'
|
||||
|
||||
import numpy as np
|
||||
from smpl_tf import SMPL
|
||||
from utils import plot_mesh
|
||||
|
||||
if __name__ == '__main__':
|
||||
smpl_tf : SMPL = SMPL('model_files')
|
||||
@@ -11,7 +12,8 @@ if __name__ == '__main__':
|
||||
betas = np.zeros((1, 11), dtype=np.float32)
|
||||
poses = np.zeros((1, 72), dtype=np.float32)
|
||||
R = smpl_tf.run_rodrigues(poses)
|
||||
posed = smpl_tf.run(R, betas)
|
||||
posed, _, _ = smpl_tf.run(R, betas)
|
||||
|
||||
plot_mesh(posed[0].numpy(), smpl_tf.f).show()
|
||||
|
||||
pass
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
numpy
|
||||
scipy
|
||||
tensorflow
|
||||
tensorflow
|
||||
plotly
|
||||
@@ -0,0 +1,25 @@
|
||||
import plotly.graph_objects as go
|
||||
|
||||
|
||||
def plot_mesh(verts, faces):
|
||||
fig = go.Figure()
|
||||
|
||||
fig.add_trace(go.Mesh3d(
|
||||
x=verts[:,0],
|
||||
y=verts[:,2],
|
||||
z=verts[:,1],
|
||||
i = faces[:,0],
|
||||
j = faces[:,1],
|
||||
k = faces[:,2],
|
||||
text="",
|
||||
),)
|
||||
|
||||
fig.update_layout(scene_aspectmode='manual', scene_aspectratio=dict(x=1, y=1, z=1))
|
||||
helper = dict(xaxis = dict(range=[-1,1], showbackground=False, showticklabels=False, showaxeslabels=False, showspikes=False, visible=False),
|
||||
yaxis = dict(range=[-1,1], showbackground=False, showticklabels=False, showaxeslabels=False, showspikes=False, visible=False),
|
||||
zaxis = dict(range=[-1,1], showbackground=False, showticklabels=False, showaxeslabels=False, showspikes=False, visible=False),)
|
||||
fig.update_layout(scene = helper)
|
||||
|
||||
fig.update_layout(margin=dict(l=0, r=0, b=0, t=0, pad=0))
|
||||
|
||||
return fig
|
||||
Reference in New Issue
Block a user