hygenie1228 / ClothWild_RELEASE

[ECCV 2022] This repo is official PyTorch implementation of 3D Clothed Human Reconstruction in the Wild.
174 stars 13 forks source link

Pose2Pose demo 로 얻은 json 파일을 이용한 Clothwild demo 진행 간 오류 발생 #1

Closed Songinpyo closed 1 year ago

Songinpyo commented 1 year ago

안녕하세요, 훌륭한 프로젝트를 공유해주셔서 정말 감사합니다! 해당 프로젝트에 관심을 가지고, Demo 를 시도하고 있습니다.

Clothwild demo를 위해서 pose2pose demo로 custom image의 result.json 파일을 얻었습니다. 이후 해당 image와 result.json 파일을 이용해서 Clothwild demo를 실행했을 때, 오류가 발생합니다.

Traceback (most recent call last):
  File "demo.py", line 71, in <module>
    smpl_pose, smpl_shape, smpl_mesh = process_human_model_output(pose2pose_result['smpl_param'], pose2pose_result['cam_param'], False, (original_width, original_height), img2bb_trans, 0.0)
KeyError: 'smpl_param'

문제는 pose2pose demo에서 얻은 json 파일 내의 내용이 다음과 같기 때문에 발생하는 것으로 보입니다.

{"pose": [-2.579423666000366, ..., 0.0], "shape": [-0.01634468138217926, ..., -0.019871100783348083]}

Clothwild 의 demo.py 에서는

smpl_pose, smpl_shape, smpl_mesh = process_human_model_output(pose2pose_result['smpl_param'], pose2pose_result['cam_param'], False, (original_width, original_height), img2bb_trans, 0.0)

위와 같이 'smpl_param', 'cam_param' 등을 pose2pose_result.json 으로부터 input으로 받는데 해당 key가 존재하지 않는 문제인 것 같습니다.

Prepare SMPL parameter, as pose2pose_result.json. You can get the SMPL parameter by running the off-the-shelf method [code].

이 문구에서 off-the-shelf method가 demo를 의미한다고 생각해서 pose2pose demo를 통해서 json파일을 얻을 수 있다고 해석했는데, 혹시 다른 방법으로 SMPL parameter, pose2pose_result.json 파일을 얻어야 하는 걸까요?

hygenie1228 commented 1 year ago

안녕하세요. 저희 연구에 관심을 가져주셔서 감사합니다.

'pose2pose_result.json'의 pose, shape을 제외한 나머지는 rendering을 위한 변수이기 때문에, mesh만을 얻고 싶다면 나머지 변수에 dummy value (e.g., zeros)를 채우셔도 무관합니다.

만약 rendering까지 하고 싶으시다면, Pose2Pose demo코드 부분을 아래와 같이 변경하면 모든 변수를 얻으실 수 있습니다.

https://github.com/mks0601/Hand4Whole_RELEASE/blob/Pose2Pose/demo/body/demo_body.py#L89-L92

# save SMPL parameters
smpl_pose = out['smpl_pose'].detach().cpu().numpy()[0]
smpl_shape = out['smpl_shape'].detach().cpu().numpy()[0]
cam_trans = out['cam_trans'].detach().cpu().numpy()[0]
with open('smpl_param.json', 'w') as f:
    json.dump({ 'smpl_param':
                    {'pose': smpl_pose.reshape(-1).tolist(), 'shape': smpl_shape.reshape(-1).tolist(), 'trans': cam_trans.reshape(-1).tolist()},
                'cam_param':
                    {'focal': focal, 'princpt': princpt}
                }, f)

Some variables in 'pose2pose_result.json', except pose and shape, are required for rendering. Therefore, if you want to get only the mesh, fill in the dummy values (e.g., zeros) in the variables. You can get all the variables in 'pose2pose_result.json' by changing the Pose2Pose demo code as above.

Songinpyo commented 1 year ago

문제가 잘 해결되었습니다. 빠르고 친절한 답변 감사합니다!