LabEmbodied-Data-Beta / docs /data_format.md
Lou1s05's picture
Add dataset documentation, indexes, and conversion example
2d82de8 verified
|
Raw History Blame Contribute Delete
3.19 kB
# Data format
## Episode files and indexes
Episodes are grouped by robot, task family, and task configuration:
```text
<robot>/<family>/<case>/
dataset/
episode_XXXX.h5
meta/episode.jsonl
meta/randomization_episodes.jsonl
resolved_config.yaml
results/
```
- `meta/episodes.jsonl` lists episodes, unique `episode_id` values, H5 paths, instructions, and associated files.
- `meta/cases.jsonl` lists task configurations and their metadata files.
- `meta/info.json` contains dataset information and current statistics.
Index paths are relative to the dataset root. Episode numbers are local to each task configuration and may be non-consecutive. Use the global index to enumerate files.
For associated annotations, match `hdf5_path` or `meta.episode_index` in randomization records and `h5_episode_index` in result records. Task configurations are available as `resolved_config.yaml`.
## H5 fields
Read array shapes, column names, camera names, and frame rate from each file. Below, `T` is the frame count, `D` the selected joint-state dimension, `J` the full joint-state dimension, `K` the object count, `C` the camera count, and `S` the subgoal count.
| Field | Description |
|---|---|
| `agent_pose` | `(T, D)` joint states; columns are described by `agent_pose_names` and the associated index arrays. |
| `actions` | `(T, D)` joint-position targets. |
| `joint_positions` | `(T, J)` joint states, with columns described by `joint_position_names`. |
| `ee_pose`, `ee_pose_valid` | End-effector poses and validity flags; see `ee_pose_names` and `ee_frame`. |
| `camera_*_rgb` | One-dimensional `uint8` arrays containing H.264 MP4 video bytes. |
| `language_instruction`, `subtask_instructions` | Episode and subtask instructions. |
| `step_index` | `(T,)` workflow-stage indices; `-1` marks transition frames. |
| `object_positions`, `object_orientations`, `object_names` | Object poses and names. Quaternion order is given by the `quaternion_order` attribute. |
| `bboxes_2d`, `bbox_visibility`, `bbox_camera_names` | `(T, K, C, 4)` image-space boxes, visibility flags, and camera-axis names. |
| `subgoals/frame_idx`, `subgoals/camera_names`, `subgoals/images_png` | Zero-based frame indices, camera names, and an `(S, C)` grid of PNG byte arrays. |
`actions[t]` contains the next recorded joint state; the final target is the measured state at episode end. Read the column names and gripper indices when interpreting joint values.
Video bytes must be decoded before accessing images. OpenCV returns BGR images; convert them to RGB before use. Use the H5 `fps` and `frame_count` attributes for timing and length.
## Read an episode
```python
import json
from pathlib import Path
import h5py
root = Path(".")
with (root / "meta/episodes.jsonl").open() as index:
item = json.loads(next(index))
with h5py.File(root / item["hdf5_path"], "r") as episode:
states = episode["agent_pose"][()]
actions = episode["actions"][()]
instruction = episode["language_instruction"].asstr()[()]
```
For an optional LeRobot export with video decoding, see [convert_to_lerobot.py](../examples/convert_to_lerobot.py) and the command in the [README](../README.md).