# C402 Lab: Trace the Actions in a LeRobot Dataset

> The hands-on lab of the C402 robot-learning course: load a public egocentric human-hand dataset in LeRobot v3.0 format with LeRobot's documented loading code, read its state and action definitions, check the action definition against the data, find which frame the actions live in, build action chunks, and compare the convention with a handheld-gripper dataset.

Page: https://egocam.ai/university/c402/lab/

Every policy trained on human data depends on one decision that is easy to get wrong: what the numbers in the `action` column mean. Public datasets do not share one convention ([How public datasets store state and action](https://egocam.ai/umi/actions-and-policies/#how-public-datasets-store-state-and-action)). In this lab you open a public egocentric dataset of human hand motion in LeRobot format, find its action definition, check that definition against the data, and work out what a training loader would have to do with it. Part B compares a handheld-gripper dataset that stores its actions differently.

The loading code is LeRobot's own, from its [dataset documentation](https://huggingface.co/docs/lerobot/lerobot-dataset-v3) and its [loading example](https://github.com/huggingface/lerobot/blob/main/examples/dataset/load_lerobot_dataset.py). The checks you add on top use NumPy and SciPy only. Square brackets mark values you fill in. Work through [Lessons 1 to 4](https://egocam.ai/university/c402/) first, and keep the [checklist](https://egocam.ai/university/c402/checklist/) next to you.

## The datasets

| | Part A: RoboX lerobot-dataset | Part B: UMI-Live |
|---|---|---|
| What it records | Egocentric human hand demonstrations, tracked from video | Two handheld grippers with wrist cameras |
| Scale (card) | 28 episodes, 7,730 frames, 15 tasks, 53.6 MB | 3,255 episodes, 39.705 hours |
| Format | LeRobot v3.0 | LeRobot v3 |
| Access | Gated: accept the conditions on the page while logged in | Open |
| Licence | `robox-commercial-nonexclusive-v1`; the card says commercial use is allowed | Apache-2.0 |
| Card | [RoboXTechnologies/lerobot-dataset](https://huggingface.co/datasets/RoboXTechnologies/lerobot-dataset) | [brandonyang/umi-live-dataset](https://huggingface.co/datasets/brandonyang/umi-live-dataset) |

Neither dataset involves a robot at capture. Part A is a person's bare hand seen from an egocentric camera. Part B is a person holding gripper devices; its cameras are on the grippers. Keep the two kinds of capture, and any robot you later train for, in separate columns of your notes.

RoboX's licence is not an open-source licence. Its card states: "This dataset is distributed under its stated commercial terms, not an open-source licence, despite the Hub license: other tag." Full terms are in `meta/robox_export.json`; read them before using the data for anything beyond this exercise ([Dataset Licences and Access](https://egocam.ai/datasets/licences-and-access/)).

## Part A: an egocentric hand dataset

### Step 1: Install LeRobot

LeRobot needs Python 3.12 or later. Its [installation guide](https://huggingface.co/docs/lerobot/installation) lists a `dataset` extra for "Loading & creating datasets". In a fresh virtual environment:

```bash
pip install 'lerobot[dataset]'
```

**Write down** the version you installed (`pip show lerobot`). The code in this lab follows LeRobot's repository at commit `d490e47` (version 0.7.1, November 2026); the import path `from lerobot.datasets import LeRobotDataset` is the one its current docs use.

### Step 2: Get access

Open the [dataset page](https://huggingface.co/datasets/RoboXTechnologies/lerobot-dataset) while logged in to Hugging Face and accept its conditions. Then log in from the command line, as LeRobot's [dataset tools guide](https://huggingface.co/docs/lerobot/using_dataset_tools) says to for "a private or gated dataset":

```bash
hf auth login
```

**If it fails:** a 401 or 403 error when loading means the conditions were not accepted for the account whose token you used.

### Step 3: Read the card before the data

Fill in this table from the card, before you load anything:

| Question | What the card says |
|---|---|
| Where do the state values come from? | |
| What frame are positions in? | |
| What does `action[t]` hold? | |
| How is the wrist rotation change written? | |
| Was any robot retargeting applied? | |
| What frame rate, and is it verified? | |
| Which frames are imputed, and where is that recorded? | |

**You should have:** state from MediaPipe hand tracking, with about 3.7% of frames imputed and flagged in `meta/robox_frame_masks.parquet`; wrist position "in the egocentric camera frame"; an action that is "the per-channel delta to the next frame, where the wrist rotation delta is a 3-D relative rotation vector rotvec(q[t+1] . inverse(q[t])) rather than a quaternion subtraction"; and no retargeting: "No robot retargeting is applied. target_embodiment is null and no robot telemetry is present." The card adds: "FPS is declared, not independently verified." The field guide's [schema table](https://egocam.ai/processing/training-formats-lerobot-rlds/#published-state-and-action-schemas) lists the 15 state and 14 action channels.

### Step 4: Read the metadata

`LeRobotDatasetMetadata` reads only the lightweight metadata files. From LeRobot's [loading example](https://github.com/huggingface/lerobot/blob/main/examples/dataset/load_lerobot_dataset.py), with the repo id changed:

```python
from pprint import pprint
from lerobot.datasets import LeRobotDataset, LeRobotDatasetMetadata
repo_id = "RoboXTechnologies/lerobot-dataset"
ds_meta = LeRobotDatasetMetadata(repo_id)
print(f"Total number of episodes: {ds_meta.total_episodes}")
print(f"Frames per second used during data collection: {ds_meta.fps}")
print(f"Robot type: {ds_meta.robot_type}")
print(f"keys to access images from cameras: {ds_meta.camera_keys=}\n")
pprint(ds_meta.features)
```

**You should see** values that match the card: 28 episodes, 30 fps, the robot type label `robox_ego_hand`, one camera key, and `observation.state` and `action` with shapes 15 and 14. Write down any that differ.

**If it fails** with "Your dataset must be tagged with a codebase version", the repository has no version tag such as `v3.0`, which LeRobot looks up by default. Pass `revision="main"` to `LeRobotDatasetMetadata` and `LeRobotDataset`; LeRobot skips the tag lookup when the revision is not a version number (`get_safe_version` in [datasets/utils.py](https://github.com/huggingface/lerobot/blob/main/src/lerobot/datasets/utils.py) and the metadata loader). The tag-creating code in the error message needs write access to the repository and is for its owner, not for you.

### Step 5: Load one episode

The dataset is small, so load it whole, then take the frame range of episode 0 from the episode metadata, as the loading example does:

```python

dataset = LeRobotDataset(repo_id)
episode_index = 0
from_idx = dataset.meta.episodes["dataset_from_index"][episode_index]
to_idx = dataset.meta.episodes["dataset_to_index"][episode_index]
state = np.stack([dataset[i]["observation.state"].numpy() for i in range(from_idx, to_idx)])
action = np.stack([dataset[i]["action"].numpy() for i in range(from_idx, to_idx)])
print(state.shape, action.shape)
```

**You should see** two arrays with the same number of rows, 15 and 14 columns wide. Each `dataset[i]` also decodes the video frame, so this takes a little while.

### Step 6: Check the action definition against the data

Rebuild the action the card describes from the state, and compare. SciPy's `Rotation.from_quat` takes quaternions in scalar-last order, `(x, y, z, w)`, the order the card lists them in ([SciPy Rotation](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.transform.Rotation.html)):

```python
from scipy.spatial.transform import Rotation as R
pos, quat, rest = state[:, 0:3], state[:, 3:7], state[:, 7:15]
exp_pos = pos[1:] - pos[:-1]
exp_rot = (R.from_quat(quat[1:]) * R.from_quat(quat[:-1]).inv()).as_rotvec()
exp_rest = rest[1:] - rest[:-1]
expected = np.concatenate([exp_pos, exp_rot, exp_rest], axis=1)
diff = np.abs(action[:-1] - expected)
print("max |diff| wrist position:", diff[:, 0:3].max())
print("max |diff| wrist rotation:", diff[:, 3:6].max())
print("max |diff| fingers and pinches:", diff[:, 6:14].max())
print("action at the episode's last frame:", action[-1])
```

`R.from_quat(q1) * R.from_quat(q0).inv()` applies the inverse of the first rotation, then the second, which is `q[t+1] · inverse(q[t])`.

**Write down** the three maximum differences and what the last frame's action holds; the card does not say what an episode's last action contains. If the differences are not near zero, check the channel order against `meta/robox_feature_semantics.json` before concluding anything, and note which channels disagree.

### Step 7: Ask which frame the action lives in

The wrist position is in the egocentric camera frame, and the camera moves with the wearer's head. The card's feature list has no camera pose. So a position delta mixes hand motion with head motion: a head turn with a still hand still produces a non-zero action ([Removing head motion from hand actions](https://egocam.ai/processing/training-formats-lerobot-rlds/#removing-head-motion-from-hand-actions)).

> **Diagram:** VideoDex's chain from a wrist seen by a head-worn camera to a robot target, applied right to left: wrist in the current camera frame (MANO fit and PnP), head motion cancelled with SLAM poses, gravity alignment, then a fixed placement in the robot's workspace. Below, its Table 3 comparison of gravity alignment on test objects: fitted floor-parallel surface normals scored 0.80 / 0.63 / 0.92 on Place / Cover / Uncover, against 0.55 / 0.50 / 0.77 for a fixed pitch and 0.70 / 0.67 / 0.90 for the camera's own stabilisation-sensor data. Source: Shaw et al., VideoDex (2022).

**Write down** your answer to this question: with this dataset alone, can a loader express future wrist positions in the camera frame at the current timestep, as EgoMimic and EgoVerse do? Name what would be needed ([Express actions in the current camera frame](https://egocam.ai/robot-learning/co-training-human-and-robot-data/#express-actions-in-the-current-camera-frame)).

### Step 8: Build action chunks

A policy predicts a chunk of future actions. LeRobot builds chunks with `delta_timestamps`, offsets in seconds that must be multiples of 1/fps. From the loading example:

```python
H = 16  # chunk length, your choice
delta_timestamps = {"action": [t / dataset.fps for t in range(H)]}
dataset = LeRobotDataset(repo_id, delta_timestamps=delta_timestamps)
sample = dataset[from_idx]
print(sample["action"].shape)         # (H, 14)
print(sample["action_is_pad"])        # True where the window ran past the episode's end
```

Near the end of an episode the window runs past the last frame. LeRobot then repeats the episode's last row and marks those positions in `action_is_pad` (the `delta_window` function in LeRobot's [datasets/utils.py](https://github.com/huggingface/lerobot/blob/main/src/lerobot/datasets/utils.py)). Check it on a sample a few frames before the end.

Each row of this chunk is a per-frame delta. **Exercise:** turn one chunk into a trajectory relative to the frame at `t0`, by summing position deltas and composing rotation vectors in order. Write down why errors accumulate along the chunk, and compare with the delta row of [UMI's comparison](https://egocam.ai/umi/actions-and-policies/#relative-beats-delta-and-absolute), where delta actions scored 16/20 against 20/20 for relative trajectories. LeRobot's [action representations guide](https://huggingface.co/docs/lerobot/action_representations) explains the same difference.

> **Diagram:** Three ways to write the same gripper trajectory as actions, and what each scored. Top: UMI's cup-arrangement ablation, 20 trials each (Chi et al., 2024); the absolute baseline used the SLAM frame and the robot base calibrated to the same table markers. Bottom: VISTA's component ablation on FastUMI Pro data, where the last row removes proprioceptive state and also swaps delta for absolute actions (Yang et al., 2026). The two studies use different tasks and models, so compare within a panel. The trajectory drawn is schematic.

### Step 9: Find the imputed frames

The imputation flags are a separate file. Fetch it with the Hugging Face Hub client's [`hf_hub_download`](https://huggingface.co/docs/huggingface_hub/guides/download) and open it with pandas:

```python

from huggingface_hub import hf_hub_download
path = hf_hub_download(repo_id=repo_id, filename="meta/robox_frame_masks.parquet", repo_type="dataset")
masks = pd.read_parquet(path)
print(masks.columns.tolist())
print(masks.head())
```

**Write down** the column names, then count the imputed frames in episode 0 and check whether any of them fall inside the chunk you built in step 8. The card puts imputed frames at about 3.7% overall. An action computed across an imputed frame is a delta between estimates, not between measurements.

### Step 10: Write the action note

Write one paragraph that a training engineer could rely on: state layout and units; what `action[t]` holds and what it holds at an episode's last frame; the frame positions are in and whether head motion can be removed; how rotations are written; the imputed share; the licence; and that no retargeting was applied, so a robot needs the steps in [Lesson 2](https://egocam.ai/university/c402/lesson-2-embodiment-gap-and-retargeting/) before it can use these actions.

## Part B: a handheld-gripper dataset with a different convention

UMI-Live is open and Apache-2.0, but 3,255 episodes is too much to download for an exercise, so this part reads the card and the metadata and views one episode in the browser.

### B1: Read the card

UMI-Live's card defines its convention in plain terms. State is 14 values, two grippers in the order left then right, each `[x, y, z, rx, ry, rz, gripper]`, as poses relative to that gripper's own episode start, with orientation as a rotation vector and grippers normalised from 0 (closed) to 1 (open). Its action is a same-frame copy of the state: "It is not the previous or next row, a velocity, or a precomputed action chunk. Training loaders must select future target frames, respect episode boundaries, and convert them to the desired policy representation." It also warns that its grippers were normalised over different travel ranges: "These calibration ranges are source-specific, not interchangeable." ([UMI-Live card](https://huggingface.co/datasets/brandonyang/umi-live-dataset)).

### B2: Read the metadata and view an episode

Run step 4's metadata code with `repo_id = "brandonyang/umi-live-dataset"`, passing `revision="main"`: on 2026-11-08 the repository had no `v3.0` tag, so the default lookup fails. Checked that day with LeRobot 0.7.0, the call returned 3,255 episodes at 30 fps, no robot type, two camera keys (`observation.images.umi1` and `observation.images.umi2`) and 14-value state and action. Then open episode 0 in the [LeRobot Dataset Visualizer](https://huggingface.co/spaces/lerobot/visualize_dataset?path=/brandonyang/umi-live-dataset/episode_0), the in-browser viewer LeRobot's [dataset tools guide](https://huggingface.co/docs/lerobot/using_dataset_tools) describes, which plays the cameras and charts state and action together.

**You should see** two wrist-camera videos, and state and action charts with the same shape, since one is a copy of the other. If the viewer does not load, the metadata output and the card are enough for B3.

### B3: Compare the two conventions

| | RoboX (Part A) | UMI-Live (Part B) |
|---|---|---|
| What is tracked | A bare hand, from video | Two gripper devices |
| Position frame | The egocentric camera at each frame | Each gripper's own episode start |
| Rotation in state | Unit quaternion | Rotation vector |
| `action[t]` | Delta to the next frame | Same-frame copy of the state |
| Finger or grip channel | 5 curls and 3 pinch distances | Normalised width, 0 closed to 1 open |
| What a loader must do | Undo or keep the deltas; deal with head motion | Pick future frames and convert them, as UMI's relative-trajectory actions do |

**Exercise:** for UMI-Live, write the steps a loader would take to build a relative-trajectory chunk for one gripper at index `t0`, without crossing an episode boundary. The [UMI policies page](https://egocam.ai/umi/actions-and-policies/#prompts-you-can-give-an-ai) has a prompt that drafts the code; check its output against your steps.

## Sources

- RoboX Technologies: [lerobot-dataset card](https://huggingface.co/datasets/RoboXTechnologies/lerobot-dataset), read 2026-11-08.
- brandonyang: [UMI-Live dataset card](https://huggingface.co/datasets/brandonyang/umi-live-dataset), read 2026-11-08.
- Hugging Face LeRobot: [installation](https://huggingface.co/docs/lerobot/installation), [LeRobotDataset v3.0](https://huggingface.co/docs/lerobot/lerobot-dataset-v3), [using dataset tools](https://huggingface.co/docs/lerobot/using_dataset_tools), [action representations](https://huggingface.co/docs/lerobot/action_representations); repository [huggingface/lerobot](https://github.com/huggingface/lerobot) at commit `d490e47`: [load_lerobot_dataset.py](https://github.com/huggingface/lerobot/blob/main/examples/dataset/load_lerobot_dataset.py) and [datasets/utils.py](https://github.com/huggingface/lerobot/blob/main/src/lerobot/datasets/utils.py).
- Hugging Face Hub client: [download files from the Hub](https://huggingface.co/docs/huggingface_hub/guides/download).
- SciPy: [scipy.spatial.transform.Rotation](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.transform.Rotation.html).
- Field guide: [From Gripper Demonstrations to Robot Policies](https://egocam.ai/umi/actions-and-policies/), [Training Formats: LeRobot and RLDS](https://egocam.ai/processing/training-formats-lerobot-rlds/), [Co-Training on Human and Robot Data](https://egocam.ai/robot-learning/co-training-human-and-robot-data/), [Dataset Licences and Access](https://egocam.ai/datasets/licences-and-access/).
