Spaces:
Runtime error
Runtime error
Update src/pose.py
Browse files- src/pose.py +11 -7
src/pose.py
CHANGED
|
@@ -21,7 +21,6 @@ import hist_cub
|
|
| 21 |
import losses
|
| 22 |
import pose_estimation
|
| 23 |
import spin
|
| 24 |
-
import utils
|
| 25 |
|
| 26 |
PE_KSP_TO_SPIN = {
|
| 27 |
"Head": "Head",
|
|
@@ -1080,17 +1079,22 @@ def get_contacts(
|
|
| 1080 |
return contact
|
| 1081 |
|
| 1082 |
|
| 1083 |
-
def
|
| 1084 |
smpl,
|
| 1085 |
smpl_output,
|
| 1086 |
save_path,
|
| 1087 |
fname,
|
| 1088 |
):
|
| 1089 |
-
|
| 1090 |
-
smpl_output.vertices[0].cpu().numpy(),
|
| 1091 |
-
smpl.faces,
|
| 1092 |
-
|
| 1093 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1094 |
|
| 1095 |
|
| 1096 |
def eft_step(
|
|
@@ -1241,7 +1245,7 @@ def us_step(
|
|
| 1241 |
fist=args.fist,
|
| 1242 |
)
|
| 1243 |
|
| 1244 |
-
|
| 1245 |
smpl,
|
| 1246 |
smpl_output_us,
|
| 1247 |
save_path,
|
|
|
|
| 21 |
import losses
|
| 22 |
import pose_estimation
|
| 23 |
import spin
|
|
|
|
| 24 |
|
| 25 |
PE_KSP_TO_SPIN = {
|
| 26 |
"Head": "Head",
|
|
|
|
| 1079 |
return contact
|
| 1080 |
|
| 1081 |
|
| 1082 |
+
def save_mesh(
|
| 1083 |
smpl,
|
| 1084 |
smpl_output,
|
| 1085 |
save_path,
|
| 1086 |
fname,
|
| 1087 |
):
|
| 1088 |
+
mesh = trimesh.Trimesh(
|
| 1089 |
+
vertices=smpl_output.vertices[0].cpu().numpy(),
|
| 1090 |
+
faces=smpl.faces,
|
| 1091 |
+
process=False,
|
| 1092 |
)
|
| 1093 |
+
rot = trimesh.transformations.rotation_matrix(np.pi, [1, 0, 0])
|
| 1094 |
+
mesh.apply_transform(rot)
|
| 1095 |
+
mesh.export(save_path / f"{fname}.obj")
|
| 1096 |
+
mesh.export(save_path / f"{fname}.glb")
|
| 1097 |
+
mesh.export(save_path / f"{fname}.gltf")
|
| 1098 |
|
| 1099 |
|
| 1100 |
def eft_step(
|
|
|
|
| 1245 |
fist=args.fist,
|
| 1246 |
)
|
| 1247 |
|
| 1248 |
+
save_mesh(
|
| 1249 |
smpl,
|
| 1250 |
smpl_output_us,
|
| 1251 |
save_path,
|