Skip to content

C401 Lesson 4: Training Formats

The last step of the pipeline writes what lessons 1 to 3 produced into files a data loader can read. This lesson covers the formats current egocentric releases use, with LeRobotDataset v3.0 in most detail because the lab exports to it. The full treatment is on Training Formats: LeRobot, RLDS and Friends.

See also the glossary’s datasets and formats section.

Term Meaning
Episode One continuous recording of a task from start to finish: a sequence of time-aligned observations and actions
Shard One large file that packs many episodes, so storage handles fewer, larger files
Feature A named per-frame field with a dtype and shape, such as observation.state or observation.images.<camera>
observation.state A per-frame vector describing the agent: joint angles for a robot; wrist pose and finger joints for a human hand
action The command or motion target at a timestep, absolute (a target pose) or relative (a delta)
MCAP An open container for timestamped publish/subscribe messages with embedded schemas and an index

A recording container is built for capture: it appends time-stamped packets in arrival order. A training format is built for learning: it organises many episodes so a loader can sample random frames, slice short time windows and normalise states and actions without opening millions of small files (Training Formats).

Current public egocentric releases often ship both. Lightwheel publishes its datasets as MCAP and as LeRobot, and both cards warn: “LeRobot and MCAP are alternative representations of the same episodes and must not be counted as additional hours” (EgoStandard card).

LeRobotDataset is Hugging Face’s dataset format for the lerobot library. States, actions and timestamps go in Parquet tables, camera frames in MP4, and metadata in JSON and Parquet. In v2.1 every episode had its own files; v3.0 concatenates many episodes into each file. The v3.0 docs explain: “To scale to millions of episodes, tabular rows and video frames from multiple episodes are concatenated into larger files.”

Where one episode lives in LeRobot v2.1 and v3.0 Two panels. Left, LeRobotDataset v2.1: every episode has its own files, one Parquet file per episode under data/chunk-000 (episode_000000.parquet, episode_000001.parquet, episode_000002.parquet and so on) and one MP4 per camera per episode under videos/chunk-000/camera name, so the file count grows with episodes times cameras. Right, LeRobotDataset v3.0: rows from many episodes are concatenated into one Parquet shard, data/chunk-000/file-000.parquet, and frames from the same episodes into one MP4 shard per camera, videos/camera name/chunk-000/file-000.mp4. A row in meta/episodes holds each episode's length, task and offsets; arrows from the row for episode 1 point to its range of rows in the data shard and its time range in the video shard. A new shard starts at about 100 MB for data and 200 MB for video by default, with up to 1,000 files per chunk folder. Where one episode lives: LeRobot v2.1 and v3.0 v2.1: one file per episode v3.0: many episodes per file data/chunk-000/ episode_000000.parquet episode_000001.parquet episode_000002.parquet … videos/chunk-000/<camera>/ episode_000000.mp4 episode_000001.mp4 episode_000002.mp4 … Files = episodes × (1 + cameras): millions of small files strain file systems and object stores. meta/episodes/chunk-000/file-000.parquet episode 0: length, task, offsets episode 1: length, task, offsets episode 2: length, task, offsets data/chunk-000/file-000.parquet ep 0 ep 1 ep 2 ep 3 … videos/<camera>/chunk-000/file-000.mp4 ep 0 ep 1 ep 2 ep 3 … frame rows: episode 1 is a row range in the shard one MP4 per camera: episode 1 is a time range New shard at about 100 MB (data) or 200 MB (video); up to 1,000 files per chunk folder (lerobot defaults).
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).

What to know before writing one (LeRobotDataset):

  • The schema lives in meta/info.json, with the feature names, dtypes and shapes, the frame rate and the path templates. Normalisation statistics live in meta/stats.json.
  • Cameras are features named observation.images.<camera>, with dtype video.
  • There is no field for camera intrinsics or extrinsics. Egocentric releases add their own files under meta/; MundoAI’s sample puts “camera intrinsics + head-to-camera offset, keyed by device” in a calibration file there (MundoAI-Robotics-Sample).
  • Call finalize(). v3.0 writes Parquet incrementally: “When creating or recording datasets, you must call dataset.finalize() to properly close parquet writers.” Without it the files are incomplete and the dataset will not load (v3.0 docs).
  • Timestamps come from the frame rate. In lerobot 0.7.0, add_frame() computes each frame’s timestamp as its index divided by the dataset’s fps, and the caller must not supply one (dataset_writer.py). Frames you add must therefore be evenly spaced at that rate.
