muelea / shapy

CVPR 2022 - Official code repository for the paper: Accurate 3D Body Shape Regression using Metric and Semantic Attributes.
https://shapy.is.tue.mpg.de/
295 stars 44 forks source link

SMPLX body doesn't match the beta coefficient #30

Closed zycliao closed 7 months ago

zycliao commented 7 months ago

Hi,

thanks for the amazing work. However, when I run demo.py, the output beta coefficient can't match the output vertices. Here's a code snippet that can reproduce the problem:

import smplx
import numpy as np
smplx_model = smplx.SMPLX(os.path.join(SMPLX_MODEL_DIR, "SMPLX_NEUTRAL.npz"))
faces = smplx_model.faces

body_estimation_path = "/root/project/shapy/samples/shapy_fit/img_21.npz"
body_estimation = np.load(body_estimation_path)
est_body_vertices = smplx_model(beta=torch.tensor(body_estimation["betas"][None], dtype=torch.float32))

save_obj_mesh(os.path.join(data_dir, "smplx_vshaped.obj"), est_body_vertices.v_shaped.detach().cpu().numpy()[0], faces)
save_obj_mesh(os.path.join(data_dir, "est_body_vshaped.obj"), body_estimation['v_shaped'], faces)

The visualization of these two meshes is as follows. The grayish one is est_body_vshaped.obj (it's the same shape as the saved ply file) and the white one is smplx_vshaped.obj (obtained by running SMPLX alone using the predicted betas). And they have a clear difference. I also tried with other examples, and they all have this problem. I would really appreciate it if you have any hints about solving this. Thank you!

Screenshot 2023-11-17 010106

zycliao commented 7 months ago

😢 Sorry, it's just a silly bug. The argument name should be betas instead of beta. The SMPLX model didn't receive the betas coefficients.