syding9 commited on
Commit
c7a51ff
·
verified ·
1 Parent(s): d9d965a

Remove provenance directory

Browse files

Remove provenance files and stale README references. Videos, task indexes, annotations, and frozen data splits are unchanged.

README.md CHANGED
@@ -44,5 +44,4 @@ The test-tube task combines three valid batches (11 + 3 + 35 trajectories).
44
 
45
  All 558 videos are frame-exact H.264 stream-copy cuts. Full decoding confirmed frame counts,
46
  timestamps and equality of decoded YUV pixels to the original source cuts. Eight conversion
47
- tests passed. Source selection, mappings and validation records are under
48
- [`provenance/evomind-state-20261102/`](provenance/evomind-state-20261102/).
 
44
 
45
  All 558 videos are frame-exact H.264 stream-copy cuts. Full decoding confirmed frame counts,
46
  timestamps and equality of decoded YUV pixels to the original source cuts. Eight conversion
47
+ tests passed.
 
provenance/evomind-state-20261102/export_order.py DELETED
@@ -1,346 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Export explicitly selected LeRobot v3 recordings to ProPriMem, offline."""
3
-
4
- import argparse
5
- from fractions import Fraction
6
- import hashlib
7
- import json
8
- import math
9
- from pathlib import Path
10
- import re
11
- import statistics
12
- import subprocess
13
-
14
-
15
- CAMERAS = {
16
- "main_view": "observation.images.right_environment_1",
17
- "left_view": "observation.images.left_wrist",
18
- "right_view": "observation.images.right_wrist",
19
- }
20
-
21
-
22
- def sha256(path):
23
- h = hashlib.sha256()
24
- with Path(path).open("rb") as f:
25
- for block in iter(lambda: f.read(8 * 1024**2), b""):
26
- h.update(block)
27
- return h.hexdigest()
28
-
29
-
30
- def write_json(path, value):
31
- path.write_text(json.dumps(value, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
32
-
33
-
34
- def child(root, relative):
35
- path = (root / relative).resolve()
36
- if not path.is_relative_to(root.resolve()) or path == root.resolve():
37
- raise ValueError(f"Path outside source root: {relative}")
38
- return path
39
-
40
-
41
- def load_plan(manifest, source_root):
42
- import pyarrow.parquet as pq
43
-
44
- suite = manifest.get("suite", "Order")
45
- if suite not in {"Order", "State"}:
46
- raise ValueError("Expected Order or State suite")
47
- prefix = "O" if suite == "Order" else "S"
48
- plan, ids, sources_seen = [], set(), set()
49
- for task in manifest["tasks"]:
50
- if not re.fullmatch(prefix + r"\d{2,}", task["task_id"]) or not re.fullmatch(r"[a-z0-9_]+", task["task_slug"]):
51
- raise ValueError(f"Invalid {suite} task ID/slug")
52
- if task["task_id"] in ids:
53
- raise ValueError("Duplicate task ID")
54
- ids.add(task["task_id"])
55
- episodes, snapshots = [], {}
56
- for source in task["sources"]:
57
- name = source["dataset"]
58
- if name in sources_seen:
59
- raise ValueError(f"Duplicate source dataset: {name}")
60
- sources_seen.add(name)
61
- root = child(source_root, name)
62
- info_path = root / "meta/info.json"
63
- info = json.loads(info_path.read_text())
64
- if info["codebase_version"] != "v3.0" or info["total_episodes"] != source["episodes"]:
65
- raise ValueError(f"Source version/count changed: {name}")
66
- if info["total_episodes"] <= 0 or info["fps"] <= 0:
67
- raise ValueError(f"Empty/invalid source: {name}")
68
- if any(info["features"].get(camera, {}).get("dtype") != "video" for camera in CAMERAS.values()):
69
- raise ValueError(f"Missing configured three-view cameras: {name}")
70
- meta_files = [info_path] + sorted((root / "meta/episodes").rglob("*.parquet"))
71
- rows = [row for p in meta_files[1:] for row in pq.read_table(p).to_pylist()]
72
- rows.sort(key=lambda row: row["episode_index"])
73
- if [r["episode_index"] for r in rows] != list(range(source["episodes"])):
74
- raise ValueError(f"Noncontiguous or unfinished episode metadata: {name}")
75
- if sum(r["length"] for r in rows) != info["total_frames"]:
76
- raise ValueError(f"Source frame total mismatch: {name}")
77
- excluded = source.get("exclude_episodes", [])
78
- if len(set(excluded)) != len(excluded) or not set(excluded).issubset(range(source["episodes"])):
79
- raise ValueError(f"Invalid explicit episode exclusions: {name}")
80
- snapshots.update({str(p): sha256(p) for p in meta_files})
81
- for row in rows:
82
- if row["episode_index"] in excluded:
83
- continue
84
- instructions = row["tasks"]
85
- if len(instructions) != 1 or not instructions[0].strip() or row["length"] <= 0:
86
- raise ValueError(f"Expected one nonempty instruction per episode: {name}")
87
- views = {}
88
- for view, camera in CAMERAS.items():
89
- prefix = f"videos/{camera}"
90
- start = row[prefix + "/from_timestamp"] * info["fps"]
91
- end = row[prefix + "/to_timestamp"] * info["fps"]
92
- if abs(start - round(start)) > 0.01 or abs(end - start - row["length"]) > 0.01:
93
- raise ValueError(f"Non-frame-aligned range: {name}, {row['episode_index']}, {view}")
94
- relative = info["video_path"].format(
95
- video_key=camera, chunk_index=row[prefix + "/chunk_index"],
96
- file_index=row[prefix + "/file_index"])
97
- path = child(root, relative)
98
- if not path.is_file():
99
- raise ValueError(f"Missing video: {path}")
100
- views[view] = dict(path=path, source_path=f"{name}/{relative}", start=round(start))
101
- episodes.append(dict(source_dataset=name, source_episode=row["episode_index"],
102
- instruction=instructions[0], frames=row["length"],
103
- fps=info["fps"], views=views))
104
- median = statistics.median(e["frames"] / e["fps"] for e in episodes)
105
- warnings = [dict(dataset=e["source_dataset"], episode=e["source_episode"],
106
- duration_s=e["frames"] / e["fps"], reason="less than 60% of task median; review only")
107
- for e in episodes if e["frames"] / e["fps"] < median * 0.6]
108
- plan.append(dict(task=task, episodes=episodes, snapshots=snapshots, warnings=warnings))
109
- return plan
110
-
111
-
112
- def try_remux(source, target, start, count, fps):
113
- """Accept stream-copy cuts only after a complete frame/pixel comparison."""
114
- import av
115
-
116
- rate = Fraction(fps).limit_denominator()
117
- with av.open(str(source)) as inp:
118
- video = inp.streams.video[0]
119
- if video.codec_context.name != "h264" or video.average_rate != rate:
120
- return None
121
- origin = (video.start_time or 0) * video.time_base
122
- inp.seek(int((origin + Fraction(start, 1) / rate) / video.time_base), stream=video, backward=True)
123
- expected, n = hashlib.sha256(), 0
124
- for frame in inp.decode(video=0):
125
- if frame.pts is None:
126
- return None
127
- position = (frame.pts * frame.time_base - origin) * rate
128
- index = round(position)
129
- if index < start:
130
- continue
131
- if index >= start + count:
132
- break
133
- if abs(position - index) > .01 or index != start + n:
134
- return None
135
- expected.update(frame.to_ndarray(format="yuv420p").tobytes())
136
- n += 1
137
- if n != count:
138
- return None
139
- result = subprocess.run(["ffmpeg", "-v", "error", "-nostdin", "-y", "-ss", str(float(start / rate)),
140
- "-i", str(source), "-frames:v", str(count), "-map", "0:v:0", "-an",
141
- "-c:v", "copy", "-movflags", "+faststart", str(target)], capture_output=True)
142
- matched, digest, n = result.returncode == 0, hashlib.sha256(), 0
143
- if matched:
144
- try:
145
- with av.open(str(target)) as inp:
146
- matched = inp.streams.video[0].average_rate == rate
147
- for frame in inp.decode(video=0):
148
- if frame.pts is None or abs(frame.pts * frame.time_base - n / rate) > Fraction(1, 10000):
149
- matched = False
150
- digest.update(frame.to_ndarray(format="yuv420p").tobytes())
151
- n += 1
152
- except av.FFmpegError:
153
- matched = False
154
- if matched and n == count and digest.digest() == expected.digest():
155
- return dict(video_size_bytes=target.stat().st_size, video_sha256=sha256(target),
156
- decoded_yuv_sha256=digest.hexdigest(), video_processing="frame_exact_lossless_h264_remux")
157
- target.unlink(missing_ok=True)
158
- return None
159
-
160
-
161
- def export_clip(source, target, start, count, fps, preset="ultrafast", remux_first=False):
162
- """Decode from the preceding keyframe, cut exact frames, encode losslessly."""
163
- import av
164
-
165
- if remux_first:
166
- result = try_remux(source, target, start, count, fps)
167
- if result is not None:
168
- return result
169
- rate = Fraction(fps).limit_denominator()
170
- digest, written = hashlib.sha256(), 0
171
- with av.open(str(source)) as inp, av.open(str(target), "w") as out:
172
- video = inp.streams.video[0]
173
- if video.average_rate != rate or video.codec_context.pix_fmt != "yuv420p":
174
- raise ValueError(f"Expected CFR yuv420p source at {fps} FPS: {source}")
175
- origin = (video.start_time or 0) * video.time_base
176
- stream = out.add_stream("libx264", rate=rate, options={"crf": "0", "preset": preset})
177
- stream.width, stream.height = video.width, video.height
178
- stream.pix_fmt = "yuv420p"
179
- stream.codec_context.thread_count = 2
180
- stream.time_base = 1 / rate
181
- inp.seek(int((origin + Fraction(start, 1) / rate) / video.time_base), stream=video, backward=True)
182
- for frame in inp.decode(video=0):
183
- if frame.pts is None:
184
- raise ValueError("Source frame has no PTS")
185
- position = (frame.pts * frame.time_base - origin) * rate
186
- index = round(position)
187
- if abs(position - index) > 0.01:
188
- raise ValueError("Nonuniform source video timestamps")
189
- if index < start:
190
- continue
191
- if index >= start + count:
192
- break
193
- if index != start + written:
194
- raise ValueError(f"Missing/duplicate source frame: {source}, {index}")
195
- digest.update(frame.to_ndarray(format="yuv420p").tobytes())
196
- frame.pts, frame.time_base = written, 1 / rate
197
- for packet in stream.encode(frame):
198
- out.mux(packet)
199
- written += 1
200
- for packet in stream.encode():
201
- out.mux(packet)
202
- if written != count:
203
- raise ValueError(f"Truncated source clip: {source}, wanted {count}, got {written}")
204
- check, decoded = hashlib.sha256(), 0
205
- with av.open(str(target)) as inp:
206
- for frame in inp.decode(video=0):
207
- if frame.pts is None or abs(frame.pts * frame.time_base - decoded / rate) > Fraction(1, 10000):
208
- raise ValueError(f"Output timestamp mismatch: {target}")
209
- check.update(frame.to_ndarray(format="yuv420p").tobytes())
210
- decoded += 1
211
- if decoded != count or check.digest() != digest.digest():
212
- raise ValueError(f"Output frame count/pixel mismatch: {target}")
213
- return dict(video_size_bytes=target.stat().st_size, video_sha256=sha256(target),
214
- decoded_yuv_sha256=check.hexdigest(), video_processing="frame_exact_lossless_h264")
215
-
216
-
217
- def convert(plan, manifest, output, limit=None):
218
- suite = manifest.get("suite", "Order")
219
- output.mkdir(parents=True, exist_ok=False)
220
- write_json(output / "export-status.json", {"status": "incomplete"})
221
- write_json(output / "source-manifest.json", manifest)
222
- hashes, stats, mapping, split_tasks = {}, [], [], []
223
- for item in plan:
224
- task = item["task"]
225
- folder = f"{task['task_id'][1:]}-{task['task_slug']}"
226
- target = output / suite / folder
227
- target.mkdir(parents=True)
228
- (target / "annotations").mkdir()
229
- episodes = item["episodes"][:limit] if limit else item["episodes"]
230
- rows = []
231
- for index, episode in enumerate(episodes):
232
- views = {}
233
- for view, source in episode["views"].items():
234
- path = target / "videos" / view / f"episode_{index:06d}.mp4"
235
- path.parent.mkdir(parents=True, exist_ok=True)
236
- raw = source["path"]
237
- if raw not in hashes:
238
- hashes[raw] = (sha256(raw), raw.stat())
239
- details = export_clip(raw, path, source["start"], episode["frames"], episode["fps"],
240
- preset=manifest.get("video_preset", "ultrafast"),
241
- remux_first=manifest.get("video_remux_first", False))
242
- views[view] = dict(camera=CAMERAS[view], video_path=path.relative_to(target).as_posix(),
243
- source_path=source["source_path"], source_sha256=hashes[raw][0],
244
- **{k: v for k, v in details.items() if k != "decoded_yuv_sha256"})
245
- mapping.append(dict(sample_id=f"evomind_{task['task_id']}_episode_{index:06d}",
246
- source_dataset=episode["source_dataset"], source_episode=episode["source_episode"],
247
- view=view, source_start_frame=source["start"], frames=episode["frames"], **details))
248
- main = views["main_view"]
249
- row = dict(sample_id=f"evomind_{task['task_id']}_episode_{index:06d}",
250
- task_id=task["task_id"], task_name=task["task_name"], task_slug=task["task_slug"],
251
- domain="real-world", episode_index=index, video_path=main["video_path"],
252
- annotation_path=None, has_annotation=False, task_prompt=None,
253
- source_instruction=episode["instruction"], fps=episode["fps"], total_frames=episode["frames"],
254
- num_stages=None, annotation_sha256=None, video_size_bytes=main["video_size_bytes"],
255
- video_sha256=main["video_sha256"], source_path=main["source_path"],
256
- source_total_frames=episode["frames"], source_sha256=main["source_sha256"],
257
- video_processing=main["video_processing"], source_repo=None, source_revision=None,
258
- video_views=views, suite=suite, source_dataset="EvoMind-PiperX",
259
- source_sample_id=f"{episode['source_dataset']}/episode_{episode['source_episode']:06d}",
260
- source_dataset_video_path=main["source_path"], collection_task_id=task["collection_task_id"],
261
- collection_task_name=task["collection_task_name"], collection_task_slug=task["task_slug"],
262
- source_collection="EvoMind", source_dataset_url=None,
263
- source_task_id=task["collection_task_id"], source_task_name=episode["instruction"],
264
- source_task_url=None, name_evidence="recorded_lerobot_episode_instruction", source_file_url=None)
265
- rows.append(row)
266
- print(f"{task['task_id']} episode {index + 1}/{len(episodes)} verified", flush=True)
267
- for path, digest in item["snapshots"].items():
268
- if sha256(path) != digest:
269
- raise ValueError(f"Source metadata changed during export: {path}")
270
- summary = dict(task_id=task["task_id"], task_name=task["task_name"], path=".",
271
- task_slug=task["task_slug"], suite=suite, domain="real-world",
272
- domain_counts={"real-world": len(rows)}, source_dataset="EvoMind-PiperX",
273
- source_repositories=[], source_revisions=[], source_collection="EvoMind",
274
- collection_task_id=task["collection_task_id"], collection_task_names=[task["collection_task_name"]],
275
- trajectory_count=len(rows), annotated_trajectory_count=0, unannotated_trajectory_count=len(rows),
276
- view_trajectory_counts={view: len(rows) for view in CAMERAS},
277
- video_file_count=len(rows) * 3, annotation_file_count=0, trajectory_index="metadata.jsonl",
278
- classification_basis=f"User classified these recordings as {suite} tasks.",
279
- format_reference={"repository": manifest["format_reference"], "revision": manifest["format_revision"]},
280
- source_datasets=[source["dataset"] for source in task["sources"]],
281
- annotation_status="No stage labels collected; pending annotation.")
282
- write_json(target / "metadata.json", summary)
283
- index_path = target / "metadata.jsonl"
284
- index_path.write_text("".join(json.dumps(r, ensure_ascii=False) + "\n" for r in rows), encoding="utf-8")
285
- validation_count = math.ceil(len(rows) * 0.2)
286
- sample_ids = [row["sample_id"] for row in rows]
287
- split_tasks.append(dict(suite=suite, task_id=task["task_id"], task_name=task["task_name"],
288
- task_path=f"{suite}/{folder}", trajectory_index=f"{suite}/{folder}/metadata.jsonl",
289
- trajectory_index_sha256=sha256(index_path),
290
- train=sample_ids[:-validation_count], val=sample_ids[-validation_count:]))
291
- stats.append(dict(task_id=task["task_id"], directory=f"{suite}/{folder}", episodes=len(rows),
292
- frames=sum(e["frames"] for e in episodes), warnings=item["warnings"]))
293
- for path, (digest, before) in hashes.items():
294
- after = path.stat()
295
- if (after.st_size, after.st_mtime_ns) != (before.st_size, before.st_mtime_ns):
296
- raise ValueError(f"Source video changed during export: {path}")
297
- write_json(output / "provenance.json", dict(tool_sha256=sha256(__file__), trajectories=mapping,
298
- source_metadata_sha256={p: h for t in plan for p, h in t["snapshots"].items()}))
299
- write_json(output / "manifest.additions.json", dict(
300
- schema_version=1, partial=bool(limit), base_revision=manifest["format_revision"],
301
- note="New tasks only; merge explicitly into the HF manifest without changing existing frozen splits.",
302
- split_policy={"unit": "trajectory", "val_fraction": 0.2,
303
- "selection": "last ceil(n * 0.2) trajectories are val; preceding trajectories are train",
304
- "include_unannotated": True, "path_base": "manifest directory", "frozen": True},
305
- tasks=split_tasks))
306
- report = dict(status="passed", partial=bool(limit), tasks=stats,
307
- episodes=sum(t["episodes"] for t in stats), videos=sum(t["episodes"] * 3 for t in stats),
308
- checks="Full output decode; frame counts, timestamps and decoded YUV equality to source cuts; source metadata hashes.")
309
- write_json(output / "export-status.json", report)
310
- (output / suite / "README.md").write_text(
311
- f"# {suite} — EvoMind recordings\n\nUnannotated real robot recordings. "
312
- "Each task has metadata.json and metadata.jsonl with task-relative paths. "
313
- "main_view is the environment camera; left_view/right_view are wrist cameras. "
314
- "Stage annotations have not been collected. See ../export-status.json and ../provenance.json.\n\n"
315
- + "\n".join(f"- [{t['task_id']}]({t['directory'].split('/', 1)[1]}/): {t['episodes']} trajectories" for t in stats) + "\n")
316
- return report
317
-
318
-
319
- def main():
320
- p = argparse.ArgumentParser(description=__doc__)
321
- p.add_argument("--manifest", type=Path, default=Path(__file__).with_name("order_20261031.json"))
322
- p.add_argument("--source-root", type=Path, required=True)
323
- p.add_argument("--output", type=Path)
324
- p.add_argument("--plan", action="store_true", help="Validate metadata and report short clips without writing output")
325
- p.add_argument("--limit-per-task", type=int, help="Export a partial smoke test, never a complete release")
326
- args = p.parse_args()
327
- if args.limit_per_task is not None and args.limit_per_task < 1:
328
- p.error("--limit-per-task must be positive")
329
- if not args.plan and args.output is None:
330
- p.error("--output is required unless --plan is set")
331
- manifest = json.loads(args.manifest.read_text())
332
- plan = load_plan(manifest, args.source_root.resolve())
333
- if args.plan:
334
- report = dict(episodes=sum(len(t["episodes"]) for t in plan), tasks=[
335
- dict(task_id=t["task"]["task_id"], name=t["task"]["collection_task_name"],
336
- episodes=len(t["episodes"]), warnings=t["warnings"]) for t in plan])
337
- else:
338
- output = args.output.resolve()
339
- if output.is_relative_to(args.source_root.resolve()) or args.source_root.resolve().is_relative_to(output):
340
- p.error("Output must be separate from the source data tree")
341
- report = convert(plan, manifest, output, args.limit_per_task)
342
- print(json.dumps(report, ensure_ascii=False, indent=2))
343
-
344
-
345
- if __name__ == "__main__":
346
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
provenance/evomind-state-20261102/prepare_personal_state.py DELETED
@@ -1,130 +0,0 @@
1
- """Prepare a standalone personal State dataset from the validated release."""
2
- import copy
3
- from datetime import datetime, timezone, timedelta
4
- import hashlib
5
- import json
6
- import os
7
- from pathlib import Path
8
- import shutil
9
-
10
- SOURCE = Path('/home/zhaobo/work/codex_active_vision/proprimem_state_export_20261102_v001')
11
- ROOT = Path('/home/zhaobo/work/codex_active_vision/proprimem_state_personal_20261103_v001')
12
- REPO = 'syding9/ProPriMem-State'
13
-
14
-
15
- def read(path):
16
- return json.loads(path.read_text())
17
-
18
-
19
- def write(path, value):
20
- path.write_text(json.dumps(value, ensure_ascii=False, indent=2) + '\n')
21
-
22
-
23
- def copy_file(source, target):
24
- if Path(source).suffix == '.mp4':
25
- os.link(source, target)
26
- else:
27
- shutil.copy2(source, target)
28
- return target
29
-
30
-
31
- if __name__ == '__main__':
32
- report = read(SOURCE / 'full/export-status.json')
33
- assert report['status'] == 'passed' and not report['partial']
34
- assert report['episodes'] == 186 and report['videos'] == 558
35
- ROOT.mkdir(exist_ok=False)
36
- full = ROOT / 'full'
37
- full.mkdir()
38
- (ROOT / 'tools').mkdir()
39
- shutil.copytree(SOURCE / 'full/State', full / 'State', copy_function=copy_file)
40
- shutil.copytree(SOURCE / 'full/provenance', full / 'provenance')
41
- evidence = full / 'provenance/evomind-state-20261102'
42
- # This script replaces the organization-specific publication preparation.
43
- (evidence / 'prepare_state_pr.py').unlink()
44
- for name in ['source-manifest.json', 'export-status.json', 'provenance.json', 'manifest.additions.json']:
45
- shutil.copy2(SOURCE / 'full' / name, full / name)
46
- old = read(SOURCE / 'full/manifest.json')
47
- tasks = [t for t in old['tasks'] if t['task_id'] in {'S11', 'S12', 'S13', 'S14', 'S15'}]
48
- assert len(tasks) == 5
49
- manifest = dict(schema_version=old['schema_version'], split_policy=copy.deepcopy(old['split_policy']),
50
- dataset_version='1.0.0', split_version='1.0.0',
51
- created_at=datetime.now(timezone(timedelta(hours=8))).isoformat(),
52
- summary={'State': {'tasks': 5, 'train': 148, 'val': 38}},
53
- totals={'tasks': 5, 'trajectories': 186, 'train': 148, 'val': 38}, tasks=tasks,
54
- source_format_reference=read(full / 'source-manifest.json')['format_reference'])
55
- write(full / 'manifest.json', manifest)
56
- rows = []
57
- for task in tasks:
58
- index = full / task['trajectory_index']
59
- assert hashlib.sha256(index.read_bytes()).hexdigest() == task['trajectory_index_sha256']
60
- data = [json.loads(line) for line in index.read_text().splitlines()]
61
- assert [r['sample_id'] for r in data] == task['train'] + task['val']
62
- assert task['suite'] == 'State' and not task['task_name'].startswith('State:')
63
- rows.append(f"| {task['task_id']} | [{task['task_name']}]({task['task_path']}/) | {len(data)} |")
64
- for row in data:
65
- assert not row['has_annotation'] and row['annotation_path'] is None
66
- for view in row['video_views'].values():
67
- path = index.parent / view['video_path']
68
- original = SOURCE / 'full' / path.relative_to(full)
69
- assert path.stat().st_ino == original.stat().st_ino
70
- assert path.stat().st_size == view['video_size_bytes']
71
- table = '| ID | Task | Trajectories |\n|---|---|---:|\n' + '\n'.join(rows)
72
- readme = '''---
73
- pretty_name: ProPriMem-State
74
- tags:
75
- - robotics
76
- - memory
77
- - state
78
- ---
79
- # ProPriMem-State
80
-
81
- 5 real-robot State tasks · 186 trajectories · 558 videos.
82
-
83
- Recorded using a bimanual PiperX setup on 2026-10-31 and 2026-11-02. Each trajectory contains
84
- an environment camera (`main_view`) and two wrist cameras (`left_view`, `right_view`), at
85
- 1280×720 and 30 FPS. This dataset follows the task-directory and index format of
86
- [MINT-SJTU/ProPriMem](https://huggingface.co/datasets/MINT-SJTU/ProPriMem).
87
-
88
- TABLE
89
-
90
- ## Format and splits
91
-
92
- Each task in `State/` contains `metadata.json`, `metadata.jsonl` and `videos/`.
93
- Paths within a trajectory index are relative to its task directory. Task identifiers S11–S15
94
- are retained for compatibility with the prepared ProPriMem State addition; this standalone
95
- repository contains only these five tasks.
96
-
97
- Dataset v1.0.0 · Split v1.0.0 · **148 train / 38 val**. Explicit trajectory assignments in
98
- [manifest.json](manifest.json) are frozen; all views of a trajectory share its split.
99
-
100
- These recordings are **unannotated**: `has_annotation=false`; stage boundaries and task-success
101
- labels are not inferred. Recorded instructions remain in `source_instruction`. Task names do
102
- not have a `State:` prefix. Raw robot state/action Parquet files are not included.
103
-
104
- ## Selection and validation
105
-
106
- Six user-reviewed abnormal piggy-bank episodes are excluded: batch `20261031_153227` #3, #15,
107
- #16; batch `20261031_161309` #18, #19, #20. The original raw recordings are retained separately.
108
- The test-tube task combines three valid batches (11 + 3 + 35 trajectories).
109
-
110
- All 558 videos are frame-exact H.264 stream-copy cuts. Full decoding confirmed frame counts,
111
- timestamps and equality of decoded YUV pixels to the original source cuts. Eight conversion
112
- tests passed. Source selection, mappings and validation records are under
113
- [`provenance/evomind-state-20261102/`](provenance/evomind-state-20261102/).
114
- '''.replace('TABLE', table)
115
- (full / 'README.md').write_text(readme)
116
- state_table = table.replace('](State/', '](')
117
- (full / 'State/README.md').write_text('# State\n\n5 tasks · 186 trajectories.\n\n' + state_table + '\n')
118
- write(evidence / 'publication.json', dict(repository=REPO, dataset_version='1.0.0',
119
- trajectories=186, videos=558, train=148, val=38, original_raw_data_retained=True))
120
- shutil.copy2(__file__, evidence / Path(__file__).name)
121
- files = sorted(p for p in full.rglob('*') if p.is_file() and
122
- (p.relative_to(full).parts[0] in ['State', 'provenance'] or
123
- p.relative_to(full).as_posix() in ['README.md', 'manifest.json']))
124
- assert sum(p.suffix == '.mp4' for p in files) == 558
125
- receipt = dict(repository=REPO, private=True, files=len(files), videos=558, trajectories=186,
126
- bytes=sum(p.stat().st_size for p in files),
127
- paths=[p.relative_to(full).as_posix() for p in files],
128
- totals=manifest['totals'], splits_preserved=True)
129
- write(ROOT / 'preparation.json', receipt)
130
- print(json.dumps({k:v for k,v in receipt.items() if k != 'paths'}, indent=2), flush=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
provenance/evomind-state-20261102/provenance.json DELETED
The diff for this file is too large to render. See raw diff
 
provenance/evomind-state-20261102/publication.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "repository": "syding9/ProPriMem-State",
3
- "dataset_version": "1.0.0",
4
- "trajectories": 186,
5
- "videos": 558,
6
- "train": 148,
7
- "val": 38,
8
- "original_raw_data_retained": true
9
- }
 
 
 
 
 
 
 
 
 
 
provenance/evomind-state-20261102/review-approved.json DELETED
@@ -1,58 +0,0 @@
1
- {
2
- "original_count": 192,
3
- "recommended_exclusions": [
4
- {
5
- "dataset": "State: 存钱罐里放3个硬币_40dcb735_20261031_153227",
6
- "episode": 3,
7
- "duration_s": 16.0,
8
- "recommendation": "建议排除(尚未删除)",
9
- "review_reason": "0.5 秒间隔画面显示始终在硬币堆附近抓取,未见向存钱罐投币;16 秒,任务中位数约 30.3 秒。",
10
- "export_decision": "exclude"
11
- },
12
- {
13
- "dataset": "State: 存钱罐里放3个硬币_40dcb735_20261031_153227",
14
- "episode": 15,
15
- "duration_s": 119.46666666666667,
16
- "recommendation": "建议排除(尚未删除)",
17
- "review_reason": "约 120 秒,抽帧以空等/收尾调整为主;两侧夹爪动作值全程恒定,未见执行三次投币。",
18
- "export_decision": "exclude"
19
- },
20
- {
21
- "dataset": "State: 存钱罐里放3个硬币_40dcb735_20261031_153227",
22
- "episode": 16,
23
- "duration_s": 119.53333333333333,
24
- "recommendation": "建议排除(尚未删除)",
25
- "review_reason": "约 120 秒,抽帧以空等/收尾调整为主;两侧夹爪动作值全程恒定,未见执行三次投币。",
26
- "export_decision": "exclude"
27
- },
28
- {
29
- "dataset": "State: 存钱罐里放3个硬币_40dcb735_20261031_161309",
30
- "episode": 18,
31
- "duration_s": 119.46666666666667,
32
- "recommendation": "建议排除(尚未删除)",
33
- "review_reason": "约 120 秒,抽帧以空等/收尾调整为主;两侧夹爪动作值全程恒定,未见执行三次投币。",
34
- "export_decision": "exclude"
35
- },
36
- {
37
- "dataset": "State: 存钱罐里放3个硬币_40dcb735_20261031_161309",
38
- "episode": 19,
39
- "duration_s": 119.53333333333333,
40
- "recommendation": "建议排除(尚未删除)",
41
- "review_reason": "约 120 秒,抽帧以空等/收尾调整为主;两侧夹爪动作值全程恒定,未见执行三次投币。",
42
- "export_decision": "exclude"
43
- },
44
- {
45
- "dataset": "State: 存钱罐里放3个硬币_40dcb735_20261031_161309",
46
- "episode": 20,
47
- "duration_s": 119.56666666666666,
48
- "recommendation": "建议排除(尚未删除)",
49
- "review_reason": "约 120 秒,抽帧以空等/收尾调整为主;两侧夹爪动作值全程恒定,未见执行三次投币。",
50
- "export_decision": "exclude"
51
- }
52
- ],
53
- "remaining_if_approved": 186,
54
- "raw_data_modified": false,
55
- "uploaded": false,
56
- "approved_by_user_on": "2026-11-02",
57
- "selection_status": "approved_and_excluded_from_export"
58
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
provenance/evomind-state-20261102/run_state_export.py DELETED
@@ -1,51 +0,0 @@
1
- """Convert the approved five State tasks in parallel and assemble one release."""
2
- from concurrent.futures import ProcessPoolExecutor
3
- import json
4
- from pathlib import Path
5
- import shutil
6
-
7
- import export_order as exporter
8
-
9
- ROOT = Path(__file__).resolve().parent.parent
10
- RAW = Path('/home/zhaobo/work/codex_active_vision/memory_depend_collection_20261030_v001/data')
11
- MANIFEST = json.loads((ROOT / 'tools/state_20261102.json').read_text())
12
-
13
-
14
- def run(task):
15
- manifest = dict(MANIFEST, tasks=[task])
16
- out = ROOT / 'parts' / task['task_id']
17
- status = out / 'export-status.json'
18
- if status.exists() and json.loads(status.read_text()).get('status') == 'passed':
19
- return out
20
- plan = exporter.load_plan(manifest, RAW)
21
- result = exporter.convert(plan, manifest, out)
22
- print('FINISHED', task['task_id'], result['episodes'], flush=True)
23
- return out
24
-
25
-
26
- if __name__ == '__main__':
27
- with ProcessPoolExecutor(max_workers=4) as pool:
28
- parts = list(pool.map(run, MANIFEST['tasks']))
29
- full = ROOT / 'full'
30
- full.mkdir()
31
- (full / 'State').mkdir()
32
- reports = [json.loads((p / 'export-status.json').read_text()) for p in parts]
33
- assert all(p['status'] == 'passed' and not p['partial'] for p in reports)
34
- for part in parts:
35
- for folder in (part / 'State').iterdir():
36
- if folder.is_dir():
37
- shutil.move(str(folder), full / 'State' / folder.name)
38
- provenance = [json.loads((p / 'provenance.json').read_text()) for p in parts]
39
- assert len({p['tool_sha256'] for p in provenance}) == 1
40
- exporter.write_json(full / 'source-manifest.json', MANIFEST)
41
- exporter.write_json(full / 'provenance.json', dict(tool_sha256=provenance[0]['tool_sha256'],
42
- trajectories=[r for p in provenance for r in p['trajectories']],
43
- source_metadata_sha256={k:v for p in provenance for k,v in p['source_metadata_sha256'].items()}))
44
- additions = [json.loads((p / 'manifest.additions.json').read_text()) for p in parts]
45
- exporter.write_json(full / 'manifest.additions.json', dict(additions[0], tasks=[t for p in additions for t in p['tasks']]))
46
- report = dict(status='passed', partial=False, tasks=[t for p in reports for t in p['tasks']],
47
- episodes=sum(p['episodes'] for p in reports), videos=sum(p['videos'] for p in reports),
48
- checks=reports[0]['checks'])
49
- assert report['episodes'] == 186 and report['videos'] == 558
50
- exporter.write_json(full / 'export-status.json', report)
51
- print('FULL DONE', report['episodes'], report['videos'], flush=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
provenance/evomind-state-20261102/source-manifest.json DELETED
@@ -1,100 +0,0 @@
1
- {
2
- "format_reference": "MINT-SJTU/ProPriMem",
3
- "format_revision": "9afafe07bba3714ee86bde12834f6033e9685ac8",
4
- "suite": "State",
5
- "video_preset": "medium",
6
- "tasks": [
7
- {
8
- "task_id": "S11",
9
- "task_slug": "put_three_coins_into_piggy_bank",
10
- "task_name": "Put three coins into a piggy bank",
11
- "collection_task_id": "40dcb735-6a97-4e74-b19e-9d1133bfb7c0",
12
- "collection_task_name": "存钱罐里放3个硬币",
13
- "sources": [
14
- {
15
- "dataset": "State: 存钱罐里放3个硬币_40dcb735_20261031_153227",
16
- "episodes": 17,
17
- "exclude_episodes": [
18
- 3,
19
- 15,
20
- 16
21
- ]
22
- },
23
- {
24
- "dataset": "State: 存钱罐里放3个硬币_40dcb735_20261031_161309",
25
- "episodes": 21,
26
- "exclude_episodes": [
27
- 18,
28
- 19,
29
- 20
30
- ]
31
- }
32
- ]
33
- },
34
- {
35
- "task_id": "S12",
36
- "task_slug": "inspect_four_objects_and_return",
37
- "task_name": "Inspect four objects and return them",
38
- "collection_task_id": "c140db97-8fc7-46b2-9624-7b6ee5b92956",
39
- "collection_task_name": "检测4个物品并放回原位",
40
- "sources": [
41
- {
42
- "dataset": "State-检测-4-个物品并放回原位_c140db97_20261102_153040",
43
- "episodes": 35
44
- }
45
- ]
46
- },
47
- {
48
- "task_id": "S13",
49
- "task_slug": "inspect_three_drawers",
50
- "task_name": "Inspect three drawers",
51
- "collection_task_id": "d0d3e517-daaf-44b7-aa97-554622c46ed0",
52
- "collection_task_name": "巡检抽屉",
53
- "sources": [
54
- {
55
- "dataset": "State-巡检抽屉_d0d3e517_20261102_164828",
56
- "episodes": 35
57
- }
58
- ]
59
- },
60
- {
61
- "task_id": "S14",
62
- "task_slug": "weigh_four_objects_and_return",
63
- "task_name": "Weigh four objects and return them",
64
- "collection_task_id": "58fcd50b-3cc0-44a7-84e5-3f19e495f592",
65
- "collection_task_name": "称重归位",
66
- "sources": [
67
- {
68
- "dataset": "State-称重归位_58fcd50b_20261102_171751",
69
- "episodes": 35
70
- }
71
- ]
72
- },
73
- {
74
- "task_id": "S15",
75
- "task_slug": "inspect_three_test_tubes",
76
- "task_name": "Inspect three test tubes",
77
- "collection_task_id": "1b7e5920-8114-4da2-9377-a94c23eca638",
78
- "collection_task_name": "试管架",
79
- "sources": [
80
- {
81
- "dataset": "State-试管架_1b7e5920_20261102_190333",
82
- "episodes": 11
83
- },
84
- {
85
- "dataset": "State-试管架_1b7e5920_20261102_191341",
86
- "episodes": 3
87
- },
88
- {
89
- "dataset": "State-试管架_1b7e5920_20261102_204939",
90
- "episodes": 35
91
- }
92
- ]
93
- }
94
- ],
95
- "selection_note": "User-approved exclusions: six reviewed piggy-bank episodes; all other selected saved episodes retained. Raw data unchanged.",
96
- "reviewed_source_episodes": 192,
97
- "excluded_episodes": 6,
98
- "expected_episodes": 186,
99
- "video_remux_first": true
100
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
provenance/evomind-state-20261102/state_20261102.json DELETED
@@ -1,100 +0,0 @@
1
- {
2
- "format_reference": "MINT-SJTU/ProPriMem",
3
- "format_revision": "9afafe07bba3714ee86bde12834f6033e9685ac8",
4
- "suite": "State",
5
- "video_preset": "medium",
6
- "tasks": [
7
- {
8
- "task_id": "S11",
9
- "task_slug": "put_three_coins_into_piggy_bank",
10
- "task_name": "Put three coins into a piggy bank",
11
- "collection_task_id": "40dcb735-6a97-4e74-b19e-9d1133bfb7c0",
12
- "collection_task_name": "存钱罐里放3个硬币",
13
- "sources": [
14
- {
15
- "dataset": "State: 存钱罐里放3个硬币_40dcb735_20261031_153227",
16
- "episodes": 17,
17
- "exclude_episodes": [
18
- 3,
19
- 15,
20
- 16
21
- ]
22
- },
23
- {
24
- "dataset": "State: 存钱罐里放3个硬币_40dcb735_20261031_161309",
25
- "episodes": 21,
26
- "exclude_episodes": [
27
- 18,
28
- 19,
29
- 20
30
- ]
31
- }
32
- ]
33
- },
34
- {
35
- "task_id": "S12",
36
- "task_slug": "inspect_four_objects_and_return",
37
- "task_name": "Inspect four objects and return them",
38
- "collection_task_id": "c140db97-8fc7-46b2-9624-7b6ee5b92956",
39
- "collection_task_name": "检测4个物品并放回原位",
40
- "sources": [
41
- {
42
- "dataset": "State-检测-4-个物品并放回原位_c140db97_20261102_153040",
43
- "episodes": 35
44
- }
45
- ]
46
- },
47
- {
48
- "task_id": "S13",
49
- "task_slug": "inspect_three_drawers",
50
- "task_name": "Inspect three drawers",
51
- "collection_task_id": "d0d3e517-daaf-44b7-aa97-554622c46ed0",
52
- "collection_task_name": "巡检抽屉",
53
- "sources": [
54
- {
55
- "dataset": "State-巡检抽屉_d0d3e517_20261102_164828",
56
- "episodes": 35
57
- }
58
- ]
59
- },
60
- {
61
- "task_id": "S14",
62
- "task_slug": "weigh_four_objects_and_return",
63
- "task_name": "Weigh four objects and return them",
64
- "collection_task_id": "58fcd50b-3cc0-44a7-84e5-3f19e495f592",
65
- "collection_task_name": "称重归位",
66
- "sources": [
67
- {
68
- "dataset": "State-称重归位_58fcd50b_20261102_171751",
69
- "episodes": 35
70
- }
71
- ]
72
- },
73
- {
74
- "task_id": "S15",
75
- "task_slug": "inspect_three_test_tubes",
76
- "task_name": "Inspect three test tubes",
77
- "collection_task_id": "1b7e5920-8114-4da2-9377-a94c23eca638",
78
- "collection_task_name": "试管架",
79
- "sources": [
80
- {
81
- "dataset": "State-试管架_1b7e5920_20261102_190333",
82
- "episodes": 11
83
- },
84
- {
85
- "dataset": "State-试管架_1b7e5920_20261102_191341",
86
- "episodes": 3
87
- },
88
- {
89
- "dataset": "State-试管架_1b7e5920_20261102_204939",
90
- "episodes": 35
91
- }
92
- ]
93
- }
94
- ],
95
- "selection_note": "User-approved exclusions: six reviewed piggy-bank episodes; all other selected saved episodes retained. Raw data unchanged.",
96
- "reviewed_source_episodes": 192,
97
- "excluded_episodes": 6,
98
- "expected_episodes": 186,
99
- "video_remux_first": true
100
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
provenance/evomind-state-20261102/test_export_order.py DELETED
@@ -1,180 +0,0 @@
1
- import copy
2
- from fractions import Fraction
3
- import hashlib
4
- import json
5
- from pathlib import Path
6
- import tempfile
7
- import unittest
8
-
9
- import av
10
- import numpy as np
11
- import pyarrow as pa
12
- import pyarrow.parquet as pq
13
-
14
- import export_order as exporter
15
-
16
-
17
- class ExportTests(unittest.TestCase):
18
- def setUp(self):
19
- self.tmp = tempfile.TemporaryDirectory()
20
- self.addCleanup(self.tmp.cleanup)
21
- self.root = Path(self.tmp.name)
22
- self.source = self.root / "raw"
23
- dataset = self.source / "recording"
24
- (dataset / "meta/episodes/chunk-000").mkdir(parents=True)
25
- self.info = dict(codebase_version="v3.0", total_episodes=2, total_frames=20, fps=30,
26
- features={c: {"dtype": "video"} for c in exporter.CAMERAS.values()},
27
- video_path="videos/{video_key}/chunk-{chunk_index:03d}/file-{file_index:03d}.mp4")
28
- self.manifest = dict(format_reference="MINT-SJTU/ProPriMem", format_revision="test", tasks=[
29
- dict(task_id="O08", task_slug="test_sequence", task_name="Test sequence",
30
- collection_task_id="local-id", collection_task_name="测试", sources=[
31
- dict(dataset="recording", episodes=2)])])
32
- rows = []
33
- for i, (start, length) in enumerate([(0, 7), (7, 13)]):
34
- row = dict(episode_index=i, length=length, tasks=["Press one, then three"])
35
- for camera in exporter.CAMERAS.values():
36
- prefix = f"videos/{camera}"
37
- row.update({prefix + "/chunk_index": 0, prefix + "/file_index": 0,
38
- prefix + "/from_timestamp": start / 30,
39
- prefix + "/to_timestamp": (start + length) / 30})
40
- rows.append(row)
41
- exporter.write_json(dataset / "meta/info.json", self.info)
42
- pq.write_table(pa.Table.from_pylist(rows), dataset / "meta/episodes/chunk-000/file-000.parquet")
43
- for camera in exporter.CAMERAS.values():
44
- path = dataset / f"videos/{camera}/chunk-000/file-000.mp4"
45
- path.parent.mkdir(parents=True)
46
- with av.open(str(path), "w") as out:
47
- stream = out.add_stream("libx264", rate=30, options={"g": "12", "crf": "0"})
48
- stream.width, stream.height, stream.pix_fmt = 32, 24, "yuv420p"
49
- for i in range(20):
50
- pixels = np.full((24, 32, 3), (i * 11) % 256, dtype=np.uint8)
51
- frame = av.VideoFrame.from_ndarray(pixels, format="rgb24")
52
- frame.pts, frame.time_base = i, Fraction(1, 30)
53
- for packet in stream.encode(frame):
54
- out.mux(packet)
55
- for packet in stream.encode():
56
- out.mux(packet)
57
-
58
- def test_exact_mid_gop_cut_and_unannotated_schema(self):
59
- plan = exporter.load_plan(self.manifest, self.source)
60
- output = self.root / "export"
61
- report = exporter.convert(plan, self.manifest, output)
62
- self.assertEqual((report["episodes"], report["videos"]), (2, 6))
63
- task = output / "Order/08-test_sequence"
64
- rows = [json.loads(line) for line in (task / "metadata.jsonl").read_text().splitlines()]
65
- self.assertEqual([r["total_frames"] for r in rows], [7, 13])
66
- for row in rows:
67
- self.assertFalse(row["has_annotation"])
68
- self.assertIsNone(row["annotation_path"])
69
- self.assertIsNone(row["task_prompt"])
70
- self.assertEqual(row["source_instruction"], "Press one, then three")
71
- self.assertEqual(row["suite"], "Order")
72
- for view in row["video_views"].values():
73
- path = task / view["video_path"]
74
- self.assertEqual(exporter.sha256(path), view["video_sha256"])
75
- # Independent pixel check of a non-keyframe-aligned second episode.
76
- source = self.source / "recording/videos/observation.images.left_wrist/chunk-000/file-000.mp4"
77
- def pixels(path):
78
- with av.open(str(path)) as inp:
79
- return [hashlib.sha256(f.to_ndarray(format="yuv420p").tobytes()).hexdigest()
80
- for f in inp.decode(video=0)]
81
- self.assertEqual(pixels(source)[7:], pixels(task / rows[1]["video_views"]["left_view"]["video_path"]))
82
- self.assertEqual(list((task / "annotations").iterdir()), [])
83
- additions = json.loads((output / "manifest.additions.json").read_text())
84
- split = additions["tasks"][0]
85
- self.assertEqual(split["train"], [rows[0]["sample_id"]])
86
- self.assertEqual(split["val"], [rows[1]["sample_id"]])
87
- self.assertEqual(split["trajectory_index_sha256"], exporter.sha256(task / "metadata.jsonl"))
88
- with self.assertRaises(FileExistsError):
89
- exporter.convert(plan, self.manifest, output)
90
-
91
- def test_changed_count_and_duplicate_sources_rejected(self):
92
- manifest = copy.deepcopy(self.manifest)
93
- manifest["tasks"][0]["sources"][0]["episodes"] = 3
94
- with self.assertRaisesRegex(ValueError, "count changed"):
95
- exporter.load_plan(manifest, self.source)
96
- manifest = copy.deepcopy(self.manifest)
97
- manifest["tasks"][0]["sources"] *= 2
98
- with self.assertRaisesRegex(ValueError, "Duplicate source"):
99
- exporter.load_plan(manifest, self.source)
100
-
101
- def test_state_exclusions_keep_source_ids_and_reindex_outputs(self):
102
- manifest = copy.deepcopy(self.manifest)
103
- manifest.update(suite="State", video_preset="medium")
104
- manifest["tasks"][0]["task_id"] = "S11"
105
- manifest["tasks"][0]["sources"][0]["exclude_episodes"] = [0]
106
- plan = exporter.load_plan(manifest, self.source)
107
- self.assertEqual([e["source_episode"] for e in plan[0]["episodes"]], [1])
108
- output = self.root / "state"
109
- report = exporter.convert(plan, manifest, output)
110
- self.assertEqual(report["episodes"], 1)
111
- task = output / "State/11-test_sequence"
112
- row = json.loads((task / "metadata.jsonl").read_text())
113
- self.assertEqual(row["suite"], "State")
114
- self.assertEqual(row["episode_index"], 0)
115
- self.assertEqual(row["source_sample_id"], "recording/episode_000001")
116
- self.assertFalse((output / "Order").exists())
117
- split = json.loads((output / "manifest.additions.json").read_text())["tasks"][0]
118
- self.assertEqual(split["task_path"], "State/11-test_sequence")
119
- self.assertEqual(split["val"], [row["sample_id"]])
120
-
121
- def test_wrong_suite_id_and_invalid_exclusions_rejected(self):
122
- manifest = copy.deepcopy(self.manifest)
123
- manifest["suite"] = "State"
124
- with self.assertRaisesRegex(ValueError, "Invalid State"):
125
- exporter.load_plan(manifest, self.source)
126
- manifest["tasks"][0]["task_id"] = "S11"
127
- for excluded in ([2], [0, 0]):
128
- manifest["tasks"][0]["sources"][0]["exclude_episodes"] = excluded
129
- with self.assertRaisesRegex(ValueError, "Invalid explicit episode exclusions"):
130
- exporter.load_plan(manifest, self.source)
131
-
132
- def test_optional_remux_still_requires_exact_pixels_and_frame_count(self):
133
- source = self.source / "recording/videos/observation.images.left_wrist/chunk-000/file-000.mp4"
134
- target = self.root / "remux.mp4"
135
- details = exporter.export_clip(source, target, 7, 13, 30, remux_first=True)
136
- with av.open(str(source)) as inp:
137
- expected = [hashlib.sha256(f.to_ndarray(format="yuv420p").tobytes()).hexdigest()
138
- for f in inp.decode(video=0)][7:]
139
- with av.open(str(target)) as inp:
140
- actual = [hashlib.sha256(f.to_ndarray(format="yuv420p").tobytes()).hexdigest()
141
- for f in inp.decode(video=0)]
142
- self.assertEqual(actual, expected)
143
- self.assertEqual(details["video_sha256"], exporter.sha256(target))
144
-
145
- def test_truncated_video_does_not_publish_metadata(self):
146
- plan = exporter.load_plan(self.manifest, self.source)
147
- plan[0]["episodes"][1]["frames"] = 14
148
- output = self.root / "bad-export"
149
- with self.assertRaisesRegex(ValueError, "Truncated source"):
150
- exporter.convert(plan, self.manifest, output)
151
- self.assertEqual(json.loads((output / "export-status.json").read_text())["status"], "incomplete")
152
- self.assertFalse((output / "Order/08-test_sequence/metadata.jsonl").exists())
153
-
154
- def test_paths_cannot_escape_raw_root(self):
155
- with self.assertRaises(ValueError):
156
- exporter.child(self.source, "../outside")
157
-
158
- def test_second_shard_uses_its_own_timestamp_origin(self):
159
- import shutil
160
-
161
- dataset = self.source / "recording"
162
- path = dataset / "meta/episodes/chunk-000/file-000.parquet"
163
- rows = pq.read_table(path).to_pylist()
164
- for camera in exporter.CAMERAS.values():
165
- source = dataset / f"videos/{camera}/chunk-000/file-000.mp4"
166
- shutil.copyfile(source, source.with_name("file-001.mp4"))
167
- prefix = f"videos/{camera}"
168
- rows[1][prefix + "/file_index"] = 1
169
- rows[1][prefix + "/from_timestamp"] = 0.0
170
- rows[1][prefix + "/to_timestamp"] = 13 / 30
171
- pq.write_table(pa.Table.from_pylist(rows), path)
172
- plan = exporter.load_plan(self.manifest, self.source)
173
- output = self.root / "shard-export"
174
- exporter.convert(plan, self.manifest, output)
175
- records = json.loads((output / "provenance.json").read_text())["trajectories"]
176
- self.assertTrue(all(r["source_start_frame"] == 0 for r in records[3:]))
177
-
178
-
179
- if __name__ == "__main__":
180
- unittest.main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
provenance/evomind-state-20261102/tests.log DELETED
@@ -1,19 +0,0 @@
1
- test_changed_count_and_duplicate_sources_rejected (test_export_order.ExportTests.test_changed_count_and_duplicate_sources_rejected) ... ok
2
- test_exact_mid_gop_cut_and_unannotated_schema (test_export_order.ExportTests.test_exact_mid_gop_cut_and_unannotated_schema) ... O08 episode 1/2 verified
3
- O08 episode 2/2 verified
4
- ok
5
- test_optional_remux_still_requires_exact_pixels_and_frame_count (test_export_order.ExportTests.test_optional_remux_still_requires_exact_pixels_and_frame_count) ... ok
6
- test_paths_cannot_escape_raw_root (test_export_order.ExportTests.test_paths_cannot_escape_raw_root) ... ok
7
- test_second_shard_uses_its_own_timestamp_origin (test_export_order.ExportTests.test_second_shard_uses_its_own_timestamp_origin) ... O08 episode 1/2 verified
8
- O08 episode 2/2 verified
9
- ok
10
- test_state_exclusions_keep_source_ids_and_reindex_outputs (test_export_order.ExportTests.test_state_exclusions_keep_source_ids_and_reindex_outputs) ... S11 episode 1/1 verified
11
- ok
12
- test_truncated_video_does_not_publish_metadata (test_export_order.ExportTests.test_truncated_video_does_not_publish_metadata) ... O08 episode 1/2 verified
13
- ok
14
- test_wrong_suite_id_and_invalid_exclusions_rejected (test_export_order.ExportTests.test_wrong_suite_id_and_invalid_exclusions_rejected) ... ok
15
-
16
- ----------------------------------------------------------------------
17
- Ran 8 tests in 0.259s
18
-
19
- OK
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
provenance/evomind-state-20261102/validation.json DELETED
@@ -1,44 +0,0 @@
1
- {
2
- "status": "passed",
3
- "partial": false,
4
- "tasks": [
5
- {
6
- "task_id": "S11",
7
- "directory": "State/11-put_three_coins_into_piggy_bank",
8
- "episodes": 32,
9
- "frames": 28951,
10
- "warnings": []
11
- },
12
- {
13
- "task_id": "S12",
14
- "directory": "State/12-inspect_four_objects_and_return",
15
- "episodes": 35,
16
- "frames": 31753,
17
- "warnings": []
18
- },
19
- {
20
- "task_id": "S13",
21
- "directory": "State/13-inspect_three_drawers",
22
- "episodes": 35,
23
- "frames": 34646,
24
- "warnings": []
25
- },
26
- {
27
- "task_id": "S14",
28
- "directory": "State/14-weigh_four_objects_and_return",
29
- "episodes": 35,
30
- "frames": 50435,
31
- "warnings": []
32
- },
33
- {
34
- "task_id": "S15",
35
- "directory": "State/15-inspect_three_test_tubes",
36
- "episodes": 49,
37
- "frames": 43629,
38
- "warnings": []
39
- }
40
- ],
41
- "episodes": 186,
42
- "videos": 558,
43
- "checks": "Full output decode; frame counts, timestamps and decoded YUV equality to source cuts; source metadata hashes."
44
- }