Downstream use Export Why
PyTorch imitation learning, VLA training, Hub release LeRobotDataset v3.0 Few large files; time windows, streaming and GPU augmentation built in
Inspection, curation, ROS 2 / Foxglove / FiftyOne MCAP Keeps native sensor rates, embedded schemas and calibration attachments
Dense per-frame skeletons, depth, SLAM MP4 + HDF5, or Zarr Video stays hardware-decodable; arrays stay in one indexed file or store
Video-only pretraining at 10,000+ hours WebDataset Sequential streaming of .tar shards with little metadata overhead

The table is the field guide’s which format to export. MCAP keeps every stream at its own rate, where LeRobot flattens an episode into fixed-rate rows aligned to video frames (MCAP as a distribution and curation format). Several egocentric releases keep video as MP4 and put the kinematics in HDF5: EgoDex pairs each MP4 with an HDF5 file holding camera intrinsics and extrinsics and upper-body joint poses (HDF5 layouts).

In a teleoperated robot dataset, state and action come from the robot. Human capture has no robot. As RoboX’s card puts it: “No robot retargeting is applied. target_embodiment is null and no robot telemetry is present” (RoboX lerobot-dataset). Pipelines build proxy states and actions from hand pose, world-space hand tracking and SLAM head poses. Three details recur in the published schemas (representing human egocentric data):

  1. Remove head motion from hand actions. Hand poses from a head camera are in a moving frame. EgoMimic and EgoVerse use the SLAM poses to express every future hand pose in the camera frame at the current time.
  2. Do not subtract quaternions. RoboX’s action uses “a 3-D relative rotation vector rotvec(q[t+1] . inverse(q[t])) rather than a quaternion subtraction”, and it excludes the quaternion indices from mean/std normalisation, which would break their unit norm.
  3. Match human and robot speed. People move faster than teleoperated robots, so a chunk of fixed length would cover more of the task in human data than in robot data. EgoVerse resamples a 1-second human window and a 1.5-second robot window to 100 steps each, and normalises each embodiment separately (Matching human and robot speed).
Removing head motion from hand actions Three top-down panels. Left, the scene: between time t and a later time t+i the wearer turns the head, so the head camera points in a new direction, while the hand stays still in the world. Middle, hand positions left in each frame's own camera coordinates: at t the hand is straight ahead, at t+i it appears off to one side, so an action computed this way shows the hand moving when only the head moved. Right, the same positions re-expressed in the camera frame at t using the SLAM camera poses: both land on the same point and the action is zero, as it should be. The formula used by EgoMimic and EgoVerse is shown below: a at t+i equals the inverse of T_world_cam at t, times T_world_cam at t+i, times p_hand at t+i, for i from 1 to k. Schematic. The head turns, the hand stays still: what the action should say 1. Scene, from above 2. Each frame's own camera 3. Camera frame at time t hand (still) t t+i head turns between t and t+i p(t) p(t+i) looks like the hand moved: head motion leaks into the action same point SLAM poses undo the turn: action is zero, as it should be a(t+i) = inverse(T_world_cam(t)) · T_world_cam(t+i) · p_hand(t+i) for i = 1 … k; T_world_cam from SLAM on the head camera (EgoMimic, EgoVerse)
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.

Turning these into robot policies is course C402. For this course, the rule is simpler: whatever you export, write down which frame each pose is in, its units, and its rotation convention.

  1. You record a ROS 2 bag with images at 30 Hz and an IMU at 200 Hz. Why might you ship MCAP alongside a LeRobot export?
  2. Your conversion script runs without errors, but the dataset will not load. What is the first thing to check in a v3.0 export?
  3. Where do the camera intrinsics go in a LeRobotDataset?
  4. Your tracker produced no pose for 40 frames in the middle of an episode. Why can you not simply skip them when calling add_frame()?
  5. Why does RoboX exclude its quaternion components from mean/std normalisation?
  1. LeRobot flattens an episode into fixed-rate rows aligned to video frames; MCAP keeps every stream at its own rate, with embedded schemas, for inspection and curation. If you ship both, say on the card that they are the same episodes.
  2. Whether finalize() was called after the last save_episode(); without it the Parquet files are incomplete.
  3. There is no standard field. Add a file under meta/, as egocentric releases do, and describe it on the card.
  4. lerobot computes timestamps from the frame index and fps, so skipped frames would shift every later frame’s timestamp. End the episode at the gap or fill it by a documented method.
  5. Mean/std scaling would break a quaternion’s unit norm.