# 训练数据格式：LeRobot、RLDS 及同类格式

> 机器人学习数据集如何存放 episode、多相机视频、状态和动作：LeRobotDataset v2.1 与 v3.0、RLDS 与 Open X-Embodiment、MCAP 与 rosbag2、HDF5（robomimic、ACT、EgoDex）、Zarr 与 WebDataset，人的第一人称位姿如何变成动作向量，以及如何选择导出格式。

Page: https://egocam.ai/zh-cn/processing/training-formats-lerobot-rlds/

[录制容器](https://egocam.ai/zh-cn/capture-ops/recording-formats-vrs-mcap-gpmf/)是为采集而设计的：它按到达顺序追加带时间戳的数据包。**训练数据格式**是为策略学习而设计的：它组织成千上万乃至数百万个 episode，让数据加载器可以随机采样帧、切出短的时间窗口、对状态和动作做归一化，而不必打开数百万个小文件。VRS、MCAP 的字节布局和 GPMF 在[录制容器格式页面](https://egocam.ai/zh-cn/capture-ops/recording-formats-vrs-mcap-gpmf/)上；本页讲训练这一侧。

当前公开的第一人称数据发布常常为同一批录制提供两种封装形式。Lightwheel 的仅头部的 [EgoStandard](https://huggingface.co/datasets/LightwheelAI/EgoStandard) 和头戴加腕戴的 [EgoPro](https://huggingface.co/datasets/LightwheelAI/EgoPro) 同时以 MCAP 和 LeRobot 数据集的形式发布，两张数据集卡片都提醒："LeRobot and MCAP are alternative representations of the same episodes and must not be counted as additional hours."（意为：LeRobot 和 MCAP 是同一批 episode 的两种可互换的封装形式，不得算作额外的小时数。）其他发布只选一种：每个 episode 一个 MCAP（[Gen-HumanEgo](https://huggingface.co/datasets/genrobot2025/Gen-HumanEgo)），MP4 加 HDF5（[Xperience-10M](https://huggingface.co/datasets/ropedia-ai/xperience-10m)），或者对纯视频语料使用 WebDataset 分片（[Egocentric-10K](https://huggingface.co/datasets/builddotai/Egocentric-10K)）。这些采集设备在[当前的采集设备（2025–2026）](https://egocam.ai/zh-cn/hardware/current-capture-rigs/)中介绍。

简而言之：

- **LeRobotDataset v3.0**：用于 PyTorch 模仿学习、[视觉-语言-动作](https://egocam.ai/zh-cn/robot-learning/vla-pretraining-on-human-video/)（VLA）微调，以及在 Hugging Face Hub 上发布。
- **MCAP**：当 episode 带有不同速率的数据流、[标定](https://egocam.ai/zh-cn/calibration/calibration-in-datasets/)、自定义位姿消息或人们在训练前要检查的质量标志时，与前者并列提供。
- **MP4 加 HDF5**，或 **Zarr**：当训练循环直接读取稠密的逐帧数组（骨架、深度、轨迹）时使用。
- **RLDS**：主要用于读取已有的 TensorFlow 机器人数据集，例如 [Open X-Embodiment](https://arxiv.org/abs/2310.08864v5)；LeRobot 的文档讲了如何转换它们（[Porting datasets to v3](https://huggingface.co/docs/lerobot/porting_datasets_v3)）。

## 本页使用的术语

要在一处查看实用指南按主题分组的全部术语，见[术语表](https://egocam.ai/zh-cn/reference/glossary/)。

| 术语 | 含义 |
| :--- | :--- |
| **Episode**（trajectory 轨迹，demonstration 示范） | 对一项任务从头到尾的一次连续录制：一串时间对齐的观测和动作。 |
| **分片（Shard）**（chunk file，块文件） | 一个大文件（Parquet、MP4、TFRecord、`.tar`），打包了许多 episode，这样存储系统处理的是数量更少、体积更大的文件。 |
| **Feature（特征字段）** | 一个有名字的逐帧字段，带有 dtype 和 shape，例如 `observation.state` 或 `observation.images.<camera>`。在 LeRobot 中，所有 feature 的模式定义放在 `meta/info.json` 里。 |
| **`observation.state`** | 描述智能体构型的逐帧向量：对机器人是关节角和夹爪开口；对人手是手腕位姿和手指关节。 |
| **`action`** | 某一时间步的指令或运动目标，可以是绝对的（一个目标位姿），也可以是相对的（到下一帧的变化量）。 |
| **RLDS** | Reinforcement Learning Datasets（强化学习数据集）：Google 的 episode/step 约定，通过 TensorFlow Datasets（TFDS）构建和加载，以 TFRecord 分片存储。 |
| **动作块（Action chunk）** | 一起预测出来的若干未来动作，例如一秒内的 100 步。 |
| **MCAP** | 一种开放的容器，用于带时间戳的发布/订阅消息，内嵌模式定义，带有压缩的数据块和索引（[MCAP specification](https://mcap.dev/spec)）。 |
| **rosbag2** | ROS 2 的录制工具。MCAP 是它的默认存储插件（[rosbag2 README](https://github.com/ros2/rosbag2)）。 |
| **HDF5** | 一种单文件容器，存放有名字、有类型、按组排列的 n 维数组，在 Python 中用 `h5py` 读取。 |
| **Zarr** | 一种分块、压缩的 n 维数组格式，以许多对象的形式存放在目录、zip 文件或云存储桶中。 |
| **WebDataset** | 一种使用普通 `.tar` 分片的约定，其中文件名前缀相同的文件（`clip.mp4`、`clip.json`）构成一个样本，按顺序读取。 |

## 训练数据格式对比

| 格式 | 布局 | 视频 | 状态、位姿和标签 | 标定 | 参考工具的许可协议 | 示例 |
| :--- | :--- | :--- | :--- | :--- | :--- | :--- |
| **LeRobotDataset v3.0** | `data/chunk-*/file-*.parquet`、`videos/<camera>/chunk-*/file-*.mp4`、`meta/` | 每路相机的 MP4 分片，每个文件含许多 episode | Parquet 列；模式定义在 `meta/info.json`，统计量在 `meta/stats.json` | 没有标准字段；把额外的文件放在 `meta/` 里一起发布 | [lerobot](https://github.com/huggingface/lerobot)：Apache-2.0 | [RoboX lerobot-dataset](https://huggingface.co/datasets/RoboXTechnologies/lerobot-dataset)、移植后的 DROID |
| **LeRobotDataset v2.1** | 每个 episode 一个 Parquet，每路相机一个 MP4；JSON Lines 元数据 | 每个 episode 每路相机一个 MP4 | 每个 episode 一个 Parquet；逐 episode 的统计量在 `meta/episodes_stats.jsonl` | 相同：额外的文件放在 `meta/` 里 | 0.4.0 之前的 lerobot | [MundoAI-Robotics-Sample](https://huggingface.co/datasets/thomasmundo/MundoAI-Robotics-Sample/blob/main/README.md) |
| **RLDS（TFRecord）** | 由分片的 TFRecord 文件构成的 TFDS 数据集 | 每个 step 内的图像张量 | 由 step 组成的嵌套 episode（`observation`、`action`、`reward`、`discount`、`is_first`、`is_last`、`is_terminal`） | 未标准化 | [rlds](https://github.com/google-research/rlds)：Apache-2.0 | [Open X-Embodiment](https://arxiv.org/abs/2310.08864v5)、DROID 1.0.1 |
| **MCAP** | 每次录制一个自描述文件 | 每路相机各自话题上的压缩图像消息或视频消息 | 各自话题上带时间戳的消息（Protobuf、ROS 2 CDR、JSON） | `Attachment` 记录或标定话题 | [mcap](https://github.com/foxglove/mcap)：MIT | [Gen-HumanEgo](https://huggingface.co/datasets/genrobot2025/Gen-HumanEgo)、[EgoStandard](https://huggingface.co/datasets/LightwheelAI/EgoStandard) |
| **HDF5** | 每个数据集一个 `.hdf5` 文件（robomimic），或每个 episode 一个（ACT、[EgoDex](https://egocam.ai/zh-cn/datasets/robot-learning-datasets/)） | 文件内的 `uint8` 图像数组，或文件旁边的 MP4 文件 | 有名字的数组组 | 文件中的组或属性 | [robomimic](https://github.com/ARISE-Initiative/robomimic)：MIT；[ACT](https://github.com/tonyzhaozh/act)：MIT | robomimic、ACT、[EgoDex](https://arxiv.org/pdf/2505.11709)、[Xperience-10M](https://huggingface.co/datasets/ropedia-ai/xperience-10m) |
| **Zarr** | 由分块数组构成的目录、zip 或存储桶 | 数组块或外部视频 | 数组组 | 属性或数组 | [zarr-python](https://github.com/zarr-developers/zarr-python)：MIT | [UMI](https://github.com/real-stanford/universal_manipulation_interface) 回放缓冲区 |
| **WebDataset** | 由成对文件构成的 `.tar` 分片 | 分片内的 `.mp4` 文件 | 每个片段一个 `.json` 文件 | 分片之外的文件 | [webdataset](https://github.com/webdataset/webdataset)：BSD-3-Clause | [Egocentric-10K](https://huggingface.co/datasets/builddotai/Egocentric-10K)、[Egocentric-100K](https://huggingface.co/datasets/builddotai/Egocentric-100K) |
| **按片段分文件夹**（一家供应商的交付布局） | 每个片段一个文件夹，根目录有一份列出所有片段的文件清单 | 每路相机一个 `.mp4`（HEVC） | 手部和头部位姿用 `.npz` 数组，文字描述和元数据用 `.json`，另有一个文本或二进制的 IMU 文件 | 每个片段文件夹里一个 JSON 标定文件 | 无：普通的 MP4、NumPy 和 JSON | [Build AI shop deliveries](https://shop.build.ai/docs) |

许可协议是各 GitHub 仓库的许可协议，取自 GitHub API 在 2026 年 11 月 7 日的返回结果；数据集自身的许可协议在它的卡片上设定。

## LeRobotDataset

LeRobotDataset 是 Hugging Face 为 [lerobot](https://github.com/huggingface/lerobot) 库制定的数据集格式。3.0 版随 `lerobot >= 0.4.0` 提供（[LeRobotDataset v3.0 docs](https://huggingface.co/docs/lerobot/lerobot-dataset-v3)）；lerobot 0.4.0 发布于 2025 年 10 月 23 日，最新版本是 0.7.0（2026 年 11 月 5 日）。状态、动作和时间戳放在 Apache Parquet 表里，相机帧放在 MP4 里，元数据放在 JSON 和 Parquet 里。

### v2.1：每个 episode 一个文件

在 v2.x 中，每个 episode 都有自己的文件。lerobot 0.3.3 中的路径模板是 `data/chunk-{episode_chunk:03d}/episode_{episode_index:06d}.parquet` 和 `videos/chunk-{episode_chunk:03d}/{video_key}/episode_{episode_index:06d}.mp4`，另有 `meta/info.json`、`meta/episodes.jsonl` 和 `meta/tasks.jsonl`（[lerobot 0.3.3 `datasets/utils.py`](https://github.com/huggingface/lerobot/blob/v0.3.3/src/lerobot/datasets/utils.py)）。从 v2.0 到 v2.1 这一步把单个的 `meta/stats.json` 换成了逐 episode 的统计量：转换脚本 "Generate[s] per-episodes stats and writes them in `episodes_stats.jsonl`"（意为：生成逐 episode 的统计量，并写入 `episodes_stats.jsonl`），并删除 "the deprecated `stats.json`"（意为：已弃用的 `stats.json`）（[convert_dataset_v20_to_v21.py](https://github.com/huggingface/lerobot/blob/v0.3.3/src/lerobot/datasets/v21/convert_dataset_v20_to_v21.py)）。数百万个小文件会让文件系统和对象存储不堪重负，v3.0 解决了这个问题。

### v3.0：每个文件许多 episode

[LeRobotDataset v3.0 docs](https://huggingface.co/docs/lerobot/lerobot-dataset-v3) 解释说："To scale to millions of episodes, tabular rows and video frames from multiple episodes are concatenated into larger files."（意为：为了扩展到数百万个 episode，来自多个 episode 的表格行和视频帧被拼接成更大的文件。）episode 的边界来自元数据中的偏移量，而不是文件名。

```text
dataset/
├── meta/
│   ├── info.json                            # feature schema (names, dtypes, shapes), fps, codebase version, path templates
│   ├── stats.json                           # global mean/std/min/max per feature, used for normalisation
│   ├── tasks.parquet                        # natural-language tasks mapped to integer task_index
│   └── episodes/chunk-000/file-000.parquet  # per-episode lengths, tasks, and offsets into the data and video shards
├── data/
│   └── chunk-000/file-000.parquet           # frame-by-frame rows; many episodes per file
└── videos/
    └── <video_key>/chunk-000/file-000.mp4   # one MP4 stream per camera; many episodes per file
```

> **Diagram:** Why LeRobotDataset v3.0 changed the layout. In v2.1 every episode has its own Parquet file and one MP4 per camera, so the file count grows with episodes times cameras. In v3.0 many episodes are concatenated into each Parquet shard and each camera's MP4 shard, and a row in meta/episodes records each episode's length, task and offsets, which locate it as a row range in the data and a time range in the video. Shard sizes are lerobot's defaults. Sources: the LeRobotDataset v3.0 docs and lerobot's datasets/utils.py (v0.3.3 for v2.1, main for v3.0).

代码中的路径模式是 `chunk-{chunk_index:03d}/file-{file_index:03d}`，默认值为每个 chunk 1,000 个文件、每个数据文件 100 MB、每个视频文件 200 MB（[lerobot `datasets/utils.py`](https://github.com/huggingface/lerobot/blob/main/src/lerobot/datasets/utils.py)）。每一个帧行都带有五个默认 feature：`timestamp`（float32）、`frame_index`、`episode_index`、`index` 和 `task_index`（int64）（[lerobot `utils/constants.py`](https://github.com/huggingface/lerobot/blob/main/src/lerobot/utils/constants.py)）。相机 feature 命名为 `observation.images.<camera>`；例如，DROID 的移植版声明了 `observation.images.wrist_left`、`observation.images.exterior_1_left` 和 `observation.images.exterior_2_left`，dtype 为 `video`（[Porting datasets to v3](https://huggingface.co/docs/lerobot/porting_datasets_v3)）。

`meta/info.json` 没有存放相机内参或外参的字段（见[公开数据集如何提供标定](https://egocam.ai/zh-cn/calibration/calibration-in-datasets/)）。第一人称数据发布会在 `meta/` 下加入自己的文件：[MundoAI-Robotics-Sample](https://huggingface.co/datasets/thomasmundo/MundoAI-Robotics-Sample/blob/main/README.md) 把 "camera intrinsics + head-to-camera offset, keyed by device"（意为：相机内参加头部到相机的偏移，按设备索引）放在 `meta/calibrations/dev_003.json` 中，[RoboX 的数据集](https://huggingface.co/datasets/RoboXTechnologies/lerobot-dataset)加入了 `meta/robox_feature_semantics.json` 和 `meta/robox_training_hints.json` 来说明单位和归一化，并加入 `meta/robox_frame_masks.parquet` 存放逐帧的插补标志。

### 写入 v3.0 数据集：调用 `finalize()`

v3.0 以增量方式写入 Parquet，并缓冲 episode 元数据，所以："When creating or recording datasets, you must call dataset.finalize() to properly close parquet writers."（意为：创建或录制数据集时，必须调用 dataset.finalize() 来正确关闭 parquet 写入器。）在最后一次 `save_episode()` 之后、`push_to_hub()` 之前调用它；不调用的话，Parquet 文件不完整，数据集无法加载（[LeRobotDataset v3.0 docs](https://huggingface.co/docs/lerobot/lerobot-dataset-v3)）。

### 为训练读取数据

以下内容来自 [LeRobotDataset v3.0 docs](https://huggingface.co/docs/lerobot/lerobot-dataset-v3)：

- **时间窗口**。`delta_timestamps` 为每个 feature 接受以秒为单位的偏移量。使用 `{"observation.images.front_left": [-0.2, -0.1, 0.0]}` 时，每个样本返回一个 `[T, C, H, W]` 的堆叠，其中 T = 3。
- **Episode 边界**。LeRobot 的 `delta_window` 函数把每个窗口截断 "to the episode rows"（意为：到该 episode 的行范围内），并且 "Returns the clamped row indices and a boolean mask marking the positions that fell outside the episode and were padded with its first or last row"（意为：返回截断后的行索引，以及一个布尔掩码，标出落在 episode 之外、并用其第一行或最后一行填充的位置）（[lerobot `datasets/utils.py`](https://github.com/huggingface/lerobot/blob/main/src/lerobot/datasets/utils.py)）；这个掩码以 `<feature>_is_pad` 的形式到达样本。原因是，在 v3.0 的文件里，一个 episode 最后一帧之后的那一行是另一个 episode 的第一帧，往往是另一项任务或另一个场景。如果允许窗口继续往后走，就会把当前观测与从未跟在它后面的动作配成一对。自定义的加载器必须遵守同样的规则，而且被填充的位置是重复值，不是录到的运动。
- **流式读取**。在 Python 中用 `StreamingLeRobotDataset`，或在命令行上用 `--dataset.streaming=true`，可以不先下载就训练：episode 被取入一个有上限的内存池，每个被选中的帧在每个 epoch 中仍然只被访问一次。它也可以从 Hugging Face Storage Buckets（`hf://buckets/...`）读取。
- **图像增强**。`ColorJitter`、`SharpnessJitter`、`RandomAffine`、`MotionBlur` 和 `PlanckianJitter` 这类变换只在训练时运行；录制的帧在存储时不带这些变换。相机有好几路时，在数据加载器的 worker 里做增强可能让 GPU 空等；`--dataset.image_transforms.backend=gpu` 让 worker 只负责解码，并在 GPU 上按批运行变换。`gpu_compile`（默认开启）"costs 15-30 s once per image shape"（意为：每种图像形状一次性花费 15–30 秒）；`gpu_chunk_size`（默认 32）限制内存用量。
- **LanceDB 后端**。`lerobot-lancedb` 包把 v3.0 数据集转换成一张存放各行的 `frames` 表和一张以 blob 形式存放 MP4 的 `videos` 表；`meta/` 不变，`meta/info.json` 中的 `storage_format` 被设为 `lance`。转换的代价是 "about the cost of a file copy. Videos are not re-encoded, so items are bit-identical to the source. DROID converts in 34 minutes."（意为：大约相当于一次文件复制的代价。视频不重新编码，所以各项与源数据逐比特相同。DROID 的转换用时 34 分钟。）Lance 副本是只读的：录制和编辑要在默认格式下进行。

### 转换到 v3.0

- **从 v2.1**：`python -m lerobot.scripts.convert_dataset_v21_to_v30 --repo-id=<HF_USER/DATASET_ID>` 把逐 episode 的 Parquet 和 MP4 文件合并成 `file-NNN` 分片，并写入 `meta/episodes/`（[LeRobotDataset v3.0 docs](https://huggingface.co/docs/lerobot/lerobot-dataset-v3)）。
- **从 RLDS，大规模转换**：[移植指南](https://huggingface.co/docs/lerobot/porting_datasets_v3)以 DROID 1.0.1 为例（来自 Franka Emika Panda 机器人的 76,000 多条轨迹；原始数据 8.7 TB，作为 RLDS 是 1.7 TB，分成 2,048 个 TensorFlow 数据集分片）。在一台机器上，移植需要 7 天以上，上传需要 3 天以上，输出约 400 GB，所以该指南使用带 `datatrove` 的 SLURM 作业：先 `slurm_port_shards.py --workers 2048 --cpus-per-task 8 --mem-per-cpu 1950M`，然后 `slurm_aggregate_shards.py`，再 `slurm_upload.py --workers 50`。

## Hugging Face Hub 的约定

Hub 上的一个数据集是一个 Git 仓库，带有一张 `README.md` 卡片，卡片的 YAML 头部设定许可协议、标签，并在 `configs` 下设定 Dataset Viewer 和 `datasets` 库加载哪些文件。例如，MundoAI 的卡片声明了 `license: cc-by-4.0`、标签 `LeRobot`，以及带有 `path: data/chunk-*/episode_*.parquet` 的 `data_files`（[MundoAI-Robotics-Sample](https://huggingface.co/datasets/thomasmundo/MundoAI-Robotics-Sample/blob/main/README.md)）。数据集可以设置访问门槛，要求先接受条件，[RoboX](https://huggingface.co/datasets/RoboXTechnologies/lerobot-dataset)、MundoAI 和 [Gen-HumanEgo](https://huggingface.co/datasets/genrobot2025/Gen-HumanEgo) 就是这样。非 LeRobot 的数据用 `datasets` 库读取（[huggingface/datasets](https://github.com/huggingface/datasets)，Apache-2.0）；Build AI 的卡片展示了用 `load_dataset(..., streaming=True)` 读取它们的 WebDataset 分片（[Egocentric-10K](https://huggingface.co/datasets/builddotai/Egocentric-10K)）。

## RLDS 与 Open X-Embodiment

[RLDS](https://github.com/google-research/rlds)（Apache-2.0）是 "an ecosystem of tools to store, retrieve and manipulate episodic data"（意为：一套用于存储、检索和处理 episode 式数据的工具生态）。它的 README 把一个数据集描述为由 episode 组成的 `tf.data.Dataset`，每个 episode 含有一个由 step 组成的嵌套 `tf.data.Dataset`。每个 step 有必填字段 `is_first` 和 `is_last`，以及可选的 `observation`、`action`、`reward`、`discount` 和 `is_terminal`；episode 元数据（例如 `episode_id`）由用户定义。数据集通过 TensorFlow Datasets 构建和加载，以 TFRecord 分片存储。

[Open X-Embodiment](https://arxiv.org/abs/2310.08864v5)（Open X-Embodiment Collaboration；ICRA 2024）把已有的机器人数据集汇集到 RLDS 中：来自 22 种机器人的数据，"a collaboration between 21 institutions"（意为：21 家机构之间的合作），"demonstrating 527 skills (160266 tasks)"（意为：展示了 527 种技能（160266 项任务））。这些数据可以容纳 "differing numbers of RGB cameras, depth cameras and point clouds"（意为：数量各不相同的 RGB 相机、深度相机和点云），但 RT-1-X 和 RT-2-X 是在每个数据集一个规范相机视角上训练的。它的代码仓库 [google-deepmind/open_x_embodiment](https://github.com/google-deepmind/open_x_embodiment) 采用 Apache-2.0。它只包含机器人数据，没有人的第一人称视频。

RLDS 与 TensorFlow 的输入流程绑定，而且存视频时体积大：DROID 作为 RLDS 是 1.7 TB，而移植到 LeRobot v3.0 之后约为 400 GB（[Porting datasets to v3](https://huggingface.co/docs/lerobot/porting_datasets_v3)）。

## HDF5：robomimic、ACT 与第一人称数据集

两种广泛使用的 HDF5 布局出自代码仓库，而不是出自某个标准。

- **robomimic**（[数据集文档](https://github.com/ARISE-Initiative/robomimic/blob/master/docs/datasets/overview.md)，MIT）：每个数据集一个 HDF5 文件。一个 `data` 组为每条轨迹存放一个组（`demo_0`、`demo_1`、...），每个组里有 `actions`、`rewards`、`dones`、`states` 和一个 `obs` 组（每个观测键一个数组），外加 `next_obs`。一个可选的 `mask` 组存放 `train` 和 `valid` 这类过滤键。动作应当归一化到 [-1, 1]。
- **ACT**（[tonyzhaozh/act](https://github.com/tonyzhaozh/act)，MIT）：每个 episode 一个 `.hdf5` 文件，含 `/observations/qpos` 和 `/observations/qvel`（对双臂 ALOHA 机械臂各为 14 个值）、形状为 `(T, 480, 640, 3)` 的 `uint8` 数组 `/observations/images/<camera>`，以及 `/action`（14 个值）（[record_sim_episodes.py](https://github.com/tonyzhaozh/act/blob/main/record_sim_episodes.py)）。

第一人称数据集通常把视频保留为 MP4，把运动学数据放进 HDF5：

- **Apple EgoDex**（[论文](https://arxiv.org/pdf/2505.11709)，2025）：829 小时来自 Apple Vision Pro 的 1080p、30 Hz 视频，338,000 个 episode，覆盖 194 项任务。每个 MP4 配有一个 HDF5 文件，其中存放 30 Hz 的相机内参和外参、上半身所有关节的位姿（每只手 25 个关节），这些位姿以 "SE(3) poses (represented as 4 × 4 homogeneous transformation matrices)"（意为：SE(3) 位姿（表示为 4 × 4 齐次变换矩阵））的形式存储，另有 0 到 1 之间的逐关节置信度。论文说，不压缩的话数据将超过 500 TB，约为压缩后大小的 250 倍；训练时用 PyTorch 的 `torchcodec` 只解码被采样到的帧。
- **Ropedia Xperience-10M**（[数据集卡片](https://huggingface.co/datasets/ropedia-ai/xperience-10m)）：每个 episode 有六路 MP4 数据流（`fisheye_cam0.mp4`–`fisheye_cam3.mp4`、`stereo_left.mp4`、`stereo_right.mp4`）和一个 `annotation.hdf5`，其中的组包括 `calibration/`、`slam/`（`quat_wxyz`、`trans_xyz`、`point_cloud`）、`depth/`、`hand_mocap/`、`full_body_mocap/`、`imu/` 和文字描述。
- **GenRobot DAS**（[DAS-Sample-Data](https://huggingface.co/datasets/genrobot2025/DAS-Sample-Data)，MIT）：用 [das-datakit](https://github.com/genrobot-ai/das-datakit) 从 MCAP 转换成每个 episode 一个 `.h5`。与上面两个不同，图像作为 `uint8` 数组存放在文件内部的 `observations/cameras/` 下，使用 gzip 压缩，旁边是 `observations/eef_pos`（`[Pos_X, Pos_Y, Pos_Z, Q_X, Q_Y, Q_Z, Q_W, Gripper_width]`）、`observations/imu`、一张估计的深度图和 `action`。

## Zarr 与 WebDataset

**Zarr** 把 n 维数组切分成压缩的块，这些块可以从磁盘、zip 文件或云存储桶并行读取。用于训练时要注意，"Because the data is compressed at the chunk-level, within-chunk reads are not possible"（意为：由于数据是在块这一级压缩的，无法在块内部做局部读取），所以块的形状应当与加载器的读取方式相匹配（[Zarr intro, Cloud-Native Geospatial guide](https://guide.cloudnativegeo.org/zarr/intro.html)）。在 Zarr 格式 3 中，sharding 编解码器把若干个块存进一个对象，避免产生数百万个极小的文件。zarr-python 3 默认创建格式 3 的数组；对较旧的读取程序，要设置 `zarr_format=2`（[zarr-python](https://github.com/zarr-developers/zarr-python)，MIT；最新版本 3.4.2，2026 年 10 月）。[UMI](https://egocam.ai/zh-cn/hardware/handheld-grippers-umi/) 的代码从它的 SLAM 输出生成一个 `dataset.zarr.zip` 回放缓冲区，并在其上训练 Diffusion Policy（[real-stanford/universal_manipulation_interface](https://github.com/real-stanford/universal_manipulation_interface)）。

**WebDataset** 适合按顺序读取的大型视频语料。Build AI 的 [Egocentric-10K](https://huggingface.co/datasets/builddotai/Egocentric-10K)（10,000 小时，192,900 个片段，16.4 TB，85 家工厂，1080p）和 [Egocentric-100K](https://huggingface.co/datasets/builddotai/Egocentric-100K)（100,405 小时，2,010,759 个片段，24.79 TB，456 × 256）把成对的 `.mp4` 和 `.json` 打包进最大 1 GB 的 `.tar` 分片，每个工人的文件夹里有一个 `intrinsics.json`（鱼眼模型，`k1`–`k4`），位于分片之外。这些是没有位姿和动作的单目片段，用于视频预训练。

## 按片段分文件夹：一家供应商的交付布局

并非每次交付都使用上面的某一种格式。Build AI 曾以 WebDataset 分片的形式发布 Egocentric-10K 和 Egocentric-100K，它出售手工作业的头戴相机视频，并在其[商店的技术文档](https://shop.build.ai/docs)中说明了一次交付包含的文件："Clips arrive as one folder each, with a manifest of every clip at the root."（意为：片段以每个一个文件夹的形式交付，根目录有一份列出所有片段的文件清单。）一个片段是 "Three minutes of head-camera video of one person at work, with the head IMU recorded alongside"（意为：一个人工作时的三分钟头戴相机视频，同时录有头部 IMU），来自单目设备或双目设备。这些文档读取于 2026 年 11 月 22 日；我们没有打开过这些文件本身。

| 内容 | 单目片段 | 双目片段 |
| :--- | :--- | :--- |
| 视频 | `video.mp4` | `left.mp4`、`right.mp4` |
| IMU | `imu.txt` | `imu.bin` |
| 标定 | `camera.json` | `calibration.json` |
| 手部姿态 | `hand_pose.npz` | `hand_pose_left.npz`、`hand_pose_right.npz`（每只眼一个文件，每个文件里都有双手） |
| 头部位姿 | `camera_pose.npz` | `camera_pose.npz` |
| 文字 | `caption.json` | `caption.json` |
| 元数据 | `metadata.json` | `metadata.json` |

同一份文档对各部分内容的说明：

| 部分 | 单目 | 双目 |
| :--- | :--- | :--- |
| 视频 | 1920 × 1080，30 fps，HEVC，鱼眼 "About 150° horizontal, 88° vertical, 164° diagonal."（意为：水平约 150°，垂直 88°，对角 164°。） | 每只眼 1920 × 1080，33.3 fps，HEVC，两台相机 "about 70 mm apart"（意为：相距约 70 mm），"Hardware-synchronised: frame N of the left eye and frame N of the right eye were exposed together."（意为：硬件同步：左眼的第 N 帧和右眼的第 N 帧是同时曝光的。） |
| IMU | "One sample per video frame (30 Hz)"（意为：每个视频帧一个采样（30 Hz））；陀螺仪单位为 rad/s，加速度计单位为 m/s²，"gravity included"（意为：包含重力） | 800 Hz，单位相同；"Video and IMU share one device clock. The camera-to-IMU time offset is in the calibration file and is well under 1 ms."（意为：视频和 IMU 共用一个设备时钟。相机到 IMU 的时间偏移在标定文件中，远小于 1 ms。） |
| 标定 | 4 个系数的 Kannala-Brandt，"Nominal for the device model, not measured per unit."（意为：是该设备型号的标称值，不是逐台测量的。） | 逐台设备、逐只眼："the factory model (unified omnidirectional with radial-tangential distortion) and a fisheye fit (Kannala-Brandt, 4 coefficients), with the fit error"（意为：出厂模型（带径向–切向畸变的统一全向模型）和一个鱼眼拟合（Kannala-Brandt，4 个系数），并附拟合误差），左到右的变换，以及相机到 IMU 的变换 "for each eye, in metres"（意为：每只眼各一个，以米为单位） |
| 头部位姿 | 每个视频帧一个位姿，四元数 [x, y, z, w] 加平移，相对于 "the camera at the start of the clip"（意为：片段开始时的相机）；尺度 "Estimated from one camera. Treat distances as approximate."（意为：由一台相机估计。距离应视为近似值。） | 左相机每帧一个位姿，"in a world frame level with gravity (camera to world): z up, origin at the left camera on the first frame"（意为：在一个按重力找平的世界坐标系中（相机到世界）：z 轴向上，原点在第一帧时的左相机处）；尺度 "Metric, from the stereo baseline and the 800 Hz IMU."（意为：公制尺度，来自双目基线和 800 Hz 的 IMU。） |
| 手部姿态 | 每帧每只手 21 个关节，"in metres, in camera coordinates: x right, y down, z forward"（意为：以米为单位，在相机坐标系中：x 向右，y 向下，z 向前）；"a mask per joint and frame marks positions not to use"（意为：一个逐关节、逐帧的掩码标出不应使用的位置） | 同上，"One estimate per eye, each in that eye's camera coordinates."（意为：每只眼一个估计，各自在该眼的相机坐标系中。） |
| 文字 | 一条片段文字描述，带起止秒数的任务，以及在稠密级别上的 "What the left hand and the right hand each do, as short timed phrases"（意为：左手和右手各自在做什么，以带时间的短语给出） | 相同的级别 |

这些文档中有三条约定值得照搬到你自己的任何交付中：

- **第 i 行就是第 i 帧**。"Row i of a per-frame file is video frame i, at i / fps seconds. Use the file's own `fps`, not the video container's"（意为：逐帧文件的第 i 行就是视频的第 i 帧，位于 i / fps 秒处。使用该文件自己的 `fps`，而不是视频容器的）。
- **被掩码的值看起来是有效的**。"Masked values are still finite numbers, so apply the mask first."（意为：被掩码的值仍然是有限的数，所以要先应用掩码。）
- **说明位姿是什么**。手部姿态被描述为 "An estimate fitted from the image, not a depth measurement. It can contain errors, most often when a hand is hidden."（意为：由图像拟合出的估计，不是深度测量。它可能含有误差，最常见于手被遮住的时候。）

免费的样例片段使用与交付不同的布局：每个片段一个文件夹，其中每一层一个 `.json` 文件（`hands_3d.json`、`hands_2d.json`、`head_pose.json`、`imu.json`、`tasks.json`、`hand_captions.json`），视频为 H.264，IMU 为 30 Hz，双目的两只眼并排放在一个 3840 × 1080 的文件里。文档还补充说："We have also delivered in MCAP and LeRobot layouts."（意为：我们也曾以 MCAP 和 LeRobot 布局交付。）

## MCAP 作为分发与整理格式

LeRobot 把一个 episode 压平成与视频帧对齐的固定速率的行；MCAP 让每一路数据流保持自己的速率："MCAP is a modular container file format for recording timestamped pub/sub messages with arbitrary serialization formats"（意为：MCAP 是一种模块化的容器文件格式，用于录制带时间戳的发布/订阅消息，序列化格式不限）（[MCAP specification](https://mcap.dev/spec)）。它也是 rosbag2 的默认存储插件（另一个选项是 `sqlite3`），rosbag2 的 README 指出，MCAP 自身的压缩能让文件保持可索引，而 rosbag2 的文件级压缩则不能（[rosbag2 README](https://github.com/ros2/rosbag2)）。有三个特性让它在训练之前很有用：

1. **内嵌的模式定义**。每个文件都带有自己的 `Schema` 和 `Channel` 记录，并在摘要区中重复一遍。Voxel51 在加载 Lightwheel 的 EgoSuite-Open100K 时指出："Because MCAP embeds its own Protobuf schemas, FiftyOne decodes Lightwheel's custom pose and annotation message types with no .proto files, no SDK, and no ROS or Foxglove toolchain."（意为：由于 MCAP 内嵌了自己的 Protobuf 模式定义，FiftyOne 无需 .proto 文件、无需 SDK，也无需 ROS 或 Foxglove 工具链，就能解码 Lightwheel 自定义的位姿和标注消息类型。）（[EgoSuite Open100K in FiftyOne](https://voxel51.com/blog/egosuite-open100k-mcap-fiftyone)）。
2. **不解码视频就能筛选**。只读取模式定义记录，同一条流程就能推导出 `has_image`、`has_hand_pose` 和 `has_body_pose` 这类标志，按模态挑选 episode。
3. **按设备划分的话题和有效性标志**。在 GenRobot 的 [DAS Ego 录制](https://docs.genrobot.ai/guides/das-ego-data-introduction)中，头带是 `robot0`，手部设备是 `robot1` 和 `robot2`。话题包括从 `/robot0/sensor/camera0/compressed` 起的各路相机（H.264）、`camera_info` 标定、`/robot0/sensor/imu`、VIO 位姿（`eef_pose`）、手部追踪（`/robot0/handtracking/left`），以及质量标志 `/robot0/frame_validity` 和 `/robot0/time_range_validity`。[Gen-HumanEgo](https://huggingface.co/datasets/genrobot2025/Gen-HumanEgo)（1,847.7 小时，44,632 个 episode，CC BY-SA 4.0）就是这样发布的。

## 把人的第一人称数据表示为状态和动作

在遥操作的机器人数据集中，状态和动作来自机器人。DROID 的移植版把 `observation.state` 和 `action` 定义为 8 维 float32 向量，"joints + gripper"（意为：关节加夹爪）（[Porting datasets to v3](https://huggingface.co/docs/lerobot/porting_datasets_v3)）。人的采集中没有机器人。正如 RoboX 的卡片所说："No robot retargeting is applied. target_embodiment is null and no robot telemetry is present."（意为：没有做机器人重定向。target_embodiment 为 null，也没有机器人遥测数据。）处理流程从[手部姿态](https://egocam.ai/zh-cn/processing/hand-pose-estimation/)、[世界坐标系中的手部追踪](https://egocam.ai/zh-cn/processing/hand-object-interaction-in-world-space/)、[SLAM 头部位姿](https://egocam.ai/zh-cn/processing/slam-on-wearable-footage/)或夹爪编码器（[UMI 的动作与策略](https://egocam.ai/zh-cn/umi/actions-and-policies/)）构造代理状态和代理动作。

### 已发表的状态与动作模式定义

| 数据集或论文 | 存储 | 状态 | 动作 | 坐标系与归一化 |
| :--- | :--- | :--- | :--- | :--- |
| [RoboX lerobot-dataset](https://huggingface.co/datasets/RoboXTechnologies/lerobot-dataset) | LeRobot v3.0 | float32 [15]：以米为单位的手腕 `(x, y, z)`，单位四元数 `(qx, qy, qz, qw)`，5 个取值 0–1 的手指弯曲度，3 个拇指捏合距离 | float32 [14]：到下一帧的逐帧变化量；手腕旋转表示为 3 维旋转向量 | 第一人称相机坐标系；MEAN_STD，四元数索引 [3, 4, 5, 6] 除外 |
| [EgoDex](https://arxiv.org/pdf/2505.11709) | MP4 + HDF5 | 上半身关节的 SE(3) 位姿，每只手 25 个，带置信度 | 每步 48 维：2 只手 ×（3 维手腕位置 + 6 维手腕朝向 + 5 × 3 维指尖位置），按块预测 | 当前相机坐标系；每个块是一条相对轨迹 |
| [EgoVerse](https://arxiv.org/abs/2604.07607) | EgoDB → `EgoVerseDataset` | 相机坐标系中每只手 21 个关键点，加上来自视觉惯性 SLAM 的六自由度头部位姿 | 从 1 s 的人类窗口（机器人为 1.5 s）重采样出的 100 个未来步 | 分位数归一化：第 1 和第 99 百分位映射到 [-1, 1] |
| [EgoMI](https://huggingface.co/papers/2511.00153) | 微调 π0 | 29 维：每只手 6 维旋转 + 3 维位置 + 1 维夹爪；头部 6 维旋转 + 3 维位置 | 29 维相对笛卡尔动作 | 原点对齐到初始头部位置和两个夹爪偏航角的圆周均值 |

### 旋转变化量与四元数归一化

两个四元数相减得不到有效的旋转变化；RoboX 的动作使用 "a 3-D relative rotation vector rotvec(q[t+1] . inverse(q[t])) rather than a quaternion subtraction."（意为：一个 3 维相对旋转向量 rotvec(q[t+1] . inverse(q[t]))，而不是四元数相减。）均值/标准差缩放还会破坏四元数的单位范数，这就是 RoboX 把索引 [3, 4, 5, 6] 排除在这种缩放之外的原因（[RoboX lerobot-dataset](https://huggingface.co/datasets/RoboXTechnologies/lerobot-dataset)）。

### 从手部动作中去除头部运动

头戴相机得到的手部姿态处在一个运动的相机坐标系中，所以未来的姿态如果留在各自的坐标系里，就会把手部运动和头部运动混在一起。[EgoMimic](https://arxiv.org/html/2410.24221v1) 和 [EgoVerse](https://arxiv.org/abs/2604.07607) 用 SLAM 位姿把每一个未来的手部姿态都表示在当前时刻 `t` 的相机坐标系中：

```text
a_{t+i} = inverse(T_world_cam(t)) · T_world_cam(t+i) · p_hand(t+i)    for i = 1 .. k
```

> **Diagram:** Why hand actions from a head camera need the camera's SLAM poses. If the wearer turns their head while the hand stays still, hand positions left in each frame's own camera coordinates appear to move, so head motion leaks into the action. Re-expressing every future hand pose in the camera frame at the current time t, using the SLAM poses as EgoMimic and EgoVerse do, puts a still hand at the same point and gives a zero action. Schematic, top-down.

### 匹配人与机器人的速度

EgoVerse 指出："Due to inherent differences in execution speed between humans and robot teleoperation, we apply post-processing to temporally align action trajectories across embodiments."（意为：由于人与机器人遥操作在执行速度上存在固有差异，我们用后处理在时间上对齐不同本体的动作轨迹。）它取 1 秒的人类窗口和 1.5 秒的机器人窗口，把两者都重采样到 100 步（位置用线性插值，旋转用 SLERP），并对每种本体分别归一化。EgoMimic 的人类数据为 30 Hz、机器人数据为 50 Hz，它使用 1 秒的人类时域和 4 秒的机器人时域，两者都作为 100 步的块，并对手部数据和机器人数据分别做 Z-score 归一化。在它的消融实验（Table IV）中，去掉动作归一化使 Object-in-Bowl 的得分从 128 分降到 79 分。

### 任务、子任务和失败恢复列

在 LeRobot 中，每一帧的 `task_index` 指向 `meta/tasks.parquet` 中的一项自然语言任务。[MundoAI-Robotics-Sample](https://huggingface.co/datasets/thomasmundo/MundoAI-Robotics-Sample/blob/main/README.md) 加入了逐帧的列 `subtask_text`、`task_type`、`outcome`、`reasoning`、`reflection`、`subtask_id`、`parent_subtask_id` 和 `resumes_subtask_id`，这样一次重试就能链接回它所重复的那次尝试（在它擦洗台面的 episode 中，`st_015 → st_009 → ...` 跨越 1,933 帧）。加载器可以只保留干净的一次通过，也可以在完整的恢复链上训练。见[第一人称视频的标注类型](https://egocam.ai/zh-cn/processing/annotation-types/)。

## 导出哪种格式

| 下游用途 | 导出 | 原因 |
| :--- | :--- | :--- |
| PyTorch 模仿学习、VLA 训练、Hub 发布 | LeRobotDataset v3.0 | 少量大文件；内置 `delta_timestamps`、流式读取和 GPU 增强。 |
| 检查、整理、ROS 2 / Foxglove / FiftyOne | MCAP | 保留传感器原生速率、内嵌的模式定义和标定附件。 |
| 同时服务于整理和训练的公开发布 | MCAP + LeRobot v3.0 | Lightwheel 的做法；在卡片上说明两者是同一批 episode。 |
| 稠密的逐帧骨架、深度、SLAM | MP4 + HDF5，或 Zarr | 视频保持可硬件解码；数组留在一个带索引的文件或存储中。 |
| 10,000 小时以上的纯视频预训练 | WebDataset | 按顺序流式读取 `.tar` 分片，元数据开销很小。 |
| 把带逐帧位姿的片段交给没有固定工具链的买方 | 按片段分文件夹的 MP4、NumPy 和 JSON | 用标准库就能打开；在旁边的一份文档里说明单位、坐标系、掩码和帧到行的对应规则。 |

## 可以交给 AI 的提示词

```text
写一个 Python 脚本，用 lerobot 库把一个存放第一人称 episode 的文件夹（左右双目 MP4 文件、
一个相机坐标系中的 30 Hz 手部姿态数组、一个由 4x4 矩阵组成的 30 Hz SLAM 头部位姿数组，以及一个任务
字符串）转换成 LeRobotDataset v3.0 数据集。用 SLAM 位姿把未来的手部姿态表示在
当前相机坐标系中。把手腕旋转动作做成 q[t+1] * inverse(q[t]) 的旋转向量，
而不是四元数之差。在每个 episode 之后调用 save_episode()，并在 finally 块中调用
dataset.finalize()。把双目标定写入 meta/calibrations/<device_id>.json。
```

## 参考来源

- [LeRobotDataset v3.0 docs](https://huggingface.co/docs/lerobot/lerobot-dataset-v3) — Hugging Face。
- [Porting datasets to v3](https://huggingface.co/docs/lerobot/porting_datasets_v3) — Hugging Face。
- [huggingface/lerobot](https://github.com/huggingface/lerobot) — Hugging Face，Apache-2.0；[`datasets/utils.py`](https://github.com/huggingface/lerobot/blob/main/src/lerobot/datasets/utils.py)、[`utils/constants.py`](https://github.com/huggingface/lerobot/blob/main/src/lerobot/utils/constants.py)、[v0.3.3 `datasets/utils.py`](https://github.com/huggingface/lerobot/blob/v0.3.3/src/lerobot/datasets/utils.py)、[convert_dataset_v20_to_v21.py](https://github.com/huggingface/lerobot/blob/v0.3.3/src/lerobot/datasets/v21/convert_dataset_v20_to_v21.py)。
- [huggingface/datasets](https://github.com/huggingface/datasets) — Hugging Face，Apache-2.0。
- [google-research/rlds](https://github.com/google-research/rlds) — Google Research，Apache-2.0。
- [Open X-Embodiment](https://arxiv.org/abs/2310.08864v5) — Open X-Embodiment Collaboration，2023，ICRA 2024；[google-deepmind/open_x_embodiment](https://github.com/google-deepmind/open_x_embodiment)，Apache-2.0。
- [MCAP specification](https://mcap.dev/spec) — MCAP 项目；[foxglove/mcap](https://github.com/foxglove/mcap)，MIT。
- [rosbag2 README](https://github.com/ros2/rosbag2) — ROS 2，Apache-2.0。
- [robomimic dataset docs](https://github.com/ARISE-Initiative/robomimic/blob/master/docs/datasets/overview.md) — ARISE Initiative；[代码仓库](https://github.com/ARISE-Initiative/robomimic)，MIT。
- [tonyzhaozh/act](https://github.com/tonyzhaozh/act) — Zhao 等，MIT；[record_sim_episodes.py](https://github.com/tonyzhaozh/act/blob/main/record_sim_episodes.py)。
- [zarr-developers/zarr-python](https://github.com/zarr-developers/zarr-python) — Zarr 开发者，MIT。
- [Zarr intro, Cloud-Native Geospatial guide](https://guide.cloudnativegeo.org/zarr/intro.html) — Cloud-Native Geospatial Forum。
- [webdataset/webdataset](https://github.com/webdataset/webdataset) — BSD-3-Clause。
- [real-stanford/universal_manipulation_interface](https://github.com/real-stanford/universal_manipulation_interface) — Chi 等，MIT。
- [RoboXTechnologies/lerobot-dataset](https://huggingface.co/datasets/RoboXTechnologies/lerobot-dataset) — RoboX，Hugging Face。
- [MundoAI-Robotics-Sample](https://huggingface.co/datasets/thomasmundo/MundoAI-Robotics-Sample/blob/main/README.md) — Mundo AI，Hugging Face，CC BY 4.0。
- [LightwheelAI/EgoStandard](https://huggingface.co/datasets/LightwheelAI/EgoStandard) — Lightwheel，2026。
- [LightwheelAI/EgoPro](https://huggingface.co/datasets/LightwheelAI/EgoPro) — Lightwheel，2026。
- [EgoSuite Open100K in FiftyOne](https://voxel51.com/blog/egosuite-open100k-mcap-fiftyone) — Voxel51，2026。
- [genrobot2025/Gen-HumanEgo](https://huggingface.co/datasets/genrobot2025/Gen-HumanEgo) — GenRobot，2026，CC BY-SA 4.0。
- [DAS Ego Data Introduction](https://docs.genrobot.ai/guides/das-ego-data-introduction) — GenRobot，2026。
- [genrobot2025/DAS-Sample-Data](https://huggingface.co/datasets/genrobot2025/DAS-Sample-Data) — GenRobot，2025，MIT。
- [genrobot-ai/das-datakit](https://github.com/genrobot-ai/das-datakit) — GenRobot，MIT。
- [ropedia-ai/xperience-10m](https://huggingface.co/datasets/ropedia-ai/xperience-10m) — Ropedia，2026。
- [EgoDex](https://arxiv.org/pdf/2505.11709) — Hoque 等，Apple，2025。
- [EgoVerse](https://arxiv.org/abs/2604.07607) — arXiv，2026。
- [EgoMimic](https://arxiv.org/html/2410.24221v1) — Kareer 等，Georgia Tech，2024。
- [EgoMI](https://huggingface.co/papers/2511.00153) — UC Berkeley 与 xdof.ai，2025。
- [builddotai/Egocentric-10K](https://huggingface.co/datasets/builddotai/Egocentric-10K) — Build AI，2025。
- [builddotai/Egocentric-100K](https://huggingface.co/datasets/builddotai/Egocentric-100K) — Build AI，2025。
- [Build AI shop: technical docs](https://shop.build.ai/docs) — Build AI，2026；交付和样例的文件布局、单位和坐标系。
