EricGuo5513 / text-to-motion

Official implementation for "Generating Diverse and Natural 3D Human Motions from Texts (CVPR2022)."
MIT License
462 stars 40 forks source link

Format of `data` passed to `recover_from_ric`? #20

Open aniongithub opened 1 year ago

aniongithub commented 1 year ago

What is the layout of the data passed in to recover_from_ric? I'd like to just get the local rotations and translations of each bone and do my own FK on it instead of getting absolute positions.

EricGuo5513 commented 1 year ago

Hi,

You could also try recover_from_rot, it will apply FK on rotations and theoretically give you the same results. The layout of data are as below, note there is no root joint anymore:

root_rot_velocity (B, seq_len, 1)

root_linear_velocity (B, seq_len, 2)

root_y (B, seq_len, 1)

ric_data (B, seq_len, (joint_num - 1)*3)

rot_data (B, seq_len, (joint_num - 1)*6)

local_velocity (B, seq_len, joint_num*3)

foot contact (B, seq_len, 4)

Ani @.***> 于2023年2月21日周二 22:18写道:

What is the layout of the data passed in to recover_from_ric? I'd like to just get the local rotations of each bone and do my own FK on it instead of getting absolute positions.

— Reply to this email directly, view it on GitHub https://github.com/EricGuo5513/text-to-motion/issues/20, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKRYNB4ZODFN7EZV3FIQFSDWYWOT5ANCNFSM6AAAAAAVD3U3AQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

aniongithub commented 1 year ago

When I try to call recover_from_rot, the code fails in skeleton.py with the stacktrace below

  File "gen_motion_script.py", line 199, in <module>
    plot_t2m(motion, pjoin(animation_save_path, 'gen_motion_%02d_L%03d' % (t, motion.shape[1])), captions)
  File "gen_motion_script.py", line 23, in plot_t2m
    joint_rot = recover_from_rot(torch.from_numpy(joint_data).float(), opt.joints_num, skel)
  File "/workspaces/text-to-motion/scripts/motion_process.py", line 396, in recover_from_rot
    positions = skeleton.forward_kinematics_cont6d(cont6d_params, r_pos)
  File "/workspaces/text-to-motion/common/skeleton.py", line 180, in forward_kinematics_cont6d
    if len(self._offset.shape) == 2:
AttributeError: 'NoneType' object has no attribute 'shape'

Specifically at line 180 because self._offset is None.

Please note that I just want the local rotations of each bone as quaternions, I am not interested in FK because my own animation system will implement that. Given the packing of the data, could you please help me with extracting the components (especially rot_data) you've indicated and clarify if rot_data is indeed the local quaternion rotations of each bone.