Skip to main content

Holosoma Motion Retargeting

This repository provides tools for retargeting human motion data to humanoid robots. It supports multiple data formats (smplh, mocap, lafan) and task types including robot-only motion, object interaction, and climbing.

Data Requirements: The retargeting pipeline requires motion data in world joint positions. For custom data, you need to prepare world joint positions in shape (T, J, 3) where T is the number of frames and J is the number of joints, and modify demo_joints and joints_mapping defined in config_types/data_type.py.

Single Sequence Motion Retargeting

# Robot-only (OMOMO)
python examples/robot_retarget.py --data_path demo_data/OMOMO_new --task-type robot_only --task-name sub3_largebox_003 --data_format smplh --retargeter.debug --retargeter.visualize

# Object interaction (OMOMO)
python examples/robot_retarget.py --data_path demo_data/OMOMO_new --task-type object_interaction --task-name sub3_largebox_003 --data_format smplh --retargeter.debug --retargeter.visualize

# Climbing
python examples/robot_retarget.py --data_path demo_data/climb --task-type climbing --task-name mocap_climb_seq_0 --data_format mocap --robot-config.robot-urdf-file models/g1/g1_29dof_spherehand.urdf --retargeter.debug --retargeter.visualize

Note: Add --augmentation to run sequences with augmentation. You must first run the original sequence before adding augmentation.

Batch Processing for Motion Retargeting

# Robot-only (OMOMO)
python examples/parallel_robot_retarget.py --data-dir demo_data/OMOMO_new --task-type robot_only --data_format smplh --save_dir demo_results_parallel/g1/robot_only/omomo --task-config.object-name ground

# Object interaction (OMOMO)
python examples/parallel_robot_retarget.py --data-dir demo_data/OMOMO_new --task-type object_interaction --data_format smplh --save_dir demo_results_parallel/g1/object_interaction/omomo --task-config.object-name largebox

# Climbing
python examples/parallel_robot_retarget.py --data-dir demo_data/climb --task-type climbing --data_format mocap --robot-config.robot-urdf-file models/g1/g1_29dof_spherehand.urdf --task-config.object-name multi_boxes --save_dir demo_results_parallel/g1/climbing/mocap_climb

Note: Add --augmentation to run original sequences and sequences with augmentation (for object interaction and climbing tasks).

Data Preparation

We provide demo_data/ for fast testing. To test on more motion sequences, please follow the instructions below to download and prepare the data.

OMOMO

Our pipeline uses the processed dataset by InterMimic. The data format differs from the original OMOMO dataset.

  1. Download the processed OMOMO data from this link
  2. Extract the downloaded folder to demo_data/OMOMO_new

The data should contain .pt files.

LAFAN

