sigal-raab / Motion

Motion classes, based on Holden's code http://theorangeduck.com/page/deep-learning-framework-character-motion-synthesis-and-editing
24 stars 3 forks source link

motion diffusion model output npy convert into bvh problem #1

Closed Ying156209 closed 1 year ago

Ying156209 commented 1 year ago

Hi, thx for the excellent work! I follow the answer to this issue https://github.com/GuyTevet/motion-diffusion-model/issues/32, and get the following assertion err. Do you have any idea how to fix it? Thanks!

There is some other infos. Since there is no hands prediction in MDM ( if I understand correctly), I only use the first 22nd as the 'parents' index. The shape of motion loaded in this function is (24, 22, 3, 120).

/tmp/ipykernel_826073/4123892294.py in smpl2bvh() 44 print(f'starting anim no. {i}') 45 print(p.shape, parents) ---> 46 anim, sortedorder, = animation_from_positions(p, parents) 47 BVH.save(bvh_path.format(i), anim, names=np.array(SMPL_JOINT_NAMES)[sorted_order]) 48

~/Motion/InverseKinematics.py in animation_from_positions(positions, parents, offsets) 554 return anim, sorted_order, parents 555

~/Motion/InverseKinematics.py in call(self) 103 axises = np.cross(jdirs, ddirs) 104 if jdirs.shape[1] == 1: # for a single child reconstruction should be exact --> 105 assert np.allclose(Quaternions.from_angle_axis(angles, np.cross(jdirs, ddirs)) jdirs, ddirs) 106 axises = -anim_rotations[:,j,np.newaxis] axises 107

AssertionError:

sigal-raab commented 1 year ago
  1. Re assertion error: sometimes floating point differences are larger than expected, so you may either comment out the assertion, or add " atol=1e-3" as an additional parameter to the "allclose" function. Also, please attach the npy file so I can look at it.
  2. Re number of joints: the code in issue #32 is correct when using the Humanact12 and the UESTC datasets. If you are using the HumanML3D dataset, you need to drop the last two items from the parents and from the SMPL_JOINT_NAMES arrays. It appears you did the right thing.