File size: 7,910 Bytes
1b98a3c
 
 
 
 
 
6688f09
1b98a3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79319b2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
---
license: other
task_categories:
- robotics
tags:
- libero
- imitation-learning
- robotics
- hdf5
- logical-state
- manipulation
pretty_name: LIBERO Logical State and Action Trajectories
size_categories:
- 1K<n<10K
---

# LIBERO Logical State and Action Trajectories

This repository contains LIBERO robot manipulation trajectories augmented with per-frame logical state and logical action annotations.

The data is stored as HDF5 files under `datasets/`. Each suite has one directory, and each task has one HDF5 file containing multiple demonstrations.

## Recommended Hugging Face Layout

Keep the repository organized like this:

```text
.
├── README.md
├── requirements.txt
├── visualize_dataset.py
└── datasets/
    ├── libero_10/
    │   └── *_demo.hdf5
    ├── libero_90/
    │   └── *_demo.hdf5
    ├── libero_goal/
    │   └── *_demo.hdf5
    ├── libero_object/
    │   └── *_demo.hdf5
    └── libero_spatial/
        └── *_demo.hdf5
```

Use Git LFS for the HDF5 data files. The included `.gitattributes` marks `*.hdf5` files for LFS storage.

Hugging Face can host this layout directly as a dataset repository. Because the trajectories are HDF5 robot data rather than CSV/JSONL/Parquet rows, the Hub's automatic dataset viewer may not render the contents directly. Use `visualize_dataset.py` for interactive inspection.

## Dataset Contents

After filtering trajectories without logical annotations, the dataset contains:

| Suite | HDF5 files | Demonstrations |
|---|---:|---:|
| `libero_10` | 10 | 497 |
| `libero_90` | 89 | 4429 |
| `libero_goal` | 10 | 499 |
| `libero_object` | 10 | 500 |
| `libero_spatial` | 10 | 500 |
| **Total** | **129** | **6425** |

Each HDF5 task file follows this structure:

```text
data/
  demo_0/
    actions
    dones
    rewards
    robot_states
    states
    logical_actions
    logical_states
    obs/
      agentview_rgb
      eye_in_hand_rgb
      ee_pos
      ee_ori
      ee_states
      gripper_states
      joint_states
    logical/
      frame_indices
      states
      actions
  demo_1/
  ...
```

The top-level `data` group also stores task metadata in HDF5 attributes such as `problem_info`, `env_args`, `env_name`, `num_demos`, and `total`.

## Per-Frame Schema

For a frame index `i` in `data/demo_N`, the aligned per-frame fields are:

| Field | Shape per frame | Description |
|---|---:|---|
| `actions[i]` | `(7,)` | Continuous robot action vector. |
| `dones[i]` | scalar | Episode terminal flag. |
| `rewards[i]` | scalar | Reward value. |
| `robot_states[i]` | `(9,)` | Robot state vector. |
| `states[i]` | variable by task | Full simulator state vector. |
| `obs/agentview_rgb[i]` | `(128, 128, 3)` | Third-person RGB observation. |
| `obs/eye_in_hand_rgb[i]` | `(128, 128, 3)` | Wrist camera RGB observation. |
| `obs/ee_pos[i]` | `(3,)` | End-effector position. |
| `obs/ee_ori[i]` | `(3,)` | End-effector orientation. |
| `obs/ee_states[i]` | `(6,)` | Concatenated end-effector state. |
| `obs/gripper_states[i]` | `(2,)` | Gripper state. |
| `obs/joint_states[i]` | `(7,)` | Robot joint state. |
| `logical_actions[i]` | string | Logical action aligned to this raw frame. |
| `logical_states[i]` | JSON string | Logical predicates aligned to this raw frame. |

The `logical/` subgroup preserves the original synced logical arrays:

| Field | Description |
|---|---|
| `logical/frame_indices` | Raw frame indices corresponding to the synced logical state frames. |
| `logical/states` | Exact logical state strings copied from `synced_final`. |
| `logical/actions` | Exact logical action strings copied from `synced_final`. |

