# Trajectory deduplication (`dedup/`) Near-duplicate removal over the 94,030-episode DROID LeRobot export (94,006 episodes with valid kinematic signals were assessed; 24 episodes with degenerate signals are kept by default). A duplicate is a **near-identical re-recording of the same task**; different tasks — including paraphrases resolved to different tasks, object swaps, or the same task done in a different place — are treated as diversity and never merged. ## Method 1. **Merge task phrasings** — instructions are canonicalised (synonym folding for verbs/objects, prepositions to `
`, articles dropped, order and attributes preserved): 31,304 distinct instruction strings → 28,458 task families. Episodes without an instruction (task_index 31051, 43,133 episodes) are grouped by their labeled verb+object chain instead. 2. **Trajectory signature** — keyframes = gripper open/close events + end-effector deceleration points; the keyframe EE positions are start-centred and arc-length-resampled to K=8 points → a 24-number signature per episode (see `descriptors.npz`). 3. **Duplicate rule** — same family AND mean per-point Euclidean distance < **3 cm** AND identical gripper open/close pattern. Leader clustering: every member is within 3 cm of its cluster leader, so transitive chains cannot glue far-apart trajectories together. 4. **Keep TWO per cluster** (`DEDUP_KEEP=2`) — the cluster **medoid** plus the member **farthest from the medoid** (greedy max-min), retaining the cluster's residual spread. Clusters of size 2 are kept whole. ## Results (eps = 3 cm, keep = 2) | metric | value | |---|---| | episodes assessed | 94,006 | | episodes in multi-episode clusters | 8,656 (9.21%) | | multi-episode clusters | 2,260 (largest: 539 frozen no-instruction episodes) | | episodes kept (hard dedup) | **89,870** | | episodes removed | 4,136 (4.40%) | A stricter keep-one-per-cluster variant is archived as `report_keep1.json` / `keep_list_keep1.txt` (87,610 kept / 6,396 removed). ## Files - `episode_weights.jsonl` — one line per episode: `{episode_id, task_index, cluster_id, cluster_size, weight, representative}`. `representative: true` ⇔ kept by hard dedup (2 per multi-cluster). Soft weights: representatives 1.0, other members 1/cluster_size — use them to reweigh instead of dropping. - `seg_weights.jsonl` — `{seg_id, weight}` for all 588,151 annotated segments (weight inherited from the episode; joins `annotations/segments.jsonl`). - `keep_list.txt` — episode_id per line, the 89,870 kept episodes. - `report.json` — the stats table above. - `descriptors.npz` — `eids` (94,006), `tasks`, `descs` (94,006×8×3 float32, metres, start-relative), `grips` (gripper pattern strings): everything needed to re-run clustering at a different eps / keep policy. - `keep_list_keep1.txt`, `report_keep1.json` — archived keep-1 variant.