so101-sim-ego-v21 / README.md
angkul07's picture
Upload README.md with huggingface_hub
4dfc66e verified
|
Raw
History Blame Contribute Delete
13.5 kB
---
license: apache-2.0
task_categories:
- robotics
tags:
- LeRobot
- so101
- sim-to-real
- egocentric
- retargeting
size_categories:
- 10K<n<100K
---
# final_data — SO-101, two halves, one schema
A sim/real pair for SO-101 co-training. Both halves are **LeRobot v2.1**, 30 fps,
6-DOF, two cameras, and carry a byte-for-byte identical feature schema.
```
final_data/
sim_v21/ 50 eps 16,658 frames 1 task 9.3 min 132 MB
ego_v21/ 324 eps 36,442 frames 89 tasks 20.2 min 335 MB
README.md
```
| source | provenance |
|---|---|
| `sim_v21` | `makermods/maniskill_50ep_so101_blue_cube_orange_tray_20260812_131142`, LeRobot v3.0 → v2.1 |
| `ego_v21` | `angkul07/ego-data` (EgoDex), retargeted through DT-pipeline **stage 6 run F** (`--arm dominant`, `IK_FREE_ROLL`, approach-aware BPP) |
## Schema
| feature | dtype | shape | notes |
|---|---|---|---|
| `observation.state` | float32 | (6,) | `shoulder_pan, shoulder_lift, elbow_flex, wrist_flex, wrist_roll, gripper` — **degrees** |
| `action` | float32 | (6,) | same names, same units |
| `observation.images.front` | video | 480×640×3 | h264, yuv420p, 30 fps |
| `observation.images.wrist` | video | 480×640×3 | h264, yuv420p, 30 fps |
Plus the standard `timestamp`, `frame_index`, `episode_index`, `index`,
`task_index`.
---
# 1. Variant audit
Everything below is measured off the files — 748 video probes and every parquet
— not read from `info.json`.
| | sim (`sim_v21`) | ego (`ego_v21`) |
|---|---|---|
| **variants found** | **1** | **1** |
| episodes | **50** (100%) | **324** (100%) |
| hours | 0.154 (9.3 min) | 0.337 (20.2 min) |
| cameras | 2 — `front`, `wrist` | 2 — same keys |
| codec | h264 | h264 |
| resolution | 640×480 | 640×480 |
| camera fps | 30.0 | 30.0 |
| state Hz | 30.0 | 30.0 |
| action Hz | 30.0 (shared `timestamp` col) | 30.0 (shared `timestamp` col) |
| cam frames == state rows | **yes** (100/100) | **yes** (648/648) |
Timestamp jitter is 2.6e-07 s (sim) and 1.1e-07 s (ego) — both are exact 1/30
grids, not resampled approximations.
# 2. Dataset comparison
| Field | `sim_v21` (ManiSkill) | `ego_v21` (retargeted) |
|---|---|---|
| Format | LeRobot **v2.1** (converted from v3.0) | LeRobot **v2.1** ✓ |
| Robot | `maniskill_so101_follower` | `so101_follower` — same arm, different string |
| Rate | 30 Hz / 30 fps | 30 Hz / 30 fps ✓ |
| Episodes | 50 | **324** |
| Frames | 16,658 | **36,442** |
| Tasks | **1** | **89** |
| Duration | 9.3 min | 20.2 min |
| Episode length | 237–447 f (7.9–14.9 s), median 331 | 30–354 f (1.0–11.8 s), median 96 |
| Camera keys | `front` / `wrist` | `front` / `wrist` ✓ |
| Video shape/codec | 480×640×3, h264, yuv420p | same ✓ |
| **Image source** | **rendered sim cameras** (2 real viewpoints) | **synthesized** (2 crops from 1 ego cam) |
| state / action | `float32[6]` | `float32[6]` ✓ |
| State layout | `[pan, lift, elbow, wrist_flex, wrist_roll, gripper]`, **degrees** | same ✓ (remapped from the URDF's reversed order) |
| **Action convention** | PD **setpoint**, leads state by **5 frames** (argmin lag = 5 on all 50 eps) | absolute **next-frame target** — exact, max abs diff **0.0** on all 324 eps |
| Gripper encoding | joint angle deg, **larger = open** | **same polarity** ✓ |
| **Gripper occupancy** | rests **closed** (0.107), opens to 0.581, mean 0.221 | rests **mid** (0.227), spans 0.000–0.857, mean 0.281 |
| Handedness | single fixed arm | 261 R / 63 L, folded onto one arm |
| On disk | 132 MB | 335 MB |
Compatible on format, rate, schema, DOF, joint order, units and gripper
polarity. The real differences are image provenance, the action-horizon gap, and
gripper occupancy — §3 and §6.
# 3. The gripper
Normalized to the joint's **physical travel** (URDF −10°…100°), so the two rows
are directly comparable. `0` = jaws fully closed at the stop, `1` = fully open.
If you normalize from LeRobot dataset statistics instead, these numbers shift.
| | absolute | p1–p99 | p5–p95 | typical closed → open | rest (frame 0) |
|---|---|---|---|---|---|
| `sim_v21` | **[0.10, 0.58]** | [0.11, 0.45] | [0.11, 0.40] | 0.107 → 0.389 | 0.107 |
| `ego_v21` | **[0.00, 0.86]** | [0.05, 0.63] | [0.10, 0.54] | 0.154 → 0.447 | 0.227 |
Decile histograms (% of frames):
```
sim 0.0 41.3 28.6 25.3 4.3 0.5 0.0 0.0 0.0 0.0
ego 4.9 23.1 34.3 20.4 9.9 5.6 1.6 0.2 0.0 0.0
```
Same distribution *shape* — a single mode with an upward taper — offset to the
right in ego. Not two different regimes.
**Polarity was settled from the video, not assumed.** At each dataset's gripper
minimum the sim's black jaws are pinched shut and the ego hand is closed around
the object; at the maximum the jaws are wide and the hand is spread. Both
larger-is-open, so no sign flip is needed anywhere.
### Is the resting difference a training problem?
Mostly no — and the part that could bite is not the resting value.
**Why it's mostly fine.** The distributions overlap heavily rather than forming
two clusters: the band [0.15, 0.45] holds 61.5% of sim frames and 74.8% of ego
frames. More to the point the *signal* is consistent — the typical per-episode
close→open swing is 0.107→0.389 in sim and 0.154→0.447 in ego. Same direction,
nearly the same magnitude (≈0.29 of travel each). "Close to grasp, open to
release" is what the policy has to learn, and both halves teach it the same way.
**The one to watch is the closed end.** Ego's typical closed is **0.154** against
sim's **0.107**. The ego gripper comes from a human pinch aperture mapped onto
the jaw, so on a thick object it never fully commits. If a policy learns
"closed ≈ 0.154" and the object needs 0.107 to actually clamp, grasps slip. That
is a real failure mode; a 0.12 offset in idle pose is not.
**Two cheap fixes, either one removes it:**
- **Per-dataset normalization stats** rather than one mixture-wide mean/std. With
a single normalizer the frame-weighted mean lands at ≈0.26, between the two
halves, so neither one's "closed" maps to a value the policy can memorize.
- **Binarize the gripper** at the midpoint of each dataset's own closed→open
swing. Standard in most SO-101 recipes and it makes the offset structurally
impossible.
Ranked against the other two gaps in §6, this is the smallest of the three by a
good margin.
---
# 4. How `ego_v21` was built
One episode per retargeted clip, from stage-6 run F.
**Only the active arm is exported.** Stage 6 emits `(T, 12)` — both arms, with
the non-dominant one parked at a constant. `--arm dominant` picks the hand that
actually moves, so the active side is read per clip from the `active_arms`
attribute, never assumed to be right (261 R / 63 L).
**Two conversions, both silent corruption if skipped:**
- **Column order.** The SO-101 URDF is written distal-to-proximal, so stage 6
emits `[wrist_roll, wrist_flex, elbow_flex, shoulder_lift, shoulder_pan,
gripper]` — the sim's first five joints exactly reversed. The permutation is
built *by name* from each clip's own `joint_names` attribute, so a future URDF
reorder cannot quietly mis-map it.
- **Units.** Stage 6 works in radians, the gripper included (its range is the
URDF's −0.174533‥1.74533, not a normalized [0,1]). The sim is in **degrees**:
its `elbow_flex` tops out at 96.65 against a URDF limit of 1.69 rad = 96.83°,
which is what rules out the LeRobot normalized-[−100,100] reading — that would
have given exactly 100.
`action[t] = state[t+1]`, last frame repeated.
## The second camera is synthesized
EgoDex has one 1920×1080 egocentric camera. The sim has two.
| key | how it is made |
|---|---|
| `front` | full frame → 4:3 centre crop (1440×1080) → 640×480 |
| `wrist` | **native 640×480 window** tracking the active hand's grasp point — a 1:1 pixel crop, no resampling. Centre track gaussian-smoothed (σ = 2 frames) and clamped so the window is always fully in-frame. |
Grasp point = `0.5·thumbTip + 0.35·indexTip + 0.15·middleTip`, projected with
EgoDex's own intrinsics and per-frame camera pose:
```
Xc = inv(camera_pose) @ p_world
u = cx + fx · Xc[0] / Xc[2]
v = cy + fy · Xc[1] / Xc[2]
```
Grasp point in-frame: 98.3% mean, 52% on the worst clip.
**This is not the formula in `multiview.py`**, which used `z = -Xc[2]` and
`v = cy - fy·Y/z` — the ARKit convention. On this data `Xc[2]` is positive on
every frame of every clip and the camera's +Y axis points *down* in world, so
both signs are inverted here. Verified by rendering the full 28-point hand
skeleton over the source video; the ARKit form lands ~380 px low and mirrored.
Note that scoring candidate conventions by "does the projection hit skin pixels"
picks the *wrong* one — it is confounded by the other arm.
No barrel/tilt/colour "virtual lens" is applied. `multiview.py` used those to
make three crops of one video read as three different physical cameras; here the
two views are already a wide shot and a close-up, and inventing distortion would
put a lens in the data that no camera has.
# 5. How `sim_v21` was built
v3.0 concatenates every episode into one parquet and one mp4 per camera, with
per-episode boundaries in `meta/episodes/**.parquet`. v2.1 wants one file per
episode per camera, so the job is: read the boundary table, slice the parquet,
cut the videos. **No value in any column was changed.**
The video cut **re-encodes** (libx264, crf 20, g=2). It has to: keyframes in the
source land every 2 frames but episodes start on odd frames as often as even
ones, so `-c copy` would silently shift half the episodes by one frame against
their actions.
Two fixes were needed in `convert_v30_to_v21.py` before the output could be
trusted:
- **`info.json` claimed the wrong codec.** The features block is copied from the
v3.0 source, which says `av1` and carries SVT-AV1-only knobs (`video.preset`,
`video.fast_decode`) — but every file written is h264. Anything reading the
metadata to pick a decoder was being told a lie. Now retagged to what was
actually written.
- **The pixel-alignment check hardcoded 20 fps** in its source seek. On this
30 fps dataset it seeked 1.5× too far and compared each cut against an
unrelated frame, so it reported MISALIGNED for every episode except the one at
`skip=0`. The check was wrong, not the cut.
---
# 6. Before you train on both halves
**1. The action semantics differ.** The sim's `action` is a PD setpoint that
leads its own state by ~5 frames (argmin of `mean|a[t] − s[t+L]|` is L=5 on all
50 episodes). The ego half's `action` is the next retargeted joint position —
L=1 by construction, exact to `max|a[t] − s[t+1]| = 0.0`. A policy trained on the
mixture is being asked to predict two different horizons under one head.
**2. The visual domain gap is total.** The ego half shows *human hands*
manipulating real objects from a head-mounted camera. The sim half shows a
*robot arm* in a rendered scene. The `wrist` view in particular is a crop of a
human hand, not a view from a gripper-mounted camera. Matching the schema does
not make these the same distribution.
**3. The ego half is joint-saturated.** Stage 6 run F still FAILs QA saturation
on 203 of 324 clips, and it shows up directly in the exported values as frames
sitting on a URDF stop (within 0.5°):
| fraction of frames at a joint limit | pan | lift | elbow | wrist_flex | wrist_roll | gripper |
|---|---|---|---|---|---|---|
| `sim_v21` | 0.0% | 0.0% | 14.0% | 0.0% | 0.0% | 0.0% |
| `ego_v21` | **12.5%** | **33.4%** | **42.3%** | **38.8%** | **18.0%** | 0.0% |
The ego half spends between an eighth and two fifths of every joint's frames
pinned against a stop; `wrist_roll` is often flat at −157.2° for a whole episode.
Mean IK position error for this run is 12.39 cm. The sim's 14% on `elbow_flex` is
its own resting pose sitting near the stop, not a tracking failure.
**4. Five sim episodes have video longer than their data.** Episodes 39, 41, 44,
47, 49 have segments 49–213 frames longer than their parquet row count (731
frames total). The extra frames are real motion followed by a static hold —
almost certainly the post-demo reset. The conversion takes the first `length`
frames from `from_timestamp`, which is the only anchor the format gives.
Flagging it because it is a defect in the source metadata, not here.
---
# 7. Verify
```bash
python verify_final.py final_data/sim_v21 final_data/ego_v21
```
Per dataset: parquet rows == declared length == every camera's frame count;
video starts at pts 0 on a uniform 1/fps grid (a count check alone sails past a
uniform timestamp shift, and LeRobot indexes video *by timestamp*); `frame_index`
is 0..T−1; `index` is globally contiguous; `episodes_stats.jsonl` covers every
episode and feature; the declared codec matches the file. Then it diffs the two
schemas and prints per-joint ranges and limit-pinning.
Both datasets pass with zero failures, and the schema diff is empty.
## Scripts
| script | role |
|---|---|
| `convert_v30_to_v21.py` | sim v3.0 → v2.1 (provided; codec-retag + fps fixes applied) |
| `ego_to_v21.py` | retargeted clips → v2.1, both views, one pass per episode |
| `verify_final.py` | structural + cross-schema verification |
| `stats_final.py` | the measured numbers in §1–§2 |
`to_lerobot_v21.py`, `multiview.py` and `finalize_multiview.py` are the
originals this work started from; they target the YAM bimanual + abc-teleop
3-view schema and are left untouched.