Holosoma 开源人形机器人强化学习训练部署框架

系列文章目录

目录

系列文章目录

前言

一、功能特性

二、文档

[2.1 Holosoma 训练框架](#2.1 Holosoma 训练框架)

[2.1.1 训练](#2.1.1 训练)

[2.1.1.1 运动控制(速度跟踪)](#2.1.1.1 运动控制(速度跟踪))

[2.1.1.2 MJWarp运动训练(速度追踪)](#2.1.1.2 MJWarp运动训练(速度追踪))

[2.1.1.3 全身追踪](#2.1.1.3 全身追踪)

[2.1.2 评估](#2.1.2 评估)

[2.1.2.1 训练内评估](#2.1.2.1 训练内评估)

[2.1.2.2 跨模拟器评估(MuJoCo)](#2.1.2.2 跨模拟器评估(MuJoCo))

[2.1.3 高级配置](#2.1.3 高级配置)

[2.1.3.1 使用 Weights & Biases 进行日志记录](#2.1.3.1 使用 Weights & Biases 进行日志记录)

[2.1.3.2 视频记录](#2.1.3.2 视频记录)

[2.1.3.3 地形](#2.1.3.3 地形)

[2.1.3.4 多GPU训练](#2.1.3.4 多GPU训练)

[2.1.3.5 自定义奖励权重](#2.1.3.5 自定义奖励权重)

[2.1.3.6 观测噪声](#2.1.3.6 观测噪声)

[2.1.3.7 观测历史长度](#2.1.3.7 观测历史长度)

[2.1.3.8 课程学习](#2.1.3.8 课程学习)

[2.1.3.9 域随机化](#2.1.3.9 域随机化)

[2.2 Holosoma 推理](#2.2 Holosoma 推理)

[2.2.1 支持策略](#2.2.1 支持策略)

[2.2.2 快速入门](#2.2.2 快速入门)

[2.2.2.1 环境配置](#2.2.2.1 环境配置)

[2.2.2.2 选择您的工作流程](#2.2.2.2 选择您的工作流程)

实体机器人部署

仿真(MuJoCo)

[2.2.3 策略控制](#2.2.3 策略控制)

[2.2.3.1 通用控制](#2.2.3.1 通用控制)

[2.2.3.2 运动(速度追踪)](#2.2.3.2 运动(速度追踪))

[2.2.3.3 全身动作追踪](#2.2.3.3 全身动作追踪)

[2.2.3.4 仅限摇杆功能](#2.2.3.4 仅限摇杆功能)

[2.2.4 配置覆盖](#2.2.4 配置覆盖)

[2.2.4.1 从Wandb加载ONNX检查点](#2.2.4.1 从Wandb加载ONNX检查点)

语法:

G1运动示例:

[使用 Wandb HTTPS URL 的示例:](#使用 Wandb HTTPS URL 的示例:)

[2.2.4.2 查找网络接口](#2.2.4.2 查找网络接口)

常见接口名称:

[2.2.4.3 观察历史长度 (> 1)](#2.2.4.3 观察历史长度 (> 1))

[2.2.4.4 覆盖控制增益](#2.2.4.4 覆盖控制增益)

[G1 29自由度自定义控制增益](#G1 29自由度自定义控制增益)

[T1 29自由度系统(含定制控制增益)](#T1 29自由度系统(含定制控制增益))

[2.3 Holosoma 动作重定位](#2.3 Holosoma 动作重定位)

[2.3.1 单序列运动重定位](#2.3.1 单序列运动重定位)

[2.3.2 动作重新定位的批量处理](#2.3.2 动作重新定位的批量处理)

[2.3.3 数据准备](#2.3.3 数据准备)

[2.3.3.1 OMOMO](#2.3.3.1 OMOMO)

[2.3.3.2 LAFAN](#2.3.3.2 LAFAN)

下载原始LAFAN数据

[转换原始 LAFAN 数据格式以进行动作重定位](#转换原始 LAFAN 数据格式以进行动作重定位)

LAFAN数据的单序列重定位

LAFAN平台上运动重定位的批量处理

[2.3.3.3 查看已保存的再营销结果可视化效果](#2.3.3.3 查看已保存的再营销结果可视化效果)

[2.3.3.4 定量评估](#2.3.3.4 定量评估)

[2.3.3.5 为训练RL全身追踪策略准备数据](#2.3.3.5 为训练RL全身追踪策略准备数据)

Mac(使用mjpython)

机器人设置

机器人物体设置

OmniRetarget数据


前言

Holosoma(希腊语:"全身")是一个综合性人形机器人框架,用于在人形机器人上训练和部署强化学习策略,并支持动作重定位。该框架支持跨多个模拟器(IsaacGym、IsaacSim、MJWarp、MuJoCo)的运动(速度跟踪)和全身跟踪任务,采用PPO和FastSAC等算法。


一、功能特性

  • 支持多仿真器:IsaacGym、IsaacSim、MuJoCo Warp(MJWarp)及MuJoCo(仅限推理)
  • 多种强化学习算法:PPO与FastSAC
  • 机器人支持:Unitree G1与Booster T1人形机器人
  • 任务类型:运动控制(速度追踪)与全身追踪
  • 仿真间与仿真到真实部署:仿真与真实机器人控制共享推理管道
  • 动作重定位:将人体动作捕捉数据转换为机器人动作,同时保留与物体及地形的交互
  • Wandb集成:视频日志记录、自动ONNX检查点上传,以及直接从Wandb加载检查点

二、文档

2.1 Holosoma 训练框架

面向人形机器人的强化学习核心训练框架,支持运动控制(速度跟踪)与全身运动跟踪任务。

Category Supported Options
Simulators IsaacGym, IsaacSim, MJWarp (training) | Mujoco (evaluation)
Algorithms PPO, FastSAC
Robots Unitree G1, Booster T1

2.1.1 训练

所有训练/评估脚本均支持 --help 参数以查看可用选项,例如:python src/holosoma/holosoma/train_agent.py --help。

2.1.1.1 运动控制(速度跟踪)

训练机器人执行速度指令跟踪任务。

bash 复制代码
# G1 with FastSAC on IsaacGym
source scripts/source_isaacgym_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:g1-29dof-fast-sac \
    simulator:isaacgym \
    logger:wandb \
    --training.seed 1

# T1 with PPO on IsaacSim
source scripts/source_isaacsim_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:t1-29dof \
    simulator:isaacsim \
    logger:wandb \
    --training.seed 1

保存检查点后,您可通过训练期间评估(使用与训练相同的模拟器)或在MuJoCo中进行跨模拟器评估来验证策略(参见holosoma_inference)。

2.1.1.2 MJWarp运动训练(速度追踪)

使用MJWarp模拟器(GPU加速版MuJoCo)进行训练。注意:MJWarp支持功能尚处于测试阶段。

bash 复制代码
# G1 with FastSAC
source scripts/source_mujoco_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:g1-29dof-fast-sac \
    simulator:mjwarp \
    logger:wandb

# G1 with PPO
source scripts/source_mujoco_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:g1-29dof \
    simulator:mjwarp \
    logger:wandb

# T1 with FastSAC
source scripts/source_mujoco_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:t1-29dof-fast-sac \
    simulator:mjwarp \
    logger:wandb

# T1 with PPO
source scripts/source_mujoco_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:t1-29dof \
    simulator:mjwarp \
    logger:wandb \
    --terrain.terrain-term.scale-factor=0.5  # required to avoid training instabilities

注意:

  • MJWarp默认使用nconmax=96(每个环境的最大接触数)。如有需要,可通过--simulator.config.mujoco-warp.nconmax-per-env=96进行调整。
  • 示例中使用 --training.num-envs=4096,但需根据硬件配置调整该值。
  • 在混合地形上使用 PPO 训练 T1 时,请设置 --terrain.terrain-term.scale-factor=0.5 以避免训练不稳定。
2.1.1.3 全身追踪

训练机器人追踪全身动作序列。

注意:目前仅支持Unitree G1 / IsaacSim。

bash 复制代码
# G1 with FastSAC
source scripts/source_isaacsim_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:g1-29dof-wbt-fast-sac \
    logger:wandb

# G1 with PPO
source scripts/source_isaacsim_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:g1-29dof-wbt \
    logger:wandb

# Custom motion file
source scripts/source_isaacsim_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:g1-29dof-wbt \
    logger:wandb \
    --command.setup_terms.motion_command.params.motion_config.motion_file="holosoma/data/motions/g1_29dof/whole_body_tracking/<your file>.npz"

保存检查点后,您可通过训练内评估(使用与训练相同的模拟器)或在MuJoCo中进行跨模拟器评估(参见holosoma_inference)来评估策略。

2.1.2 评估

2.1.2.1 训练内评估

若需使用与训练完全相同的配置(包括模拟器、环境设置等)评估策略:

bash 复制代码
# Evaluate checkpoint from Wandb
python src/holosoma/holosoma/eval_agent.py \
    --checkpoint=wandb://<ENTITY>/<PROJECT>/<RUN_ID>/<CHECKPOINT_NAME>
# e.g., --checkpoint=wandb://username/fastsac-t1-locomotion/abcdefgh/model_0010000.pt

# Evaluate local checkpoint
python src/holosoma/holosoma/eval_agent.py \
    --checkpoint=<CHECKPOINT_PATH>
# e.g., --checkpoint=/home/username/checkpoints/fastsac-t1-locomotion/model_0010000.pt

此评估模式:

  • 自动从检查点加载训练配置
  • 在与训练相同的模拟器和环境中运行评估
  • 可将策略导出为ONNX格式(通过--training.export_onnx=True)
  • 对于移动评估,支持通过键盘交互式速度命令(当模拟器窗口处于活动状态时):
    • w/a/s/d:线性速度命令
    • q/e:角速度指令
    • z:零速度指令
2.1.2.2 跨模拟器评估(MuJoCo)

若需在MuJoCo模拟中测试训练策略或部署至真实机器人,请参阅holosoma_inference文档。内容涵盖:

  • 模拟器间评估(IsaacGym/IsaacSim → MuJoCo)
  • 真实机器人部署(含运动控制与WBT)

注意:ONNX策略通常在训练期间与.pt检查点一同导出,也可通过上述训练中评估脚本生成。

2.1.3 高级配置

训练系统采用分层配置体系。exp配置文件作为主入口,内含针对各算法和机器人的默认配置。您可通过命令行覆盖参数自定义训练。

提示:组合 Tyro 配置时,请将 exp:<名称> 预设置于其他配置片段(如 logger:wandb)之前。Tyro 要求先声明基础实验,顺序颠倒可能导致解析错误。

2.1.3.1 使用 Weights & Biases 进行日志记录
bash 复制代码
source scripts/source_isaacsim_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:g1-29dof \
    simulator:isaacsim \
    --training.seed 1 \
    --algo.config.use-symmetry=False \
    logger:wandb \
    --logger.project locomotion-g1-29dof-ppo \
    --logger.name ppo-without-symmetry-seed1
2.1.3.2 视频记录

视频录制默认处于启用状态。视频将保存至本地,并在启用时上传至Wandb。为获得最佳性能,可通过--logger.video.enabled=False参数禁用视频记录功能。

bash 复制代码
source scripts/source_isaacgym_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:g1-29dof-fast-sac \
    simulator:isaacgym \
    logger:wandb \
    --logger.video.enabled=True \
    --logger.video.interval=5

视频记录参数:

  • --logger.video.enabled=True - 启用视频录制
  • --logger.video.interval=5 - 每5集录制一次视频
  • 使用logger:wandb时,视频将自动上传至Wandb
2.1.3.3 地形
bash 复制代码
# Use plane terrain instead of mixed terrain
source scripts/source_isaacgym_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:g1-29dof-fast-sac \
    simulator:isaacgym \
    terrain:terrain-locomotion-plane
2.1.3.4 多GPU训练
bash 复制代码
source scripts/source_isaacgym_setup.sh
torchrun --nproc_per_node=4 src/holosoma/holosoma/train_agent.py \
    exp:t1-29dof-fast-sac \
    simulator:isaacgym \
    --training.num-envs 16384  # global/total number of environments
2.1.3.5 自定义奖励权重
bash 复制代码
source scripts/source_isaacgym_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:g1-29dof-fast-sac \
    simulator:isaacgym \
    --reward.terms.tracking-lin-vel.weight=2.5 \
    --reward.terms.feet-phase.params.swing-height=0.12
2.1.3.6 观测噪声
bash 复制代码
# Disable observation noise
source scripts/source_isaacgym_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:g1-29dof-fast-sac \
    simulator:isaacgym \
    --observation.groups.actor-obs.enable-noise=False
2.1.3.7 观测历史长度

某些策略可通过叠加多个观测时间步长获得提升。您可通过以下方式增加训练过程中使用的历史长度:

bash 复制代码
source scripts/source_isaacgym_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:g1-29dof-fast-sac \
    simulator:isaacgym \
    --observation.groups.actor_obs.history-length 4

运行推理时请确保传递相同的历史长度,以便导出的ONNX策略接收形状正确的输入。

2.1.3.8 课程学习
bash 复制代码
# Disable curriculum
source scripts/source_isaacgym_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:g1-29dof-fast-sac \
    simulator:isaacgym \
    --curriculum.setup-terms.penalty-curriculum.params.enabled=False

# Custom curriculum threshold (for shorter episodes)
source scripts/source_isaacgym_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:g1-29dof-fast-sac \
    simulator:isaacgym \
    --simulator.config.sim.max-episode-length-s=10.0 \
    --curriculum.setup-terms.penalty-curriculum.params.level-up-threshold=350
2.1.3.9 域随机化
bash 复制代码
source scripts/source_isaacgym_setup.sh
python src/holosoma/holosoma/train_agent.py \
    exp:g1-29dof-fast-sac \
    simulator:isaacgym \
    --randomization.setup-terms.push-randomizer-state.params.enabled=False \
    --randomization.setup-terms.randomize-base-com-startup.params.enabled=True \
    --randomization.setup-terms.mass-randomizer.params.added-mass-range=[-1.0,3.0]

2.2 Holosoma 推理

人形机器人策略的策略推理。

2.2.1 支持策略

Robot Locomotion WBT
Unitree G1
Booster T1
Simulator Locomotion WBT
IsaacGym
IsaacSim
MuJoCo (inference only)
  • ✅ (full support)
  • 🚧 (in progress/partial support)
  • ❌ (no support)

2.2.2 快速入门

2.2.2.1 环境配置
bash 复制代码
cd ~/holosoma
bash scripts/setup_inference.sh             # Create a virtual environment with all dependencies
source scripts/source_inference_setup.sh    # Activate the virtual environment
2.2.2.2 选择您的工作流程

根据您的设置选择相应的工作流程指南:

实体机器人部署
  • 实体机器人运动控制 - 在实体Unitree G1或Booster T1机器人上运行运动策略
  • 实体机器人全身追踪 - 在实体Unitree G1机器人上运行全身追踪策略
仿真(MuJoCo)
  • 模拟到模拟运动控制 - 在MuJoCo仿真中测试运动策略
  • 模拟到模拟全身追踪 - 在MuJoCo仿真中测试全身追踪策略

每份工作流指南包含:

  • 硬件/环境配置说明
  • 分步操作指令
  • 控制参数参考
  • 部署选项(离线/在线/Docker)
  • 故障排除技巧

2.2.3 策略控制

用于在执行过程中控制策略的命令。

重要提示:所有使用键盘的策略控制操作均应在策略终端(即运行 run_policy.py 的位置)中输入,而非在 MuJoCo 窗口中操作。MuJoCo 拥有独立的模拟控制功能(详见工作流文档)。

2.2.3.1 通用控制
Action Keyboard Joystick
Start the policy ] A button
Stop the policy o B button
Set robot to default pose i Y button
Kill controller program - L1 (LB) + R1 (RB)
2.2.3.2 运动(速度追踪)
Action Keyboard Joystick
Switch walking/standing = Start button
Adjust linear velocity w a s d Left stick
Adjust angular velocity q e Right stick

默认姿势:站立姿势

2.2.3.3 全身动作追踪
Action Keyboard Joystick
Start the policy ] A button
Start motion clip s Start button

默认姿势:双臂上举站立姿态

2.2.3.4 仅限摇杆功能
  • 选择按钮:在多个策略加载时切换策略

2.2.4 配置覆盖

2.2.4.1 从Wandb加载ONNX检查点

可直接从Wandb加载ONNX检查点,无需手动下载。此功能适用于快速测试训练运行中的模型。

语法:
bash 复制代码
--task.model-path wandb://entity/project_name/run_id/model.onnx
G1运动示例:
bash 复制代码
source scripts/source_inference_setup.sh
python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:g1-29dof-loco \
    --task.model-path wandb://my-username/my-project/run-abc123/fastsac_g1_29dof.onnx \
    --task.use-joystick \
    --task.interface eth0
使用 Wandb HTTPS URL 的示例:
bash 复制代码
python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:g1-29dof-loco \
    --task.model-path https://wandb.ai/username/project/runs/abc123/files/model.onnx \
    --task.use-joystick \
    --task.interface eth0

模型将自动下载并缓存至本地。实体指您的Wandb用户名或组织名称。

2.2.4.2 查找网络接口

--task.interface 参数用于指定与机器人通信时使用的网络接口。正确接口名称因计算机和网卡而异。

常见接口名称:
  • eth0 - 常见以太网接口名称
  • enp0s31f6 - 现代 Linux 以太网命名规范
  • lo - 循环接口(用于模拟机间通信)

查找接口名称的方法:

bash 复制代码
ifconfig

查找连接至机器人网络的接口。对于真实机器人部署,请使用与机器人处于同一子网的IP地址接口;对于sim2sim部署,请使用回环接口(lo)。

2.2.4.3 观察历史长度 (> 1)

若策略采用堆叠观察数据训练(例如历史长度为4),则推理时必须传递相同的历史长度,确保观察张量与模型预期输入尺寸匹配。

示例:

bash 复制代码
python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:g1-29dof-wbt \
    --task.model-path <path-to-model>.onnx \
    --task.interface eth0 \
    --observation.history_length_dict.actor_obs=4

覆盖设置会在ONNX会话初始化前更新actor_obs缓冲区,因此任何策略(移动策略或WBT)都能在更长的观察历史下运行------前提是底层模型是按此方式训练的。

2.2.4.4 覆盖控制增益

默认情况下,控制增益(kp/kd)从ONNX模型元数据加载。您可在配置中覆盖这些值:

G1 29自由度自定义控制增益
bash 复制代码
python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:g1-29dof-loco \
    --task.model-path src/holosoma_inference/holosoma_inference/models/loco/g1_29dof/fastsac_g1_29dof.onnx \
    --robot.motor-kp 40.2 99.1 40.2 99.1 28.5 28.5 40.2 99.1 40.2 99.1 28.5 28.5 40.2 28.5 28.5 14.3 14.3 14.3 14.3 14.3 16.8 16.8 14.3 14.3 14.3 14.3 14.3 16.8 16.8 \
    --robot.motor-kd 2.6 6.3 2.6 6.3 1.8 1.8 2.6 6.3 2.6 6.3 1.8 1.8 2.6 1.8 1.8 0.9 0.9 0.9 0.9 0.9 1.1 1.1 0.9 0.9 0.9 0.9 0.9 1.1 1.1
T1 29自由度系统(含定制控制增益)
bash 复制代码
python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:t1-29dof-loco \
    --task.model-path src/holosoma_inference/holosoma_inference/models/loco/t1_29dof/ppo_t1_29dof.onnx \
    --robot.motor-kp 5.0 5.0 20.0 20.0 20.0 20.0 20.0 20.0 20.0 20.0 20.0 20.0 20.0 20.0 20.0 20.0 200.0 200.0 200.0 200.0 200.0 50.0 50.0 200.0 200.0 200.0 200.0 50.0 50.0 \
    --robot.motor-kd 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 5.0 5.0 5.0 5.0 5.0 3.0 3.0 5.0 5.0 5.0 5.0 3.0 3.0

注意:当控制增益未指定时,系统将自动从ONNX模型元数据中加载增益值。这是推荐的做法,因为它能确保增益值与训练过程中使用的增益值保持一致。

2.3 Holosoma 动作重定位

本仓库提供将人体动作数据重定位至人形机器人的工具。支持多种数据格式(smplh、mocap、lafn)及任务类型,包括纯机器人动作、物体交互和攀爬。

数据要求:重定位流程需基于世界坐标系关节位置的运动数据。自定义数据需准备形状为(T, J, 3)的世界关节位置数据(其中T为帧数,J为关节数),并修改config_types/data_type.py中定义的demo_joints和joints_mapping。

2.3.1 单序列运动重定位

bash 复制代码
# 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

注意:添加 --augmentation 参数可运行带数据增强的序列。必须先运行原始序列,再添加增强数据。

2.3.2 动作重新定位的批量处理

bash 复制代码
# 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

注意:添加 --augmentation 参数可运行原始序列及增强序列(适用于物体交互和攀爬任务)。

2.3.3 数据准备

我们提供 demo_data/ 目录用于快速测试。若需测试更多动作序列,请按以下说明下载并准备数据。

2.3.3.1 OMOMO

我们的管道采用InterMimic处理的数据集,其格式与原始OMOMO数据集不同。

  1. 此链接下载处理后的OMOMO数据
  2. 将下载文件夹解压至demo_data/OMOMO_new

数据应包含.pt文件。

2.3.3.2 LAFAN
下载原始LAFAN数据
  1. 点击"View Raw"下载 lafan1.zip
  2. lafan1.zip 放置于指定数据文件夹并解压至 DATA_FOLDER_PATH/lafan
  3. 文件结构应为 demo_data/lafan/*.bvh
转换原始 LAFAN 数据格式以进行动作重定位

需从 LAFAN GitHub 仓库获取部分数据处理文件。

bash 复制代码
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

这将把BVH文件转换为包含全局关节位置的.npy格式。

注意:对于LAFAN数据,需要通过设置--retargeter.foot-sticking-tolerance参数来放宽脚部粘连约束(默认设置更严格)。可根据数据质量和重定位结果调整该容差值。

LAFAN数据的单序列重定位
bash 复制代码
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
LAFAN平台上运动重定位的批量处理
bash 复制代码
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
2.3.3.3 查看已保存的再营销结果可视化效果
bash 复制代码
# 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
2.3.3.4 定量评估
bash 复制代码
# 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"
2.3.3.5 为训练RL全身追踪策略准备数据

为训练RL全身追踪策略准备数据时,需遵循两步流程:

  1. 首先运行重定位以获取包含重定位机器人动作的.npz文件。使用上文章节(单序列动作重定位或动作重定位批处理)中展示的重定位命令。
  2. 其次,运行下方数据转换代码,将重定位后的.npz文件转换为RL训练所需格式。该转换脚本以重定位.npz文件为输入,输出指定帧率和格式的转换文件。

注意:若在Mac系统运行此代码,请使用mjpython替代python。

Mac(使用mjpython)
bash 复制代码
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
机器人设置
bash 复制代码
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
机器人物体设置
bash 复制代码
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数据

从HuggingFace下载的OmniRetarget数据,请添加--use_omniretarget_data参数进行数据转换。

bash 复制代码
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
相关推荐
NAGNIP3 小时前
一文搞懂深度学习中的通用逼近定理!
人工智能·算法·面试
冬奇Lab5 小时前
一天一个开源项目(第36篇):EverMemOS - 跨 LLM 与平台的长时记忆 OS,让 Agent 会记忆更会推理
人工智能·开源·资讯
冬奇Lab5 小时前
OpenClaw 源码深度解析(一):Gateway——为什么需要一个"中枢"
人工智能·开源·源码阅读
AngelPP8 小时前
OpenClaw 架构深度解析:如何把 AI 助手搬到你的个人设备上
人工智能
宅小年8 小时前
Claude Code 换成了Kimi K2.5后,我再也回不去了
人工智能·ai编程·claude
九狼9 小时前
Flutter URL Scheme 跨平台跳转
人工智能·flutter·github
ZFSS9 小时前
Kimi Chat Completion API 申请及使用
前端·人工智能
天翼云开发者社区10 小时前
春节复工福利就位!天翼云息壤2500万Tokens免费送,全品类大模型一键畅玩!
人工智能·算力服务·息壤
知识浅谈10 小时前
教你如何用 Gemini 将课本图片一键转为精美 PPT
人工智能
Ray Liang11 小时前
被低估的量化版模型,小身材也能干大事
人工智能·ai·ai助手·mindx