Multi-task video release: tasks.json + README + ReactVideoDataset loader
Browse files- README.md +55 -197
- examples/react_video_dataset.py +167 -0
- tasks.json +64 -52
README.md
CHANGED
|
@@ -10,229 +10,87 @@ tags:
|
|
| 10 |
- gelsight
|
| 11 |
- realsense
|
| 12 |
- motion-capture
|
| 13 |
-
- dynamics
|
| 14 |
- world-model
|
| 15 |
- human-collected
|
|
|
|
| 16 |
pretty_name: React (Tactile-Visual Manipulation)
|
| 17 |
size_categories:
|
| 18 |
- 100K<n<1M
|
| 19 |
-
configs:
|
| 20 |
-
- config_name: episode_metadata
|
| 21 |
-
data_files:
|
| 22 |
-
- split: train
|
| 23 |
-
path: metadata/episodes.parquet
|
| 24 |
-
- config_name: motherboard
|
| 25 |
-
data_files:
|
| 26 |
-
- split: train
|
| 27 |
-
path: episodes/motherboard/**/episode_*.pt
|
| 28 |
-
- config_name: motherboard_segments
|
| 29 |
-
data_files:
|
| 30 |
-
- split: train
|
| 31 |
-
path: segments/motherboard/**/episode_*.segment_*.pt
|
| 32 |
-
- config_name: all
|
| 33 |
-
data_files:
|
| 34 |
-
- split: train
|
| 35 |
-
path: episodes/**/episode_*.pt
|
| 36 |
---
|
| 37 |
|
| 38 |
-
# React
|
| 39 |
|
| 40 |
-
Dense, contact-rich, synchronized multimodal interaction data collected from **human hands holding handheld GelSight tactile sensors
|
| 41 |
|
| 42 |
-
|
| 43 |
|
| 44 |
-
|
| 45 |
|
| 46 |
-
|
| 47 |
|
| 48 |
-
| | |
|
| 49 |
-
|---|---|
|
| 50 |
-
| **Robot-arm-free** | Recorded directly from a human operator holding two GelSight Mini sensors. No robot kinematics, no embodiment bias, no robot occluding the scene. |
|
| 51 |
-
| **Tactile + RGB-D + mocap, simultaneous** | Most manipulation datasets ship one of these. React ships all three, synchronized to a common 30 Hz clock. |
|
| 52 |
-
| **Contact-dense** | **64 % of post-trim frames** have confirmed tactile contact on at least one sensor — see [`figures/contact_intensity_full.png`](figures/contact_intensity_full.png). |
|
| 53 |
-
| **Long, continuous interaction** | Recordings are minutes long, not seconds. Median recording duration is 4 min; longest 19 min. Good for short-window sampling of dynamics, not for action-conditioned policy learning. |
|
| 54 |
-
|
| 55 |
-