Download the Original LAFAN Data

  1. Download lafan1.zip by clicking "View Raw"
  2. Put lafan1.zip in your designated data folder and uncompress it to DATA_FOLDER_PATH/lafan
  3. The file structure should be demo_data/lafan/*.bvh

Convert the Original LAFAN Data Format for Motion Retargeting

We need some data processing files from the LAFAN GitHub repo.

cd holosoma_retargeting/data_utils/
git clone https://github.com/ubisoft/ubisoft-laforge-animation-dataset.git
mv ubisoft-laforge-animation-dataset/lafan1 .
python extract_global_positions.py --input_dir DATA_FOLDER_PATH/lafan --output_dir ../demo_data/lafan

This will convert the BVH files to .npy format with global joint positions.

Note: For LAFAN data, you need to relax the foot sticking constraint by setting --retargeter.foot-sticking-tolerance (default is stricter). You can adjust this tolerance number based on your data quality and retargeting results.

Single Sequence Retargeting on LAFAN

python examples/robot_retarget.py --data_path demo_data/lafan --task-type robot_only --task-name dance2_subject1 --data_format lafan --task-config.ground-range -10 10 --save_dir demo_results/g1/robot_only/lafan --retargeter.debug --retargeter.visualize --retargeter.foot-sticking-tolerance 0.02

Batch Processing for Motion Retargeting on LAFAN

python examples/parallel_robot_retarget.py --data-dir demo_data/lafan --task-type robot_only --data_format lafan --save_dir demo_results_parallel/g1/robot_only/lafan --task-config.object-name ground --task-config.ground-range -10 10 --retargeter.foot-sticking-tolerance 0.02

AMASS SMPL-X

Download the Original AMASS Data

  1. Follow the AMASS instructions to download the original AMASS data
  2. The AMASS data structure should be /path/to/amass/dataset_name/subject_name/*.npz

Download SMPL-X Models

  1. Follow the SMPL-X instructions to download SMPL-X models
  2. For AMASS data, we tested on SMPL-X N (neutral) format
  3. The SMPL-X models structure should be /path/to/models/smplx/SMPLX_NEUTRAL.npz

Convert the Original AMASS SMPL-X Data Format for Motion Retargeting

We provide data_utils/prep_amass_smplx_for_rt.py for converting AMASS SMPLX data to the format required for motion retargeting.

# Install dependencies
cd holosoma_retargeting/data_utils/
git clone https://github.com/nghorbani/human_body_prior.git
pip install tqdm dotmap PyYAML omegaconf loguru
cd human_body_prior/
python setup.py develop
cd ../

# Run data processing
python prep_amass_smplx_for_rt.py \
  --amass-root-folder /path/to/amass \
  --output-folder /path/to/output \
  --model-root-folder /path/to/models

This will convert the AMASS .npz files to .npz format with global joint positions and height information.

Note: You can optionally specify --subdataset-folder to process only a specific subdataset (e.g., HumanEva). If not specified, it will process all datasets recursively.

Single Sequence Retargeting on AMASS SMPL-X

python examples/robot_retarget.py --data_path demo_data/amass_smplx_processed --task-type robot_only --task-name HumanEva_S3_Jog_1_stageii --data_format smplx --task-config.ground-range -10 10 --save_dir demo_results/g1/robot_only/amass_smplx --retargeter.debug --retargeter.visualize

Batch Processing for Motion Retargeting on AMASS SMPL-X

python examples/parallel_robot_retarget.py --data-dir demo_data/amass_smplx_processed --task-type robot_only --data_format smplx --save_dir demo_results_parallel/g1/robot_only/amass_smplx --task-config.object-name ground --task-config.ground-range -10 10

Check Visualizations of Saved Retargeting Results

# Visualize object-interaction results
python viser_player.py --robot_urdf models/g1/g1_29dof.urdf \
    --object_urdf models/largebox/largebox.urdf \
    --qpos_npz demo_results_parallel/g1/object_interaction/omomo/sub3_largebox_003_original.npz

# Visualize climbing results
python viser_player.py --robot_urdf models/g1/g1_29dof_spherehand.urdf \
    --object_urdf demo_data/climb/mocap_climb_seq_0/multi_boxes.urdf \
    --qpos_npz demo_results_parallel/g1/climbing/mocap_climb/mocap_climb_seq_0_original.npz

python viser_player.py --robot_urdf models/g1/g1_29dof_spherehand.urdf \
    --object_urdf demo_data/climb/mocap_climb_seq_0/multi_boxes_scaled_0.74_0.74_0.89.urdf \
    --qpos_npz demo_results_parallel/g1/climbing/mocap_climb/mocap_climb_seq_0_z_scale_1.2.npz

# Visualize robot only results
python viser_player.py --robot_urdf models/g1/g1_29dof.urdf \
    --qpos_npz demo_results_parallel/g1/robot_only/omomo/sub3_largebox_003_original.npz

# Visualize LAFAN robot only results
python viser_player.py --robot_urdf models/g1/g1_29dof.urdf \
    --qpos_npz demo_results/g1/robot_only/lafan/dance2_subject1.npz

# Visualize AMASS results
python viser_player.py --robot_urdf models/g1/g1_29dof.urdf \
    --qpos_npz demo_results/g1/robot_only/amass_smplx/HumanEva_S3_Jog_1_stageii.npz

# Visualize AMASS results
python viser_player.py --robot_urdf models/g1/g1_29dof.urdf \
    --qpos_npz demo_results_parallel/g1/robot_only/amass_smplx/HumanEva_S1_Box_1_stageii_original.npz

Quantitative Evaluation

# Evaluate robot-object interaction
python evaluation/eval_retargeting.py --res_dir demo_results_parallel/g1/object_interaction/omomo --data_dir demo_data/OMOMO_new --data_type "robot_object"

# Evaluate climbing sequence
python evaluation/eval_retargeting.py --res_dir demo_results_parallel/g1/climbing/mocap_climb --data_dir demo_data/climb --data_type "robot_terrain" --robot-config.robot-urdf-file models/g1/g1_29dof_spherehand.urdf

# Evaluate robot only (OMOMO)
python evaluation/eval_retargeting.py --res_dir demo_results_parallel/g1/robot_only/omomo --data_dir demo_data/OMOMO_new --data_type "robot_only"

Prepare Data for Training RL Whole-Body Tracking Policy

To prepare data for training RL whole-body tracking policies, you need to follow a two-step process:

  1. First, run retargeting to obtain .npz files containing the retargeted robot motion. Use the retargeting commands shown in the sections above (Single Sequence Motion Retargeting or Batch Processing for Motion Retargeting).

  2. Then, run the data conversion code below to convert the retargeted .npz files into the format required for RL training. The conversion script takes the retargeted .npz files as input and outputs converted files with the specified frame rate and format.

Note: If you run this code on Mac, please use mjpython instead of python.

Mac (using mjpython)

mjpython data_conversion/convert_data_format_mj.py --input_file ./demo_results/g1/robot_only/omomo/sub3_largebox_003.npz --output_fps 50 --output_name converted_res/robot_only/sub3_largebox_003_mj_fps50.npz --data_format smplh --object_name "ground" --once

mjpython data_conversion/convert_data_format_mj.py --input_file ./demo_results/g1/object_interaction/omomo/sub3_largebox_003_original.npz --output_fps 50 --output_name converted_res/object_interaction/sub3_largebox_003_mj_w_obj.npz --data_format smplh --object_name "largebox" --has_dynamic_object --once

Robot-Only Setting

python data_conversion/convert_data_format_mj.py --input_file ./demo_results/g1/robot_only/omomo/sub3_largebox_003.npz --output_fps 50 --output_name converted_res/robot_only/sub3_largebox_003_mj_fps50.npz --data_format smplh --object_name "ground" --once

python data_conversion/convert_data_format_mj.py --input_file ./demo_results/g1/robot_only/lafan/dance2_subject1.npz --output_fps 50 --output_name converted_res/robot_only/dance2_subject1_mj_fps50.npz --data_format lafan --object_name "ground" --once

Robot-Object Setting

python data_conversion/convert_data_format_mj.py --input_file ./demo_results/g1/object_interaction/omomo/sub3_largebox_003_original.npz --output_fps 50 --output_name converted_res/object_interaction/sub3_largebox_003_mj_w_obj.npz --data_format smplh --object_name "largebox" --has_dynamic_object --once

OmniRetarget Data

For OmniRetarget data downloaded from HuggingFace, please add --use_omniretarget_data for data conversion.

python data_conversion/convert_data_format_mj.py --input_file OmniRetarget/robot-object/sub3_largebox_003_original.npz --output_fps 50 --output_name converted_res/object_interaction/sub3_largebox_003_mj_w_obj_omnirt.npz --data_format smplh --object_name "largebox" --has_dynamic_object --use_omniretarget_data --once

Custom Human Motion Data Format

Please see the instructions for custom human motion data formats: ADD_MOTION_FORMAT_README.md

Custom Robot Type

Please see the instructions for retargeting custom robot types: ADD_ROBOT_TYPE_README.md

Release files for holosoma-retargeting 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for holosoma-retargeting 0.1.0
File Size Uploaded
holosoma_retargeting-0.1.0.tar.gz 102.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for holosoma-retargeting 0.1.0
File Interpreter ABI Platform
holosoma_retargeting-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 204.8 MB

Release files / holosoma_retargeting-0.1.0.tar.gz

Download URL holosoma_retargeting-0.1.0.tar.gz
Size 102.5 MB
Tags Source
SHA-256 checksum
How to use checksums
982184accabcdcf60877223139272b4ae1b028836b40eeb91abb5b6f5693437a
BLAKE2b-256 checksum
How to use checksums
5ef64a31c0a7502d6ce413b3b7bb51badd3b26e120fb48907901588bbc054311
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / holosoma_retargeting-0.1.0-py3-none-any.whl

Download URL holosoma_retargeting-0.1.0-py3-none-any.whl
Size 102.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
3dcdcc06c6705c091478808024298dfcc684d9eb49e890cc6b11fc03fa246cb4
BLAKE2b-256 checksum
How to use checksums
9cff027e5fe0e7c91af2da6ded1dffa71d9a1da68ea70f86926dcc30f148a701
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page