`logical_states` and `logical_actions` at the demo root are convenience arrays with the same length as the raw trajectory. Terminal frames are forward-filled from the last available logical value when the source logical action array is shorter than the raw frame sequence.

## Reading the Data

Minimal Python example:

```python
import json
import h5py

path = "datasets/libero_10/KITCHEN_SCENE3_turn_on_the_stove_and_put_the_moka_pot_on_it_demo.hdf5"

with h5py.File(path, "r") as f:
    demo = f["data/demo_0"]
    frame = 10

    agentview = demo["obs/agentview_rgb"][frame]
    eye_in_hand = demo["obs/eye_in_hand_rgb"][frame]
    robot_action = demo["actions"][frame]
    logical_action = demo["logical_actions"][frame].decode("utf-8")
    logical_state = json.loads(demo["logical_states"][frame].decode("utf-8"))

    print(logical_action)
    print(logical_state)
    print(robot_action)
    print(agentview.shape, eye_in_hand.shape)
```

## Visualization App

The repository includes a browser-based HDF5 reader with no web framework dependency. It uses Python's standard HTTP server plus `h5py`, `numpy`, and `Pillow`.

![LIBERO dataset viewer showing RGB observations, logical state, logical action, and robot action values.](data_reader_example.png)

Install dependencies:

```bash
python3 -m pip install -r requirements.txt
```

Run the viewer:

```bash
python3 visualize_dataset.py --host 127.0.0.1 --port 8000
```

By default, the viewer looks for `datasets/` next to `visualize_dataset.py`, so it still works if the repository folder is renamed. Use `--datasets-dir /path/to/datasets` only when the data is stored elsewhere.

Path note: keep `visualize_dataset.py` and `datasets/` in the same repository root when possible. If you move the HDF5 files, pass the new dataset directory explicitly:

```bash
python3 visualize_dataset.py --datasets-dir /absolute/path/to/datasets --host 127.0.0.1 --port 8000
```

Open:

```text
http://127.0.0.1:8000
```

The app supports suite, task, demo, and frame selection, playback controls, both RGB camera streams, logical action, formatted logical predicates, and robot action/state values.

## Data Processing Notes

The logical labels were merged from files named like:

```text
synced_final/{suite}_{task_id}_{demo_id}_pairs.hdf5
```

into the corresponding HDF5 files under `datasets/{suite}/`. The merge script validates task-file correspondence using RGB frame equality before writing logical fields.

The current dataset has already been merged and filtered. Demos without logical annotations were removed, remaining demos were renumbered contiguously, and `num_demos` / `total` attributes were updated.

## Intended Use

This dataset is intended for research on robot manipulation, imitation learning, planning-conditioned policies, language/logical-state grounding, and analysis of action/state abstractions in LIBERO demonstrations.

## Limitations

- The logical annotations are aligned to existing rendered/simulator frames and should be treated as derived labels.
- HDF5 files are not automatically previewable in the Hugging Face dataset viewer like tabular formats.
- Users should verify compatibility with their downstream LIBERO or imitation-learning pipeline, especially if the pipeline assumes exactly 50 demos per task.

## Citation

If you use this dataset, please cite both the H-WM work associated with these logical annotations and the original LIBERO benchmark:

```bibtex
@article{huang2026hwm,
    title   = {H-WM: Robotic Task and Motion Planning Guided by Hierarchical World Model},
    author  = {Huang, Jinbang and Chen, Wenyuan and Li, Zhiyuan and Pang, Oscar and Hu, Xiao and
               Zhang, Lingfeng and Hu, Yuanzhao and Zhang, Zhanguang and Coates, Mark and
               Cao, Tongtong and Quan, Xingyue and Zhang, Yingxue},
    journal = {arXiv preprint arXiv:2602.11291},
    year    = {2026}
}

@article{liu2023libero,
    title   = {LIBERO: Benchmarking Knowledge Transfer for Lifelong Robot Learning},
    author  = {Liu, Bo and Zhu, Yifeng and Gao, Chongkai and Feng, Yihao and Liu, Qiang and
               Zhu, Yuke and Stone, Peter},
    journal = {arXiv preprint arXiv:2306.03310},
    year    = {2023}
}
```