React / README.md
yxma's picture
README: document the estimated contact-force columns (force_*_normal_n / penetration_mm / target_pose), the 1 N/mm stiffness assumption, and the limits — the data shipped without a word about it
b267863 verified
|
Raw
History Blame
22.3 kB
---
license: cc-by-4.0
task_categories:
- robotics
tags:
- robotics
- tactile
- manipulation
- multimodal
- gelsight
- realsense
- motion-capture
- world-model
- human-collected
- lerobot
pretty_name: React (Tactile-Visual Manipulation)
size_categories:
- 100K<n<1M
configs:
- config_name: motherboard
data_files:
- split: train
path: data/motherboard/meta/**/*.parquet
- config_name: pushT
data_files:
- split: train
path: data/pushT/meta/**/*.parquet
- config_name: all
default: true
data_files:
- split: train
path: data/**/meta/**/*.parquet
---
# React — Multi-Task Tactile-Visual Manipulation
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**.
> **133 min · 240 k frames @ 30 Hz · 3× RGB + 2× GelSight + OptiTrack · 2 tasks**
>
> Rows are written at 30 Hz, but the **tactile stream updates more slowly** — see
> [Tactile sampling rate](#tactile-sampling-rate-read-this-before-training-on-touch).
## Format — LeRobot-style video release
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.8 GB without depth vs ~1 TB raw), random-access decodable, training-ready.
```
data/<task>/
├── calibration/ # OptiTrack→camera extrinsics for this task
│ ├── T_mocap_to_cam_{left,middle,right}.json
│ ├── T_gel_to_rigid_{left,right}.json
│ └── calibration.json # epoch, applies-to dates, RMSE, chain
├── videos/<date>/episode_NNN/
│ ├── view_left.mp4 view_middle.mp4 view_right.mp4 # 640×480 RGB
│ └── tactile_left.mp4 tactile_right.mp4 # 640×480 GelSight
├── meta/<date>/episode_NNN.parquet # one row per frame (see below)
├── episodes.jsonl # one row per episode
├── segments.json # clean-segment index (no bad frames)
├── bad_frames.json # quality intervals per episode
└── previews/<date>/episode_NNN.mp4 # 1280×480 viewer-layout preview
```
### parquet columns (per frame, aligned to video frame `i`)
| Column | Type | Meaning |
|---|---|---|
| `frame_idx` / `frame_index` | int | 0…T-1, matches MP4 frame index |
| `episode` / `episode_index` | str / int | source episode key and its 0-based index within the task |
| `task` / `task_index` | str / int | task name and index (0=motherboard, 1=pushT) |
| `timestamp` | float64 | camera clock (s) |
| `sensor_left_pose`, `sensor_right_pose` | list[7] | OptiTrack world pose of each GelSight (xyz + quat wxyz) |
| `object_pose` | list[7] | OptiTrack world pose of the manipulated object (NaN where the object body was not tracked — e.g. all pushT) |
| `tactile_{L,R}_{intensity,area,mixed}` | float32 | contact metrics (computed at full 640×480) |
| `tactile_{left,right}_is_new` | bool | **True when that row is a fresh tactile reading** (not a repeat of the previous row) |
| `source_h5_frame` | int | index into the original recording |
**Decoded frames are RGB** (standard decoder convention) for all five RGB streams.
### estimated contact force (`motherboard` + `pushT`, 36 episodes)
There is **no force/torque sensor on this rig** — the demonstrator's hand holds
the sensor, so demonstrated pose equals achieved pose and the usual
"position error × stiffness" force channel does not exist. These columns are
**estimated from the GelSight images alone** by photometric reconstruction
(difference image → per-sensor RGB lookup table → Poisson integration → depth),
then mapped to newtons by a calibration fitted on sphere presses of known load.
| Column | Type | Meaning |
|---|---|---|
| `force_{left,right}_normal_n` | float32 | estimated normal force [N], ≥ 0, exactly `0.0` on no-contact rows |
| `force_{left,right}_penetration_mm` | float32 | `F / k` — how far a stiffness-`k` environment would be pushed in |
| `force_{left,right}_target_pose` | list[7] | that sensor's pose displaced `F/k` along the contact normal (quaternion carried through unchanged) |
```python
import numpy as np, pyarrow.parquet as pq
t = pq.read_table("data/motherboard/meta/2026-05-10/episode_000.parquet")
f = t["force_left_normal_n"].to_numpy() # (T,) newtons
obs = np.array(t["sensor_left_pose"].to_pylist()) # (T, 7) xyz + quat
tgt = np.array(t["force_left_target_pose"].to_pylist()) # (T, 7) the action
```
#### What "force-informed action" means, and how to train on it
A policy trained to output `sensor_*_pose` learns **where to go**. It cannot
learn **how hard to press**, because in this data the two are the same signal:
a human hand reached a pose, and whatever force resulted was never recorded as
a separate command. Regressing that pose and replaying it on a compliant robot
reproduces the trajectory and not the interaction — the same motion against a
stiffer or differently-placed object produces a different force, and nothing
in the demonstration says which force was intended.
`force_*_target_pose` is that missing command, written in the units a robot
already accepts:
```
target = observed + (F / k) · n̂ n̂ = press direction of that sensor,
R(q_row) @ gel_axis_in_rigid
```
It is the pose a **stiffness-`k` impedance controller** would have to be
commanded in order to generate the estimated force `F` against a surface at the
observed pose. Train the policy to output `target_pose`, deploy it as the
setpoint of an impedance/admittance controller with the same `k`, and the
controller produces both the reach and the press. This is the standard trick
behind position-based force control; the only new part is that `F` came from
the tactile images rather than from a load cell.
```python
action = tgt # what the policy predicts
observation = obs # where the sensor actually was
# free space: byte-identical, so this is a strict addition to the old target
assert np.array_equal(action[f == 0], observation[f == 0])
```
That identity is not a claim — it is checked element-wise over all **301,727**
free-space rows of the release, maximum deviation `0.0`, quaternions included.
Nothing changes where nothing is touched, so a model trained on `target_pose`
degenerates to the pose-only model in free space and differs only in contact.
#### Choosing `k` — it is your controller's number, not ours
`k = 1.0 N/mm` is a **declared assumption**, recorded in the parquet field
metadata (`twm.stiffness_n_per_mm`) and in each `<episode>.force.json`, so a
target pose is never uninterpretable. It is deliberately soft, and at that
value the implied penetrations are larger than the gel is thick:
| | penetration at `k = 1` | inside the 4.25 mm gel? |
|---|---|---|
| p95 over all rows | 5.78 mm | no |
| p95 over **contact** rows | 6.86 mm | no |
| maximum | 7.285 N → 7.285 mm | no |
**8.84%** of all rows exceed the gel thickness at `k = 1`. To keep penetration
physically plausible you need a stiffer environment model:
* `k ≥ 1.37 N/mm` — p95 over all rows inside the gel. *This is the weakest of
the three and the least useful:* 62.8% of rows are free space, so a
percentile over all rows is mostly a percentile of zeros.
* `k ≥ 1.62 N/mm` — p95 over **contact** rows inside the gel. Use this one.
* `k ≥ 1.72 N/mm` — even the hardest press inside the gel.
Recompute rather than rescale the shipped column, since the direction matters:
```python
K = 1.62 # your controller's stiffness
n_hat = (tgt[:, :3] - obs[:, :3]) # F/k · n̂ at the shipped k=1
n_hat /= np.linalg.norm(n_hat, axis=1, keepdims=True) + 1e-12
my_target = obs.copy()
my_target[:, :3] = obs[:, :3] + (f / K)[:, None] * n_hat
```
#### Read this before using the numbers
- **Accuracy is rank-order within a group, not a certified absolute scale.**
Held out by press position the estimator scores ρ = 0.739 / MAE 1.23 N on its
own calibration objects. On five public force-labelled datasets the same
pipeline reaches ρ 0.775–0.986. It is reliable for *how hard, relative to
other frames*; it is not a load cell. Do not report absolute newtons from
this dataset as ground truth.
- **Forces saturate at 7.285 N.** The calibration's isotonic stage clips at the
hardest press it was fitted on, so 0.90% of samples sit exactly at that value.
Treat the maximum as a floor, not a measurement, and consider masking rows at
the ceiling out of a regression loss.
- **Duplicate tactile rows repeat the previous estimate.** The GelSight stream
is slower than 30 Hz; rows with `tactile_{side}_is_new == False` carry the
previous frame's force unchanged (forward fill, asserted exact). Filter on
`is_new` if you need independent samples — and note that a force *derivative*
computed without that filter is zero on ~72% of rows by construction.
- **Row alignment is verified, not assumed.** Every one of the **72/72**
sensor-sides was checked row-for-row against the release parquet it was
exported from.
- **The direction `n̂` comes from calibration, not from the image.** It is the
sensor's gel axis rotated by the row's own quaternion. Two sensor-sides of 72
lack a usable gel-to-rigid transform and carry force with no displacement;
they are identified in `data/force_export_manifest.json`.
### depth (optional, `data/<task>/depth/`)
Per-camera depth is shipped as **lossless FFV1 16-bit video** (`gray16le`):
```
data/<task>/depth/<date>/episode_NNN/depth_{left,middle,right}.mkv
```
- uint16, **millimeters**; `0` = no return / invalid.
- Frame `i` aligns to the RGB video frame `i` and parquet row `i`.
- Decode with PyAV (`frame.to_ndarray()``(480, 640)` uint16). cv2 cannot read 16-bit video.
- Load via `ReactVideoDataset(..., load_depth=True)`.
## Tasks
| Task | Episodes | Dates | Duration | Clean segments | Calibration |
|---|---|---|---|---|---|
| **motherboard** | 32 | 2026-05-10/11/19 | 108 min | 76 (107 min) | **May-12** (RMSE ~5 mm) |
| **pushT** | 4 | 2026-06-18 | 25 min | 17 (25 min) | **June-26** (RMSE ~0.6 px) |
See [`tasks.json`](tasks.json) for the machine-readable registry (per-task dates, sensors, calibration epoch, world-frame offsets).
### Calibration epochs
Cameras were **recalibrated between tasks**. Each task points to the calibration valid for its recordings:
- `motherboard`**May-12** extrinsics (`data/motherboard/calibration/`)
- `pushT`**June-26** extrinsics (`data/pushT/calibration/`)
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`).
## Downloading — depth is optional
The dataset splits into a **lightweight core** (RGB + tactile + poses, ~4.8 GB) and an **optional depth tree** (`data/<task>/depth/`, ~33 GB lossless). Depth lives in its own subtree so you can skip it entirely.
```python
from huggingface_hub import snapshot_download
# Core only — RGB + tactile + parquet, NO depth (~4.8 GB)
snapshot_download("yxma/React", repo_type="dataset",
ignore_patterns=["*/depth/*"])
# Everything including depth (~39 GB)
snapshot_download("yxma/React", repo_type="dataset")
# One task only
snapshot_download("yxma/React", repo_type="dataset",
allow_patterns=["data/motherboard/*"], ignore_patterns=["*/depth/*"])
```
Or use the helper: `python examples/download.py --no-depth` (see [`examples/download.py`](examples/download.py)).
The `ReactVideoDataset` loader **never touches depth unless you pass `load_depth=True`**, so depth-free training requires no depth download.
## Loading
```python
from examples.react_video_dataset import ReactVideoDataset
ds = ReactVideoDataset("data/motherboard", window_length=16, mode="segment")
sample = ds[0]
# sample["view_middle"]: (16, 480, 640, 3) uint8 RGB
# sample["tactile_left"]: (16, 480, 640, 3) uint8 RGB
# sample["sensor_left_pose"]: (16, 7) float32
```
`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).
## ✅ Tactile latency corrected (was ~15 frames)
Recordings **up to and including 2026-06-18** HAD a GelSight-vs-camera capture
lag of **≈15 frames (~0.5 s)**: the tactile stream at index `i` was physically
captured ~15 frames *before* the camera/pose at the same index. Cause: a
recording-side `cv2.VideoCapture` V4L2 buffer that was never flushed
(throttled reads + no `BUFFERSIZE=1` + default pixel format). Fixed in the rig
on 2026-06-27; **future recordings will not have this lag**.
The streams are stored frame-aligned by tick index, so this lag is baked in but
**now corrected in the published data** (tactile shifted +15f, rebuilt from raw H5). No loader flag needed. The loader still accepts `tactile_latency=` for raw data:
```python
ds = ReactVideoDataset("data/motherboard", tactile_latency=15) # pairs view[i] with tactile[i+15]
```
`tactile_latency` shifts both the tactile videos and the tactile contact-scalar
columns; poses/views/depth are unchanged. Set `tactile_latency=0` for the raw
(uncompensated) data. The exact per-session value should be re-measured with
`camera_stream/measure_gelsight_latency.py`.
## Tactile sampling rate (read this before training on touch)
Parquet rows and all five videos are written at 30 Hz, but the GelSight stream
does **not** carry 30 Hz of information. Measured across the whole release:
| | value |
|---|---|
| tactile rows | 480 080 (2 sensors × 240 k frames) |
| genuinely distinct tactile frames | **135 297** |
| duplicated rows | **71.8 %** |
| effective tactile rate | **~8.5 fps** |
| longest frozen stretch | 30 frames (1.0 s) |
Two causes, one fixed:
1. **Sensor ceiling** — the GelSight Mini streams 3280×2464 MJPG at 18.75 fps.
Some duplication against a 30 Hz row clock is unavoidable (~40 %).
2. **Recording-side decode backlog** *(all currently published data)* — the rig
decoded each full 8 MP frame on the capture thread (~71 ms), so tactile
effectively ran at ~8 fps and every frame was reused ~3.6×. Fixed on the rig
on 2026-06-27 (reduced-scale decode + per-sensor capture timestamps);
recordings from that date on reach the 18.75 fps ceiling.
**Use the flags.** Every row carries `tactile_left_is_new` /
`tactile_right_is_new`:
```python
df = pq.read_table("episode_000.parquet").to_pandas()
fresh = df[df.tactile_left_is_new] # 8.5 fps of real readings
```
Training tactile dynamics on all rows teaches the model that touch mostly does
not change; it does, we just sampled it slowly. Visual and pose streams are
unaffected — those are genuinely 30 Hz.
The flags were recovered from the shipped contact metrics (a repeated frame
gives a bit-identical metric triple) and checked frame-by-frame against the
source recordings: **0 mismatches over 899 frames on each of 7 audited
episodes**, spanning both tasks. The same check independently recovers the
+15-frame latency correction baked into the release.
## How to use this dataset
Three recipes, in the order most people need them. Every one is executed
against the published files by `scripts/test_readme_recipes.py`, so the code
below is code that runs, not code that reads well.
### 1. Sample training clips — start from `segments.json`, not from episodes
An episode is a raw recording and contains flagged frames. A **segment** is a
contiguous span that is already clean. Sampling clips from episodes means
re-deriving the quality filter yourself and getting it slightly different.
```python
import json, numpy as np, pyarrow.parquet as pq
segs = json.load(open("data/pushT/segments.json"))["segments"]
s = segs[0] # {'source_episode', 'frame_range', ...}
date, ep = s["source_episode"].split("/")
a, b = s["frame_range"] # inclusive, in VIDEO frame coords
t = pq.read_table(f"data/pushT/meta/{date}/{ep}.parquet").slice(a, b - a + 1)
```
`frame_range` indexes the published MP4s and the parquet with the same origin,
so frame `i` of `view_middle.mp4` is row `i` of the parquet. No offset, no
lookup table.
### 2. Train on touch — respect the tactile rate
Rows are written at 30 Hz; the GelSight stream is slower. A row with
`tactile_{side}_is_new == False` repeats the previous tactile frame, its
contact scalars, and its force estimate, unchanged.
```python
new = t["tactile_left_is_new"].to_numpy()
# independent tactile samples only
idx = np.flatnonzero(new)
# a finite difference over ALL rows is 0 wherever is_new is False, by construction
```
Roughly 72% of rows are repeats. Ignoring this does not corrupt a model that
consumes frames independently, but it silently zeroes any temporal derivative
of a tactile channel and inflates any "how often does touch change" statistic.
### 3. Train an action that includes *how hard*
This is the part that distinguishes React from a pose-only demonstration set,
so it gets its own section: **[estimated contact
force](#estimated-contact-force-motherboard--pusht-36-episodes)**. In short:
```python
observation = np.array(t["sensor_left_pose"].to_pylist()) # where it was
action = np.array(t["force_left_target_pose"].to_pylist()) # where to push to
```
`action` equals `observation` exactly in free space and leads it by `F/k` along
the press direction during contact. Train on `action`, deploy through an
impedance controller of stiffness `k`, and the policy commands both the reach
and the press. Read that section before choosing `k` — the shipped `k = 1 N/mm`
is a declared assumption and a soft one.
### What this dataset is not
- **No robot.** A human hand holds each sensor. There are no joint angles, no
gripper state, and no action in the robot-command sense other than the
force-informed target pose described above.
- **No force sensor.** Every newton in these files is estimated from tactile
images. It is calibrated and validated, and it is still an estimate — see the
limits in the force section before reporting absolute values.
- **Not a benchmark.** There is no train/val/test split and no success label.
It is interaction data for dynamics and representation learning.
## Data quality
Per-task `bad_frames.json` marks intervals that should not be trained on, and
`segments.json` is their complement — contiguous clean spans, already excluding
every flag below. **Use `segments.json` and you never have to think about
this table.**
| flag | motherboard | pushT |
|---|---|---|
| `cam_corruption` | 0 | 0 |
| `intensity_spikes` | 56 | 10 |
| `ot_loss_L` | 1,443 | 106 |
| `ot_loss_R` | 236 | 191 |
| `pose_teleports_L` | 24 | 0 |
| `pose_teleports_R` | 16 | 0 |
| `tactile_corruption` | 102 | 10 |
| **flagged (union)** | **1,797 / 194,445 (0.92%)** | **307 / 45,595 (0.67%)** |
| **clean segments** | 81 spans, 192,626 frames (107.0 min) | 17 spans, 45,288 frames (25.2 min) |
| **dropped, clean but < 16 frames** | 22 | 0 |
The three rows above reconcile exactly: flagged + clean + dropped = total, for
both tasks. Per-flag counts do **not** sum to the flagged total, because one
frame can trip two detectors; the union is what `summary` reports and what the
segments complement.
`ot_loss_*` is OptiTrack track loss (a run of bit-identical poses, i.e. frozen
action), `pose_teleports_*` an implausible jump in translation *and* rotation
in one frame, `intensity_spikes` a GelSight reading above anything contact
produces. `tactile_corruption` and `cam_corruption` are **video** defects —
torn frames the sidecar scalars cannot see. They are found by looking for
off-illumination magenta laid out in scanlines: a GelSight is lit by three
coloured LEDs, magenta is outside that gamut, and a corrupt row is written
edge to edge while an object pressed into the gel is not. Every flagged
interval in this release was also inspected by eye.
**Runt episodes.** Two motherboard recordings are far too short to be complete
demonstrations and are best filtered out: `2026-05-19/episode_003` (4.0 s) and
`2026-05-19/episode_004` (7.0 s). Median episode length is 213 s; these two are
together 0.8 % of the release. They are shipped rather than deleted so episode
numbering stays stable.
**A missing pushT episode.** `pushT/2026-06-18/episode_004` was recorded but is
not published. Its recorder died without closing the file, which loses HDF5's
metadata cache: 79 GB of intact pixels behind a root object header that was
never written. All eight image streams were recovered (15,447 frames,
byte-verified), but only 2 of 16 timestamp chunks survived and no usable
OptiTrack poses. Without timestamps there is no cross-modal alignment, and
reconstructing them by interpolation misplaces frames by 15–1431 — so it is
video, not an episode, and is deliberately absent rather than published
half-aligned. Episode numbering is unaffected: pushT publishes 000–003.
## Notes
- **Depth is published**, under `data/<task>/depth/<date>/<episode>/depth_*.mkv`
(16-bit millimetres, FFV1-in-Matroska, lossless). It is 34.3 GB
of the 39.0 GB repo, so the download recipes above let you skip
it — everything else is 4.8 GB.
- The previous single-task `.pt` release (`episodes/`, `segments/`) is
superseded by this video format.
- Preview clips under `data/<task>/previews/` are 30 s renders at 2x with the
three camera views, the OptiTrack skeleton, both GelSight streams and the
projected sensor position. They are for looking, not for training, and frames
excluded by `bad_frames.json` are outlined and named in red.
## License
[CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/).