React / docs /schema.md
yxma's picture
Wave 2: multi-cam migration complete for 2026-05-10 + 2026-05-11. All 32 episodes now ship under episodes/ and segments/ with view_left / view_middle / view_right + tactile_{left,right}. Legacy processed/mode1_v1/ and processed/mode2_v1/ removed.
159ceda verified

Schema

Layout of each per-episode .pt file in the published episodes/ slice (and analogously each per-segment .pt in segments/). Hardware/recording details are in recording.md.

.pt fields

Each episode_*.pt is a Python dict loadable with torch.load(..., weights_only=False).

Key Shape dtype Description
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.

Multi-cam fields (all sessions)

Newer sessions ship all three RealSense views per episode/segment in BGR channel order (matching what cv2.imshow expects). Each is built from the raw 480×640 H5 stream by center-cropping columns to 480×480 and cv2.resize-ing to 128×128 with INTER_AREA — verified bit-for-bit against the legacy single-cam view recipe.

Key Shape dtype Source H5 dataset Physical camera
view_left (T, 3, 128, 128) uint8 (BGR) realsense/cam1/color Left RealSense (serial 104122062574)
view_middle (T, 3, 128, 128) uint8 (BGR) realsense/cam2/color Middle RealSense (serial 217222066989)
view_right (T, 3, 128, 128) uint8 (BGR) realsense/cam0/color Right RealSense (serial 143322063538) — historical view

The legacy single-cam view field is equivalent to view_right. All published sessions ship this multi-cam layout.