Mathux / ACTOR

Official Pytorch implementation of the paper "Action-Conditioned 3D Human Motion Synthesis with Transformer VAE", ICCV 2021
MIT License
384 stars 52 forks source link

storing predicted rotations in bvh format #10

Closed Neptune-Trojans closed 2 years ago

Neptune-Trojans commented 2 years ago

Hi,

Is there a way to store model generated rotations as bvh file ? I want to load the generated motion via following package in order to proceed with my research. Thanks.

Mathux commented 2 years ago

Hello,

In the fairmotion package you specified, you can see in the fairmotion/data/amass.py file, that there are functions to load data from the AMASS dataset.

What you can do is to modify this file src/generate/generate_sequences.py from this repo such that you save the SMPL pose parameters, instead of the vertices. To give you some clues, generation["output"] is the SMPL parameters (in rotation 6D format). You need to convert them back to axis angle (you can use functions in this file: src/utils/rotation_conversions.py. Then you need to save the translation and rotations in a dictionary like AMASS data.

Neptune-Trojans commented 2 years ago

Hi,

Thanks for the explanation. The 6d rotations (6d format) after you convert them back to 3x3 rotation matrix geometry.rotation_6d_to_matrix(x_rotations[mask]) is this regular rotation matrix or it's still SMPL model rotations ? If it's still SMPL model rotations how I can convert them to regular rotations ?

Thanks.

Mathux commented 2 years ago

Hello,

The conversion functions convert one "representation" of the rotation into another (6D => 3x3 matrix for example). It doesn't change anything else. The rotation will still be "SMPL model rotations". If you convert them into axis-angle, it will be the exact same format as the AMASS dataset. You can then check the fairmotion/data/amass.py file to see how to load this type of data into fairmotion.