A simple and clean motion retargeting repo extracted from the H2O motion retargeting module
-
You need to download the SMPL model from SMPL website and place it in the
assets/body_models/smplxdirectory. The structure should look like this:assets/body_models/smplx └── SMPLX_NEUTRAL.npz └── SMPLX_MALE.npz └── SMPLX_FEMALE.npz -
Download the AMASS dataset from AMASS website.
-
Install the required packages:
pip install -r requirements.txt
Install
pytorch3dpackage:pip install --no-build-isolation git+https://github.com/facebookresearch/pytorch3d.git
-
Create a config file in the
configdirectory. You can refer toconfig/orca.yamlfor an example.- because the SMPL model is in T-pose, and the root coordinate is y-up/z-forward by default, you need to adjust the 'smpl.rotation' to match your robot root coordinate system.
- you should specify the joint angles in the 'mujoco.T_pose_joints' field in the config file according to your robot model.
-
Fit the SMPL shape to the robot by running:
python 1_smpl_shape_fit.py config/your_config.yaml
-
Retarget motion by running:
python 2_smpl_motion_fit.py config/your_config.yaml --data path/to/your/amass/motion.npz
-
Visualize the retargeted motion by running:
python vis_mujoco.py config/your_config.yaml --data retargeted_data/path/to/your/amass/motion.pkl