|
Download toolbox/quickstart.md from yxma/React: direct link, hf CLI and curl.
- Browser
- Download file 5.07 kB
-
https://huggingface.co/datasets/yxma/React/resolve/fd3fe6bfe5e7783d1685886905ef0f63d74e43c4/toolbox/quickstart.md
- Command line
-
hf download hf://datasets/yxma/React@fd3fe6bfe5e7783d1685886905ef0f63d74e43c4/toolbox/quickstart.md
-
curl -L -o quickstart.md https://huggingface.co/datasets/yxma/React/resolve/fd3fe6bfe5e7783d1685886905ef0f63d74e43c4/toolbox/quickstart.md
5.07 kB
React Tactile Toolbox — Quickstart
Zero-install utilities for the React dataset (GelSight Mini, markerless, 640×480). MIT licensed.
# get the toolbox (it lives in the dataset repo)
huggingface-cli download yxma/React toolbox/ --repo-type dataset --local-dir react
cd react
pip install numpy pyarrow av opencv-python # core
pip install torch scipy # optional: depth
import react_toolbox as T
from huggingface_hub import hf_hub_download
# load tactile frames + per-frame metadata
vid = hf_hub_download("yxma/React", "data/motherboard/videos/2026-05-10/episode_000/tactile_left.mp4", repo_type="dataset")
meta = T.load_meta(hf_hub_download("yxma/React", "data/motherboard/meta/2026-05-10/episode_000.parquet", repo_type="dataset"))
frames = T.load_video(vid, range(200)) # (200, 480, 640, 3) RGB
# 1) reference (no-contact) frame + difference image
ref = T.get_reference(frames, mode="p01", intensity=meta["tactile_left_intensity"][:200])
diff = T.difference(frames[100], ref) # Sparsh-style signed diff
# 2) contact detection (calibration-free)
mask = T.contact_mask(frames[100], ref) # (480,640) bool
metrics = T.contact_metrics(frames[100], ref) # {intensity, area, mixed} == dataset scalars
# 3) approximate depth / height map (pretrained nnmini, no calibration)
from react_toolbox import depth
h = depth.height_map(frames[100], ref) # (480,640) relative height
# 4) visualization (all return RGB uint8)
hm = T.diff_heatmap(frames[100], ref)
ov = T.contact_overlay(frames[100], ref)
# 5) camera projection (per-task extrinsics)
cal = T.load_calibration("data/motherboard") # after snapshot_download of calibration/
uv = T.project_gel_to_pixel(meta["sensor_left_pose"][100], cal["gel_left"], cal["cams"]["middle"])
# 5b) SEE it land — a coordinate cannot tell you whether it is on the sensor,
# and every projection defect this dataset has shipped was obvious in a
# picture and invisible in a number (21-36 px, 35-73 px, 155-223 px, all
# of them shaped like a slightly miscalibrated rig).
img = T.draw_projection(cam_frame, meta["sensor_left_pose"][100],
cal["gel_left"], cal["cams"]["middle"],
force_n=meta["force_left_normal_n"][100],
target_pose7=meta["force_left_target_pose"][100])
# 5c) or check it without looking: every episode's parquet declares the world
# frame its poses are in, and carries a projection fingerprint you can
# recompute. A pose array in the wrong frame misses it by 150+ px.
dec = T.read_world_frame(episode_parquet) # {"world_frame", "raw_h5_offset_m", "fingerprint"}
err = T.verify_world_frame(meta["sensor_left_pose"], "left", "motherboard", dec)
assert err < 6.0, f"poses are not in the declared frame: {err:.1f} px off"
# 6) derive actions from handheld poses
act = T.next_state_action(meta["sensor_left_pose"]) # next-frame absolute state
delta = T.delta_pose_action(meta["sensor_left_pose"]) # frame-to-frame delta
Run the full demo (saves a montage):
python -m react_toolbox.demo --with_depth
Functions
| Module | Function | Notes |
|---|---|---|
io |
load_video, load_meta, episode_paths |
PyAV / OpenCV decode → RGB |
reference |
get_reference, difference, l2_diff |
p01 / first / running-avg reference; Sparsh signed diff |
contact |
contact_mask, contact_metrics, contact_centroid |
diff→threshold→largest component; reproduces dataset scalars |
depth |
height_map, normals, poisson_integrate |
approximate, uncalibrated — pretrained markerless-Mini net (nnmini.pt, fetched on demand) + DCT Poisson |
viz |
diff_heatmap, contact_overlay, reference_compare, depth_view, height_to_pointcloud |
all RGB uint8; depth_view is grayscale by default (standard GelSight height map), pass cmap= for a colormap |
calibration |
load_calibration, project_gel_to_pixel |
per-task extrinsics (motherboard=May-12, pushT=June-26) |
actions |
next_state_action, delta_pose_action, integrate_delta |
handheld pose → IL/world-model targets |
Notes & limits
- No markers on this sensor → no marker-flow / shear-field utilities (would need a markered gel).
- Depth is approximate / relative, not metric: it uses a network pretrained on a reference GelSight Mini (no per-unit calibration). Verified to track contact deformation locally (height elevation under contact correlates 0.74 with contact intensity), but the global height includes the gel's baseline curvature. For metric depth, collect a ball-indenter calibration.
nnmini.ptweights are © GelSight Inc (GPL-3.0); only the weight file is fetched on demand — no GPL code is bundled. The toolbox code itself is MIT.- All decoded frames are RGB. Contact scalars use L2 threshold
tau=8.0(dataset default).