React / docs /quality.md
yxma's picture
Trim OT-uninitialized prefixes from 3 .pt files (ep_005/012/017 — see `_contact_meta.trim_offset`); recompute bad_frames + data_quality_breakdown in trimmed coords; ot_loss frame count now reflects real mid-episode mocap dropout only. Recorder-side OT watchdog added to data_collection.py (in twm repo) so future episodes won't repeat the bug.
53f7fe6 verified
|
raw
history blame
4.96 kB
# Data quality
A small fraction of frames contain known sensor artifacts. The repo ships a [`../bad_frames.json`](../bad_frames.json) index so downstream code can avoid sampling on top of these intervals — useful since this dataset is intended for **short-window dynamics / world-model learning**, where a glitch landing inside a training window can dominate the loss for that step.
## Headline numbers
| | |
|---|---:|
| Total synchronized frames | 190,231 (105.7 min @ 30 Hz, post-trim) |
| Recording files | 27 |
| Frames flagged in `bad_frames.json` | **1,768 (0.929 %)** |
| Recording files with ≥1 flagged frame | 11 |
## Failure modes — quantitative breakdown
| # | Mode | Frames | % of dataset | Files | Symptom | Example |
|---|---|---:|---:|---:|---|---|
| 1 | **GelSight LED flicker** | 66 | **0.030 %** | 5 / 27 | 1–2 frames of uniform pink/magenta wash across the gel surface; adjacent frames normal. 2026-05-11 / {003, 007, 008, 011, 017}. | [`intensity_spike_overview.png`](../figures/dataset_figures/intensity_spike_samples/intensity_spike_overview.png) |
| 2 | **OptiTrack pose teleport (>5 m/s)** | 64 | **0.029 %** | 3 / 27 | Position jumps by >5 cm in 33 ms — mocap lost lock and reacquired. 2026-05-10/{001, 002}, 2026-05-11/015. | [`pose_teleport_samples/`](../figures/dataset_figures/pose_teleport_samples/) |
| 3 | **OptiTrack track loss** | 33,056 | **14.92 %** | 8 / 27 | OptiTrack lost the rigid body — the recorder kept emitting the held pose. Boundary glitches (ang vel up to 51 k rad/s) appear on re-acquire. Worst single outage: 10.7 min (ep_017). Cause: marker near mocap-volume / camera-FOV boundary. GelSight + RealSense streams are *not* affected. | [`freeze_diagnose/`](../figures/dataset_figures/freeze_diagnose/) |
**Modes 1+2+3 together: 33,144 / 221,621 = 14.96% of frames flagged.** Earlier note: 122 / 221621 = 0.055 % of frames are corrupted in any modality.** Mode 3 is tracked separately because it is healthy data, just non-informative for dynamics. `bad_frames.json` covers modes 1 and 2 only; if you also want to skip rest periods, intersect with the velocity track from `sensor_*_pose`.
## Inspection figures
**Mode 1 — GelSight LED flicker** (overview across all 5 affected files):
![Intensity spike overview](../figures/dataset_figures/intensity_spike_samples/intensity_spike_overview.png)
Per-file close-ups (reference frame, ±1 s neighbors, peak frame): [`figures/dataset_figures/intensity_spike_samples/`](../figures/dataset_figures/intensity_spike_samples/).
**Mode 2 — OptiTrack pose teleport.** GIFs (10 s playback at 2× speed) for all 3 affected files: [`pose_teleport_samples/`](../figures/dataset_figures/pose_teleport_samples/).
**Modes 1+2+3 — top-6 worst-offenders chart** (tactile intensity + sensor velocity time-series):
![Data quality report](../figures/dataset_figures/data_quality_report.png)
## `bad_frames.json` schema
Frame indices are inclusive on both ends and pre-padded by `buffer_frames` (3) on each side so context windows don't bleed into the glitch:
```json
{
"tau_intensity": 30.0,
"tau_velocity_mps": 5.0,
"buffer_frames": 3,
"summary": {
"n_episodes": 27,
"total_frames": 221621,
"total_bad_frames": 122,
"bad_fraction_overall": 0.00055,
"n_episodes_with_bad_frames": 8
},
"episodes": {
"2026-05-11/episode_003": {
"n_frames": 10032,
"duration_s": 338.2,
"intensity_spikes": [[260, 268], "..."],
"pose_teleports_L": [],
"pose_teleports_R": [],
"total_bad_frames": 19,
"bad_fraction": 0.0019
}
}
}
```
A per-mode aggregate is also available: [`figures/dataset_figures/data_quality_breakdown.json`](../figures/dataset_figures/data_quality_breakdown.json).
## Use in a dataloader
```python
import json
from pathlib import Path
with open("bad_frames.json") as f:
bad = json.load(f)["episodes"]
with open("tasks.json") as f:
sessions = json.load(f)["tasks"]["motherboard"]["per_date_notes"]
def is_clean_window(ep_name, t_start, t_end):
"""Return True if [t_start, t_end] does not overlap any flagged interval."""
intervals = (bad[ep_name]["intensity_spikes"]
+ bad[ep_name]["pose_teleports_L"]
+ bad[ep_name]["pose_teleports_R"])
for s, e in intervals:
if s <= t_end and e >= t_start:
return False
return True
def active_sensors(ep_name):
"""Returns e.g. ['right'] or ['left', 'right']."""
date = ep_name.split("/")[0]
return sessions[date]["active_sensors"]
# In your sampler:
# if not is_clean_window(...): resample
# sides = active_sensors(...) # mask out inactive tactile + pose modalities
```
## Full report (per-file CSV)
Every file's individual stats (frames, duration, contact %, max intensity left/right, drift, max pose velocity, etc.) are in [`figures/dataset_figures/data_quality_report.csv`](../figures/dataset_figures/data_quality_report.csv).