Download eval/source/robot_tools/droid/scripts/scan_tasks.py from JiayiWuLeo/RobotZero: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/datasets/JiayiWuLeo/RobotZero/resolve/main/eval/source/robot_tools/droid/scripts/scan_tasks.py
- Command line
-
hf download hf://datasets/JiayiWuLeo/RobotZero/eval/source/robot_tools/droid/scripts/scan_tasks.py
-
curl -L -o scan_tasks.py https://huggingface.co/datasets/JiayiWuLeo/RobotZero/resolve/main/eval/source/robot_tools/droid/scripts/scan_tasks.py
1.22 kB
| """Task label + duration for every episode under out/ (the rendered set), reading | |
| data/<ep>/metadata.json. Duration = (trajectory_length - 1) / HZ; the mp4 fps | |
| metadata (60) is fake -- one frame per control step, see README. | |
| -> droid/tasks.jsonl: {ep, task, steps, sec, ext1, ext2, wrist} | |
| """ | |
| import json, sys | |
| from pathlib import Path | |
| from concurrent.futures import ThreadPoolExecutor | |
| HZ = float(sys.argv[1]) if len(sys.argv) > 1 else 15.0 | |
| root = Path("/home/wujiayir/robot_tools/droid") | |
| eps = sorted(p.name for p in (root / "out").iterdir() if (p / ".done").exists()) | |
| def one(ep): | |
| mp = root / "data" / ep / "metadata.json" | |
| if not mp.is_file(): | |
| return {"ep": ep, "error": "no metadata"} | |
| m = json.loads(mp.read_text()) | |
| n = m.get("trajectory_length") or 0 | |
| return {"ep": ep, "task": (m.get("current_task") or "").strip(), "steps": n, | |
| "sec": (n - 1) / HZ, "ext1": m.get("ext1_cam_serial"), | |
| "ext2": m.get("ext2_cam_serial"), "wrist": m.get("wrist_cam_serial"), | |
| "lab": m.get("lab")} | |
| with ThreadPoolExecutor(32) as ex, open(root / "tasks.jsonl", "w") as f: | |
| for r in ex.map(one, eps): | |
| f.write(json.dumps(r) + "\n") | |
| print("episodes:", len(eps)) | |