Spaces:
Runtime error
Runtime error
obj for download, glb for visualization
Browse files- apps/infer.py +19 -4
apps/infer.py
CHANGED
|
@@ -296,6 +296,8 @@ def generate_model(in_path, model_type):
|
|
| 296 |
smpl_obj.visual.vertex_colors = (smpl_obj.vertex_normals+1.0)*255.0*0.5
|
| 297 |
smpl_obj.export(
|
| 298 |
f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_smpl.obj")
|
|
|
|
|
|
|
| 299 |
|
| 300 |
smpl_info = {'betas': optimed_betas,
|
| 301 |
'pose': optimed_pose,
|
|
@@ -338,6 +340,10 @@ def generate_model(in_path, model_type):
|
|
| 338 |
os.path.join(config_dict['out_dir'], cfg.name,
|
| 339 |
f"obj/{data['name']}_recon.obj")
|
| 340 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
|
| 342 |
# Isotropic Explicit Remeshing for better geometry topology
|
| 343 |
verts_refine, faces_refine = remesh(os.path.join(config_dict['out_dir'], cfg.name,
|
|
@@ -419,6 +425,8 @@ def generate_model(in_path, model_type):
|
|
| 419 |
final.visual.vertex_colors = final_colors
|
| 420 |
final.export(
|
| 421 |
f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_refine.obj")
|
|
|
|
|
|
|
| 422 |
|
| 423 |
|
| 424 |
# always export visualized video regardless of the cloth refinment
|
|
@@ -438,10 +446,13 @@ def generate_model(in_path, model_type):
|
|
| 438 |
f"vid/{data['name']}_cloth.mp4"),
|
| 439 |
)
|
| 440 |
|
| 441 |
-
|
|
|
|
| 442 |
smpl_npy_path = f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_smpl.npy"
|
| 443 |
-
|
| 444 |
-
|
|
|
|
|
|
|
| 445 |
|
| 446 |
video_path = os.path.join(config_dict['out_dir'], cfg.name, f"vid/{data['name']}_cloth.mp4")
|
| 447 |
overlap_path = os.path.join(config_dict['out_dir'], cfg.name, f"png/{data['name']}_overlap.png")
|
|
@@ -453,4 +464,8 @@ def generate_model(in_path, model_type):
|
|
| 453 |
gc.collect()
|
| 454 |
torch.cuda.empty_cache()
|
| 455 |
|
| 456 |
-
return [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
smpl_obj.visual.vertex_colors = (smpl_obj.vertex_normals+1.0)*255.0*0.5
|
| 297 |
smpl_obj.export(
|
| 298 |
f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_smpl.obj")
|
| 299 |
+
smpl_obj.export(
|
| 300 |
+
f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_smpl.glb")
|
| 301 |
|
| 302 |
smpl_info = {'betas': optimed_betas,
|
| 303 |
'pose': optimed_pose,
|
|
|
|
| 340 |
os.path.join(config_dict['out_dir'], cfg.name,
|
| 341 |
f"obj/{data['name']}_recon.obj")
|
| 342 |
)
|
| 343 |
+
recon_obj.export(
|
| 344 |
+
os.path.join(config_dict['out_dir'], cfg.name,
|
| 345 |
+
f"obj/{data['name']}_recon.glb")
|
| 346 |
+
)
|
| 347 |
|
| 348 |
# Isotropic Explicit Remeshing for better geometry topology
|
| 349 |
verts_refine, faces_refine = remesh(os.path.join(config_dict['out_dir'], cfg.name,
|
|
|
|
| 425 |
final.visual.vertex_colors = final_colors
|
| 426 |
final.export(
|
| 427 |
f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_refine.obj")
|
| 428 |
+
final.export(
|
| 429 |
+
f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_refine.glb")
|
| 430 |
|
| 431 |
|
| 432 |
# always export visualized video regardless of the cloth refinment
|
|
|
|
| 446 |
f"vid/{data['name']}_cloth.mp4"),
|
| 447 |
)
|
| 448 |
|
| 449 |
+
smpl_obj_path = f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_smpl.obj"
|
| 450 |
+
smpl_glb_path = f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_smpl.glb"
|
| 451 |
smpl_npy_path = f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_smpl.npy"
|
| 452 |
+
recon_obj_path = f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_recon.obj"
|
| 453 |
+
recon_glb_path = f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_recon.glb"
|
| 454 |
+
refine_obj_path = f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_refine.obj"
|
| 455 |
+
refine_glb_path = f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_refine.glb"
|
| 456 |
|
| 457 |
video_path = os.path.join(config_dict['out_dir'], cfg.name, f"vid/{data['name']}_cloth.mp4")
|
| 458 |
overlap_path = os.path.join(config_dict['out_dir'], cfg.name, f"png/{data['name']}_overlap.png")
|
|
|
|
| 464 |
gc.collect()
|
| 465 |
torch.cuda.empty_cache()
|
| 466 |
|
| 467 |
+
return [smpl_glb_path, smpl_obj_path,
|
| 468 |
+
smpl_npy_path,
|
| 469 |
+
recon_glb_path, recon_obj_path,
|
| 470 |
+
refine_glb_path, refine_obj_path,
|
| 471 |
+
video_path, video_path, overlap_path]
|