|
| 56 |
-
|
| 57 |
-
## At a glance
|
| 58 |
-
|
| 59 |
-
| | |
|
| 60 |
-
|---|---|
|
| 61 |
-
| Embodiment | **Human hands (no robot)** — handheld GelSight sensors with motion-capture rigid bodies |
|
| 62 |
-
| Intended use | Dynamics / world-model learning over short multimodal windows. Sample short trajectories (1 s – 10 s); recording-file boundaries are not action boundaries. |
|
| 63 |
-
| Total synchronized duration | **105.7 min** at 30 Hz (190,231 multimodal frames, post-trim) |
|
| 64 |
-
| Bimanual tactile-contact time | **64.3 % of post-trim frames** (3,302 contact events, median 0.73 s; see [`figures/dataset_figures/F2_contact_event_duration_histogram.png`](figures/dataset_figures/F2_contact_event_duration_histogram.png) and [`metadata/episodes.parquet`](metadata/episodes.parquet) for per-file numbers) |
|
| 65 |
-
| Cameras | 3× Intel RealSense D415 (color + depth), 480×640, 30 FPS |
|
| 66 |
-
| Tactile | 2× GelSight Mini (left, right), handheld |
|
| 67 |
-
| Motion capture | OptiTrack VRPN, 3 rigid bodies, ~120 Hz |
|
| 68 |
-
| Tasks | `motherboard` (more coming) |
|
| 69 |
-
| License | CC-BY-4.0 |
|
| 70 |
-
|
| 71 |
-
## Recording sessions
|
| 72 |
-
|
| 73 |
-
| Date | Kind | Active sensors | Notes |
|
| 74 |
-
|---|---|---|---|
|
| 75 |
-
| 2026-05-10 | session | left + right | First full bimanual session. |
|
| 76 |
-
| 2026-05-11 | session | left + right | Largest session. A handful of GelSight LED-flicker frames + one mocap teleport; see [`bad_frames.json`](bad_frames.json). |
|
| 77 |
-
|
| 78 |
-
| 2026-05-19 | session | left + right | New session, multi-cam (`view_left/middle/right`) end-to-end. Curation via reproducible `detect_bad_intervals.py` ruleset (see [`docs/curation_pipeline.md`](docs/curation_pipeline.md)). |
|
| 79 |
-
|
| 80 |
-
See [`tasks.json`](tasks.json) for the machine-readable registry (per-date `active_sensors`, etc.).
|
| 81 |
-
|
| 82 |
-
**OT-uninitialized prefixes trimmed.** Three episodes had OptiTrack offline at the start of recording (1–11 min each); those prefixes have been cut from the published `.pt` files (`_contact_meta.trim_offset` per file). Future recordings use an OT watchdog that refuses to start an episode unless mocap is streaming. Full story: [`docs/caveats.md`](docs/caveats.md).
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
## Data quality
|
| 87 |
-
|
| 88 |
-
| Mode | Frames | % | Files | Cause |
|
| 89 |
-
|---|---:|---:|---:|---|
|
| 90 |
-
| GelSight LED flicker | 56 | 0.029 % | 5 | Single-frame LED dropout, recovers next frame |
|
| 91 |
-
| OptiTrack pose teleport | 56 | 0.029 % | 3 | Solver flip (translation > 5 m/s or angular > 15 rad/s) |
|
| 92 |
-
| OptiTrack track loss | 1,680 | 0.883 % | 6 | Marker briefly left mocap-volume / camera FOV mid-episode |
|
| 93 |
-
| **Total (union)** | **1,768** | **0.929 %** | **11** | |
|
| 94 |
-
|
| 95 |
-
Every flagged interval is in [`bad_frames.json`](bad_frames.json) keyed by `episode/episode_*` with TRIMMED-pt frame indices. A richer per-event view (with cross-modal motion + OT-gap + angular-velocity stats) lives in [`freeze_intervals.json`](freeze_intervals.json). Skip-list usage is shown below and in [`docs/quality.md`](docs/quality.md). Long start-of-episode OT-uninitialized prefixes (the dominant problem in the raw recordings) have already been trimmed from the published `.pt` files — see [`docs/caveats.md`](docs/caveats.md).
|
| 96 |
-
|
| 97 |
-
## Two layouts: `episodes/` vs `segments/`
|
| 98 |
-
|
| 99 |
-
The same recordings are shipped two ways depending on what your code
|
| 100 |
-
wants to do:
|
| 101 |
-
|
| 102 |
-
- **`episodes/<task>/<date>/episode_*.pt`** — one file per recording.
|
| 103 |
-
Includes bad intervals (LED flicker, pose teleport, OT track loss)
|
| 104 |
-
inside; downstream code is expected to filter them out using
|
| 105 |
-
`bad_frames.json`. Each file carries all three RealSense views
|
| 106 |
-
(`view_left`, `view_middle`, `view_right`) plus both GelSights.
|
| 107 |
-
- **`segments/<task>/<date>/episode_*.segment_*.pt`** — same
|
| 108 |
-
recordings, but **pre-sliced into contiguous clean segments at
|
| 109 |
-
every bad-frames boundary**. No `bad_frames.json` lookup needed;
|
| 110 |
-
the data is clean by construction. Index lookup via
|
| 111 |
-
[`segments.json`](segments.json). Each segment's
|
| 112 |
-
`_contact_meta.source_h5_frame_range` maps it back to the
|
| 113 |
-
original recording. The example `ReactSegmentDataset`
|
| 114 |
-
([`examples/react_segment_dataset.py`](examples/react_segment_dataset.py))
|
| 115 |
-
consumes these.
|
| 116 |
-
|
| 117 |
-
Both layouts have identical content (same source recordings, same
|
| 118 |
-
frame data); only the file boundaries differ.
|
| 119 |
-
|
| 120 |
-
## Quick start
|
| 121 |
-
|
| 122 |
-
```python
|
| 123 |
-
# Load by task with `datasets`
|
| 124 |
-
from datasets import load_dataset
|
| 125 |
-
ds = load_dataset("yxma/React", "motherboard", split="train")
|
| 126 |
```
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
)
|
| 138 |
-
|
| 139 |
-
#
|
| 140 |
-
# ep["tactile_left"], ep["tactile_right"] (T, 3, 128, 128) uint8
|
| 141 |
-
# ep["sensor_left_pose"], ep["sensor_right_pose"]
|
| 142 |
-
# (T, 7) float32 — xyz + quaternion
|
| 143 |
-
# ep["timestamps"] (T,) float64
|
| 144 |
-
# Plus per-frame contact metrics: tactile_{side}_{intensity, area, mixed}
|
| 145 |
```
|
| 146 |
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
def is_clean_window(episode_key, t_start, t_end):
|
| 156 |
-
"""True iff [t_start, t_end] doesn't intersect any flagged span."""
|
| 157 |
-
bf = bad[episode_key]
|
| 158 |
-
intervals = (bf["intensity_spikes"]
|
| 159 |
-
+ bf["pose_teleports_L"] + bf["pose_teleports_R"]
|
| 160 |
-
+ bf["ot_loss_L"] + bf["ot_loss_R"])
|
| 161 |
-
return all(not (s <= t_end and e >= t_start) for s, e in intervals)
|
| 162 |
-
```
|
| 163 |
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
## Example dataloader — short contact-rich windows
|
| 167 |
-
|
| 168 |
-
A reference PyTorch `Dataset` is shipped under [`examples/react_window_dataset.py`](examples/react_window_dataset.py). It scans the processed `.pt` files, applies the contact filter, drops windows that overlap [`bad_frames.json`](bad_frames.json), and respects the per-date `active_sensors` field from [`tasks.json`](tasks.json).
|
| 169 |
-
|
| 170 |
-
```python
|
| 171 |
-
from examples.react_window_dataset import ReactWindowDataset
|
| 172 |
-
from torch.utils.data import DataLoader
|
| 173 |
-
|
| 174 |
-
ds = ReactWindowDataset(
|
| 175 |
-
data_root="episodes/motherboard",
|
| 176 |
-
bad_frames_path="bad_frames.json",
|
| 177 |
-
tasks_json_path="tasks.json",
|
| 178 |
-
window_length=16, # frames per window
|
| 179 |
-
stride=1, # within-window stride (1 = consecutive)
|
| 180 |
-
window_step=16, # step between window starts (overlap control)
|
| 181 |
-
contact_metric="mixed", # "intensity" | "area" | "mixed"
|
| 182 |
-
tactile_threshold=0.4,
|
| 183 |
-
min_contact_fraction=0.6, # ≥ 60 % of window frames must have contact
|
| 184 |
-
which_sensors="any", # "any" | "both" | "left" | "right"
|
| 185 |
-
skip_bad_frames=True,
|
| 186 |
-
respect_active_sensors=True,
|
| 187 |
-
)
|
| 188 |
-
print(len(ds), "windows")
|
| 189 |
-
loader = DataLoader(ds, batch_size=8, shuffle=True, num_workers=2)
|
| 190 |
-
```
|
| 191 |
|
| 192 |
-
|
| 193 |
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
| 195 |
|
| 196 |
-
|
| 197 |
|
| 198 |
-
|
|
|
|
|
|
|
|
|
|
| 199 |
|
| 200 |
-
|
| 201 |
|
| 202 |
-
|
| 203 |
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
## Recording-file previews
|
| 207 |
-
|
| 208 |
-
Per-episode previews live under [`figures/episode_previews/`](figures/episode_previews/) as inline-renderable MP4s. **Browse all 32 episodes (collapsed by default) on [](figures/episode_previews/index.md) — click any row to preview that episode inline.** Each shows 60 frames evenly sampled across the episode in the recording-viewer layout: 3 RealSense cameras with projected GelSight axes, GelSight raw + diff thumbs, OptiTrack pose text panel. (The on-disk recording unit is called an "episode" purely for file naming — these boundaries don't carry semantic / action meaning for this dataset.)
|
| 209 |
-
|
| 210 |
-
## Repository layout
|
| 211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
```
|
| 213 |
-
|
| 214 |
-
tasks.json # task / session registry
|
| 215 |
-
bad_frames.json # data-quality skip-list
|
| 216 |
-
episodes/<task>/<date>/episode_*.pt # per-file tensors
|
| 217 |
-
figures/ # previews + analysis figures
|
| 218 |
-
docs/ # extended documentation
|
| 219 |
-
```
|
| 220 |
|
| 221 |
-
##
|
|
|
|
| 222 |
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
| [`docs/quality.md`](docs/quality.md) | Data-quality breakdown (per-mode), `bad_frames.json` schema, dataloader recipe, inspection figures |
|
| 228 |
-
| [`docs/figures.md`](docs/figures.md) | Dataset statistics + analysis gallery (F1–F8) |
|
| 229 |
-
| [`docs/caveats.md`](docs/caveats.md) | Known caveats and roadmap |
|
| 230 |
|
| 231 |
## License
|
| 232 |
-
|
| 233 |
-
Released under [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/) (CC-BY-4.0).
|
| 234 |
-
|
| 235 |
-
## Citation
|
| 236 |
-
|
| 237 |
-
If you use this dataset, please cite (TODO: add bibtex).
|
| 238 |
-
|
|
|
|
| 10 |
- gelsight
|
| 11 |
- realsense
|
| 12 |
- motion-capture
|
|
|
|
| 13 |
- world-model
|
| 14 |
- human-collected
|
| 15 |
+
- lerobot
|
| 16 |
pretty_name: React (Tactile-Visual Manipulation)
|
| 17 |
size_categories:
|
| 18 |
- 100K<n<1M
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
---
|
| 20 |
|
| 21 |
+
# React — Multi-Task Tactile-Visual Manipulation
|
| 22 |
|
| 23 |
+
Dense, contact-rich, synchronized multimodal interaction data collected from **human hands holding handheld GelSight tactile sensors** (no robot arm). Intended for **tactile-visual dynamics / world-model learning**.
|
| 24 |
|
| 25 |
+
> **133 min · 240 k frames @ 30 Hz · 3× RGB + 2× GelSight + OptiTrack · 2 tasks**
|
| 26 |
|
| 27 |
+
## Format — LeRobot-style video release
|
| 28 |
|
| 29 |
+
Each episode ships as **5 MP4 video streams** (640×480, H.264) + a **per-frame parquet** of poses and contact metrics. This matches how LeRobot / DROID / Open X-Embodiment ship manipulation data: tiny on disk (whole dataset ≈ 4.3 GB vs ~1 TB raw), random-access decodable, training-ready.
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
```
|
| 32 |
+
data/<task>/
|
| 33 |
+
├── calibration/ # OptiTrack→camera extrinsics for this task
|
| 34 |
+
│ ├── T_mocap_to_cam_{left,middle,right}.json
|
| 35 |
+
│ ├── T_gel_to_rigid_{left,right}.json
|
| 36 |
+
│ └── calibration.json # epoch, applies-to dates, RMSE, chain
|
| 37 |
+
├── videos/<date>/episode_NNN/
|
| 38 |
+
│ ├── view_left.mp4 view_middle.mp4 view_right.mp4 # 640×480 RGB
|
| 39 |
+
│ └── tactile_left.mp4 tactile_right.mp4 # 640×480 GelSight
|
| 40 |
+
├── meta/<date>/episode_NNN.parquet # one row per frame (see below)
|
| 41 |
+
├── episodes.jsonl # one row per episode
|
| 42 |
+
├── segments.json # clean-segment index (no bad frames)
|
| 43 |
+
├── bad_frames.json # quality intervals per episode
|
| 44 |
+
└── previews/<date>/episode_NNN.mp4 # 1280×480 viewer-layout preview
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
```
|
| 46 |
|
| 47 |
+
### parquet columns (per frame, aligned to video frame `i`)
|
| 48 |
+
| Column | Type | Meaning |
|
| 49 |
+
|---|---|---|
|
| 50 |
+
| `frame_idx` | int | 0…T-1, matches MP4 frame index |
|
| 51 |
+
| `timestamp` | float64 | camera clock (s) |
|
| 52 |
+
| `sensor_left_pose`, `sensor_right_pose` | list[7] | OptiTrack world pose (xyz + quat wxyz) |
|
| 53 |
+
| `tactile_{L,R}_{intensity,area,mixed}` | float32 | contact metrics (computed at full 640×480) |
|
| 54 |
+
| `source_h5_frame` | int | index into the original recording |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
+
**Decoded frames are RGB** (standard decoder convention) for all five streams.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
+
## Tasks
|
| 59 |
|
| 60 |
+
| Task | Episodes | Dates | Duration | Clean segments | Calibration |
|
| 61 |
+
|---|---|---|---|---|---|
|
| 62 |
+
| **motherboard** | 32 | 2026-05-10/11/19 | 108 min | 76 (107 min) | **May-12** (RMSE ~5 mm) |
|
| 63 |
+
| **pushT** | 4 | 2026-06-18 | 25 min | 17 (25 min) | **June-26** (RMSE ~0.6 px) |
|
| 64 |
|
| 65 |
+
See [`tasks.json`](tasks.json) for the machine-readable registry (per-task dates, sensors, calibration epoch, world-frame offsets).
|
| 66 |
|
| 67 |
+
### Calibration epochs
|
| 68 |
+
Cameras were **recalibrated between tasks**. Each task points to the calibration valid for its recordings:
|
| 69 |
+
- `motherboard` → **May-12** extrinsics (`data/motherboard/calibration/`)
|
| 70 |
+
- `pushT` → **June-26** extrinsics (`data/pushT/calibration/`)
|
| 71 |
|
| 72 |
+
Camera extrinsics are used only for the projection overlay; **stored poses are OptiTrack world-frame** and independent of calibration. The 2026-05-19 motherboard session had a redefined world origin; an offset `(0.23, 0, 0.175) m` is already baked into its poses so all dates share one frame (recorded in `episodes.jsonl`).
|
| 73 |
|
| 74 |
+
## Loading
|
| 75 |
|
| 76 |
+
```python
|
| 77 |
+
from examples.react_video_dataset import ReactVideoDataset
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
+
ds = ReactVideoDataset("data/motherboard", window_length=16, mode="segment")
|
| 80 |
+
sample = ds[0]
|
| 81 |
+
# sample["view_middle"]: (16, 480, 640, 3) uint8 RGB
|
| 82 |
+
# sample["tactile_left"]: (16, 480, 640, 3) uint8 RGB
|
| 83 |
+
# sample["sensor_left_pose"]: (16, 7) float32
|
| 84 |
```
|
| 85 |
+
`mode="segment"` iterates clean spans (no bad frames by construction); `mode="window"` slides over whole episodes and skips `bad_frames.json` intervals. Backend: PyAV (install `decord` for faster random access).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
+
## Data quality
|
| 88 |
+
Per-task `bad_frames.json` flags `intensity_spikes`, `pose_teleports_{L,R}`, `ot_loss_{L,R}` (OptiTrack track loss). Overall flagged: motherboard 0.90 %, pushT 0.67 %. `segments.json` already excludes them.
|
| 89 |
|
| 90 |
+
## Notes
|
| 91 |
+
- **Depth** is available in the source recordings and will be added under `data/<task>/depth/` in a later upload.
|
| 92 |
+
- One pushT source recording (`episode_004`) was corrupt and excluded.
|
| 93 |
+
- The previous single-task `.pt` release (`episodes/`, `segments/`) is superseded by this video format.
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
## License
|
| 96 |
+
[CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
examples/react_video_dataset.py
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""ReactVideoDataset — load the React multi-task video-format release.
|
| 2 |
+
|
| 3 |
+
Layout consumed (per task):
|
| 4 |
+
data/<task>/videos/<date>/episode_NNN/{view_left,view_middle,view_right,
|
| 5 |
+
tactile_left,tactile_right}.mp4
|
| 6 |
+
data/<task>/meta/<date>/episode_NNN.parquet # per-frame pose/scalar
|
| 7 |
+
data/<task>/segments.json # clean-segment index
|
| 8 |
+
data/<task>/bad_frames.json # quality intervals
|
| 9 |
+
data/<task>/episodes.jsonl # per-episode summary
|
| 10 |
+
data/<task>/calibration/ # extrinsics (May-12 / June-26)
|
| 11 |
+
|
| 12 |
+
Decoded frames are returned as RGB uint8 (H, W, 3) — standard video-decoder
|
| 13 |
+
convention. (cv2 users: this is already RGB, do NOT re-swap.)
|
| 14 |
+
|
| 15 |
+
Two sampling modes:
|
| 16 |
+
mode="segment": iterate clean segments from segments.json (no bad frames
|
| 17 |
+
by construction). RECOMMENDED.
|
| 18 |
+
mode="window": sliding windows over whole episodes; windows overlapping
|
| 19 |
+
bad_frames.json intervals are skipped when skip_bad=True.
|
| 20 |
+
|
| 21 |
+
Decoder backend: PyAV (`av`) by default; falls back to OpenCV. Install
|
| 22 |
+
`decord` for fastest random access.
|
| 23 |
+
|
| 24 |
+
Example
|
| 25 |
+
-------
|
| 26 |
+
ds = ReactVideoDataset("data/motherboard", window_length=16, mode="segment")
|
| 27 |
+
sample = ds[0]
|
| 28 |
+
# sample["view_middle"]: (T, H, W, 3) uint8 RGB
|
| 29 |
+
# sample["sensor_left_pose"]: (T, 7) float32
|
| 30 |
+
"""
|
| 31 |
+
from __future__ import annotations
|
| 32 |
+
|
| 33 |
+
import json
|
| 34 |
+
from pathlib import Path
|
| 35 |
+
|
| 36 |
+
import numpy as np
|
| 37 |
+
import pyarrow.parquet as pq
|
| 38 |
+
|
| 39 |
+
try:
|
| 40 |
+
import av
|
| 41 |
+
_BACKEND = "av"
|
| 42 |
+
except Exception:
|
| 43 |
+
import cv2
|
| 44 |
+
_BACKEND = "cv2"
|
| 45 |
+
|
| 46 |
+
VIEW_STREAMS = ("view_left", "view_middle", "view_right")
|
| 47 |
+
TACTILE_STREAMS = ("tactile_left", "tactile_right")
|
| 48 |
+
ALL_STREAMS = VIEW_STREAMS + TACTILE_STREAMS
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def _decode_frames(mp4_path: Path, frame_indices):
|
| 52 |
+
"""Return (N, H, W, 3) uint8 RGB for the requested frame indices."""
|
| 53 |
+
want = list(frame_indices)
|
| 54 |
+
if _BACKEND == "av":
|
| 55 |
+
container = av.open(str(mp4_path))
|
| 56 |
+
stream = container.streams.video[0]
|
| 57 |
+
out, wantset, got = {}, set(want), 0
|
| 58 |
+
for fi, frame in enumerate(container.decode(stream)):
|
| 59 |
+
if fi in wantset:
|
| 60 |
+
out[fi] = frame.to_ndarray(format="rgb24")
|
| 61 |
+
got += 1
|
| 62 |
+
if got == len(wantset):
|
| 63 |
+
break
|
| 64 |
+
container.close()
|
| 65 |
+
return np.stack([out[i] for i in want])
|
| 66 |
+
else: # cv2 fallback (BGR -> RGB)
|
| 67 |
+
cap = cv2.VideoCapture(str(mp4_path))
|
| 68 |
+
frames = []
|
| 69 |
+
for i in want:
|
| 70 |
+
cap.set(cv2.CAP_PROP_POS_FRAMES, i)
|
| 71 |
+
ok, fr = cap.read()
|
| 72 |
+
frames.append(fr[..., ::-1] if ok else np.zeros((480, 640, 3), np.uint8))
|
| 73 |
+
cap.release()
|
| 74 |
+
return np.stack(frames)
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
class ReactVideoDataset:
|
| 78 |
+
def __init__(self, task_root, window_length=16, stride=1, window_step=None,
|
| 79 |
+
mode="segment", streams=ALL_STREAMS, skip_bad=True,
|
| 80 |
+
which_sensors="any"):
|
| 81 |
+
self.root = Path(task_root)
|
| 82 |
+
self.W = window_length
|
| 83 |
+
self.stride = stride
|
| 84 |
+
self.step = window_step or window_length
|
| 85 |
+
self.mode = mode
|
| 86 |
+
self.streams = tuple(streams)
|
| 87 |
+
self.skip_bad = skip_bad
|
| 88 |
+
self.which = which_sensors
|
| 89 |
+
|
| 90 |
+
self.segments = json.loads((self.root / "segments.json").read_text())["segments"]
|
| 91 |
+
self.bad = json.loads((self.root / "bad_frames.json").read_text())["episodes"]
|
| 92 |
+
self.index = self._build_index()
|
| 93 |
+
|
| 94 |
+
def _video_dir(self, ep_key):
|
| 95 |
+
date, ep = ep_key.split("/")
|
| 96 |
+
return self.root / "videos" / date / ep
|
| 97 |
+
|
| 98 |
+
def _parquet(self, ep_key):
|
| 99 |
+
date, ep = ep_key.split("/")
|
| 100 |
+
return self.root / "meta" / date / f"{ep}.parquet"
|
| 101 |
+
|
| 102 |
+
def _bad_mask(self, ep_key, T):
|
| 103 |
+
m = np.zeros(T, bool)
|
| 104 |
+
e = self.bad.get(ep_key, {})
|
| 105 |
+
for k in ("intensity_spikes", "pose_teleports_L", "pose_teleports_R",
|
| 106 |
+
"ot_loss_L", "ot_loss_R"):
|
| 107 |
+
for a, b in e.get(k, []):
|
| 108 |
+
m[max(0, a):min(T, b + 1)] = True
|
| 109 |
+
return m
|
| 110 |
+
|
| 111 |
+
def _build_index(self):
|
| 112 |
+
items = []
|
| 113 |
+
span = (self.W - 1) * self.stride + 1
|
| 114 |
+
if self.mode == "segment":
|
| 115 |
+
for s in self.segments:
|
| 116 |
+
ek, a, b = s["source_episode"], s["frame_range"][0], s["frame_range"][1]
|
| 117 |
+
start = a
|
| 118 |
+
while start + span - 1 <= b:
|
| 119 |
+
items.append((ek, start))
|
| 120 |
+
start += self.step
|
| 121 |
+
else: # window over whole episode
|
| 122 |
+
for s in self.segments: # reuse episode list via segments' episodes
|
| 123 |
+
pass
|
| 124 |
+
eps = sorted({s["source_episode"] for s in self.segments})
|
| 125 |
+
for ek in eps:
|
| 126 |
+
T = self.bad.get(ek, {}).get("n_frames", 0)
|
| 127 |
+
bad = self._bad_mask(ek, T) if self.skip_bad else np.zeros(T, bool)
|
| 128 |
+
start = 0
|
| 129 |
+
while start + span - 1 < T:
|
| 130 |
+
idx = range(start, start + span, self.stride)
|
| 131 |
+
if not (self.skip_bad and bad[list(idx)].any()):
|
| 132 |
+
items.append((ek, start))
|
| 133 |
+
start += self.step
|
| 134 |
+
return items
|
| 135 |
+
|
| 136 |
+
def __len__(self):
|
| 137 |
+
return len(self.index)
|
| 138 |
+
|
| 139 |
+
def __getitem__(self, i):
|
| 140 |
+
ek, start = self.index[i]
|
| 141 |
+
idx = list(range(start, start + (self.W - 1) * self.stride + 1, self.stride))
|
| 142 |
+
vd = self._video_dir(ek)
|
| 143 |
+
out = {s: _decode_frames(vd / f"{s}.mp4", idx) for s in self.streams}
|
| 144 |
+
tbl = pq.read_table(self._parquet(ek)).slice(start, idx[-1] - start + 1)
|
| 145 |
+
# subsample by stride
|
| 146 |
+
rows = [r - start for r in idx]
|
| 147 |
+
pl = np.array(tbl.column("sensor_left_pose").to_pylist(), np.float32)[rows]
|
| 148 |
+
pr = np.array(tbl.column("sensor_right_pose").to_pylist(), np.float32)[rows]
|
| 149 |
+
out["sensor_left_pose"] = pl
|
| 150 |
+
out["sensor_right_pose"] = pr
|
| 151 |
+
for c in ("tactile_left_intensity", "tactile_right_intensity",
|
| 152 |
+
"tactile_left_mixed", "tactile_right_mixed"):
|
| 153 |
+
out[c] = np.array(tbl.column(c).to_pylist(), np.float32)[rows]
|
| 154 |
+
out["episode"] = ek
|
| 155 |
+
out["frame_start"] = start
|
| 156 |
+
return out
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
if __name__ == "__main__":
|
| 160 |
+
import sys
|
| 161 |
+
root = sys.argv[1] if len(sys.argv) > 1 else "data/motherboard"
|
| 162 |
+
ds = ReactVideoDataset(root, window_length=8, mode="segment")
|
| 163 |
+
print(f"backend={_BACKEND} {len(ds)} windows")
|
| 164 |
+
s = ds[0]
|
| 165 |
+
for k, v in s.items():
|
| 166 |
+
shape = getattr(v, "shape", v)
|
| 167 |
+
print(f" {k}: {shape}")
|
tasks.json
CHANGED
|
@@ -1,62 +1,74 @@
|
|
| 1 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
"tasks": {
|
| 3 |
"motherboard": {
|
| 4 |
-
"
|
| 5 |
-
"purpose": "Dense, contact-rich, synchronized multimodal interaction data for tactile-visual dynamics / world-model learning. Not a policy-learning / demonstration dataset.",
|
| 6 |
-
"operator": "human hands (handheld GelSight Mini sensors with motion-capture rigid bodies; no robot arm involved)",
|
| 7 |
-
"embodiment": "human",
|
| 8 |
"dates": [
|
| 9 |
"2026-05-10",
|
| 10 |
-
"2026-05-11"
|
|
|
|
| 11 |
],
|
| 12 |
-
"
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
"kind": "session",
|
| 31 |
-
"active_sensors": [
|
| 32 |
-
"left",
|
| 33 |
-
"right"
|
| 34 |
-
],
|
| 35 |
-
"note": "Recorded with all 3 RealSense views and both GelSight sensors. OptiTrack world origin was redefined on 2026-05-19 relative to earlier sessions; an offset of (dx=0.230, dy=0.000, dz=0.175) m has been added to sensor_{left,right}_pose translation columns of every .pt (and to OT samples during preview rendering) so all 32 episodes share one world frame. See _contact_meta.world_frame_offset_applied in each 2026-05-19 .pt for the per-file record.",
|
| 36 |
-
"world_frame_offset_applied": [
|
| 37 |
-
0.23,
|
| 38 |
-
0.0,
|
| 39 |
-
0.175
|
| 40 |
-
]
|
| 41 |
-
}
|
| 42 |
-
},
|
| 43 |
-
"n_episode_files": 27,
|
| 44 |
-
"notes": "2026-05-11/episode_001 was lost at recording time (HDF5 superblock not finalized). 2026-05-11/episodes 000 and 002 were short test recordings with no tactile contact and were dropped.",
|
| 45 |
-
"trim_offsets": {
|
| 46 |
-
"2026-05-11/episode_005": 2429,
|
| 47 |
-
"2026-05-11/episode_012": 9719,
|
| 48 |
-
"2026-05-11/episode_017": 19228
|
| 49 |
},
|
| 50 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
}
|
| 52 |
-
},
|
| 53 |
-
"schema_version": "mode1_v1",
|
| 54 |
-
"layout": "processed/mode1_v1/<task>/<date>/episode_*.{pt,contact.json} (raw with bad intervals) OR processed/mode2_v1/<task>/<date>/episode_*.segment_*.pt (pre-sliced clean segments; see segments.json)",
|
| 55 |
-
"mode2_v1": {
|
| 56 |
-
"description": "Same recordings as mode1_v1 but sliced at every bad-frames boundary into contiguous clean segments. Use with examples/react_segment_dataset.py.",
|
| 57 |
-
"n_segments": 73,
|
| 58 |
-
"total_frames": 188442,
|
| 59 |
-
"total_duration_min": 104.69,
|
| 60 |
-
"manifest": "segments.json"
|
| 61 |
}
|
| 62 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"dataset": "React",
|
| 3 |
+
"format": "video (LeRobot-style: per-camera MP4 + per-episode parquet)",
|
| 4 |
+
"resolution": "640x480",
|
| 5 |
+
"fps": 30,
|
| 6 |
+
"video_streams": [
|
| 7 |
+
"view_left",
|
| 8 |
+
"view_middle",
|
| 9 |
+
"view_right",
|
| 10 |
+
"tactile_left",
|
| 11 |
+
"tactile_right"
|
| 12 |
+
],
|
| 13 |
+
"parquet_columns": [
|
| 14 |
+
"frame_idx",
|
| 15 |
+
"timestamp",
|
| 16 |
+
"sensor_left_pose",
|
| 17 |
+
"sensor_right_pose",
|
| 18 |
+
"tactile_{L,R}_{intensity,area,mixed}",
|
| 19 |
+
"source_h5_frame"
|
| 20 |
+
],
|
| 21 |
+
"decoded_color": "RGB (standard video-decoder convention)",
|
| 22 |
"tasks": {
|
| 23 |
"motherboard": {
|
| 24 |
+
"n_episodes": 32,
|
|
|
|
|
|
|
|
|
|
| 25 |
"dates": [
|
| 26 |
"2026-05-10",
|
| 27 |
+
"2026-05-11",
|
| 28 |
+
"2026-05-19"
|
| 29 |
],
|
| 30 |
+
"n_frames": 194445,
|
| 31 |
+
"duration_min": 108.0,
|
| 32 |
+
"n_segments": 76,
|
| 33 |
+
"clean_min": 107.04,
|
| 34 |
+
"bad_fraction": 0.009,
|
| 35 |
+
"active_sensors": [
|
| 36 |
+
"left",
|
| 37 |
+
"right"
|
| 38 |
+
],
|
| 39 |
+
"calibration_id": "may-12",
|
| 40 |
+
"calibration_created": "2026-05-12",
|
| 41 |
+
"calibration_rmse_unit": "mm",
|
| 42 |
+
"world_frame_offset_dates": {
|
| 43 |
+
"2026-05-19": [
|
| 44 |
+
0.23,
|
| 45 |
+
0.0,
|
| 46 |
+
0.175
|
| 47 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
},
|
| 49 |
+
"gelsight_left_serial": "2BGLKZNT/2DUPB53G",
|
| 50 |
+
"note": "Bimanual handheld tactile-visual interaction. 05-19 has a redefined OptiTrack world origin; an offset (0.23,0,0.175)m is baked into its poses so all dates share one frame."
|
| 51 |
+
},
|
| 52 |
+
"pushT": {
|
| 53 |
+
"n_episodes": 4,
|
| 54 |
+
"dates": [
|
| 55 |
+
"2026-06-18"
|
| 56 |
+
],
|
| 57 |
+
"n_frames": 45595,
|
| 58 |
+
"duration_min": 25.3,
|
| 59 |
+
"n_segments": 17,
|
| 60 |
+
"clean_min": 25.16,
|
| 61 |
+
"bad_fraction": 0.0067,
|
| 62 |
+
"active_sensors": [
|
| 63 |
+
"left",
|
| 64 |
+
"right"
|
| 65 |
+
],
|
| 66 |
+
"calibration_id": "june-26",
|
| 67 |
+
"calibration_created": "2026-06-26",
|
| 68 |
+
"calibration_rmse_unit": "px",
|
| 69 |
+
"world_frame_offset_dates": {},
|
| 70 |
+
"gelsight_left_serial": "2DUPB53G",
|
| 71 |
+
"note": "Push-T manipulation. Recalibrated cameras (June-26). One source H5 (episode_004) was corrupt and excluded."
|
| 72 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
}
|
| 74 |
}
|