React / docs /quality.md
yxma's picture
Drop 2026-03-23 right-only pilot (outdated); recompute totals across 27 bimanual recordings
53f3821 verified
|
raw
history blame
4.85 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 | 221,621 (126.0 min @ 30 Hz) |
| Recording files | 27 |
| Frames flagged in `bad_frames.json` | **122 (0.055 %)** |
| Recording files with ≥1 flagged frame | 8 |
## 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 pose freeze (≥ 5 s held) | 31,376 | **14.16 %** | 3 / 27 | Held-pose intervals on an active sensor — OptiTrack lost track and the recorder held the last sample. 2026-05-11/{017: 10.7 min, 012: 5.4 min, 005: 1.3 min}. **Not corruption**, but degenerate for dynamics; left-sensor only. | [`data_quality_report.png`](../figures/dataset_figures/data_quality_report.png) |
**Modes 1+2 together: 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).