React / docs /schema.md
yxma's picture
Split README into lean front page + docs/{recording,schema,quality,figures,caveats}.md
180c67c verified
|
raw
history blame
2.77 kB
# Schema
Layout of each per-episode `.pt` file in the published `processed/mode1_v1/` slice. Hardware/recording details are in [`recording.md`](recording.md).
## `.pt` fields
Each `episode_*.pt` is a Python dict loadable with `torch.load(..., weights_only=False)`.
| Key | Shape | dtype | Description |
|---|---|---|---|
| `view` | `(T, 3, 128, 128)` | uint8 | Overhead camera (`realsense/cam0/color`), center-cropped to square then bilinear-resized to 128×128 |
| `tactile_left` | `(T, 3, 128, 128)` | uint8 | Left GelSight, same crop/resize |
| `tactile_right` | `(T, 3, 128, 128)` | uint8 | Right GelSight, same crop/resize |
| `timestamps` | `(T,)` | float64 | Camera timestamps (seconds, monotonic clock) |
| `sensor_left_pose` | `(T, 7)` | float32 | Left GelSight rigid body OptiTrack pose, nearest-neighbor aligned to camera timestamps |
| `sensor_right_pose` | `(T, 7)` | float32 | Right GelSight rigid body OptiTrack pose, same alignment |
| `tactile_{left,right}_intensity` | `(T,)` | float32 | Per-frame mean per-pixel L2 distance from a contact-free reference frame |
| `tactile_{left,right}_area` | `(T,)` | float32 | Per-frame fraction of pixels with L2 diff > `tau` |
| `tactile_{left,right}_mixed` | `(T,)` | float32 | Mean of (diff × mask) — intensity restricted to contact pixels |
| `_contact_meta` | dict | — | Per-episode contact metadata: `tau`, drift, p01 reference indices, the chosen reference RGB frames |
Each `.contact.json` next to the `.pt` is a small summary of the metric distributions plus drift diagnostics — useful for filtering / sanity checking without loading the full tensors.
## Contact metric definition
For each tactile sensor independently:
1. Pick a **contact-free reference frame** — the ~0.1th-percentile-quietest frame by mean L2 distance to the temporal median (`reference_strategy = "p01"`).
2. For each frame `t`, compute the per-pixel `diff[t, x, y] = || frame[t, :, x, y] − ref[:, x, y] ||_2` (RGB L2 over channels).
3. Then:
- `intensity[t] = mean(diff[t])`
- `area[t] = mean(diff[t] > tau)` (default `tau = 8.0` on the uint8 scale)
- `mixed[t] = mean(diff[t] · (diff[t] > tau))`
`_contact_meta["drift_warning"]` is `True` when either sensor's drift (L2 distance between the first frame and the p01 reference) exceeds `2 · tau`; in this release no episode triggers it.
## Pose conventions
- Position is in **meters** in OptiTrack room coordinates.
- Quaternion follows `(qx, qy, qz, qw)` ordering (scalar last).
- To project sensor positions into a camera image, compose `sensor_pose → T_mocap_to_cam → camera intrinsics`. The recording-side calibration files (`T_mocap_to_cam_*.json` and `T_gel_to_rigid_*.json`) are referenced in [`recording.md`](recording.md).