Download build_camera_controls.py from HugMinjun/geo4d_evals: direct link, hf CLI and curl.
- Browser
- Download file 1.96 kB
-
https://huggingface.co/datasets/HugMinjun/geo4d_evals/resolve/main/build_camera_controls.py
- Command line
-
hf download hf://datasets/HugMinjun/geo4d_evals/build_camera_controls.py
-
curl -L -o build_camera_controls.py https://huggingface.co/datasets/HugMinjun/geo4d_evals/resolve/main/build_camera_controls.py
1.96 kB
| """Build and validate the unified 12-control DynPose and SpatialVID sets.""" | |
| from __future__ import annotations | |
| import json | |
| import subprocess | |
| from datetime import datetime, timezone | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parent | |
| STATUS = ROOT / "camera_controls_build_status.json" | |
| LOG = ROOT / "camera_controls_build.log" | |
| BUILDERS = ( | |
| ROOT / "spatialvid_eval/build_camera_controls.py", | |
| ROOT / "dynpose_eval/build_camera_controls.py", | |
| ) | |
| def now() -> str: | |
| return datetime.now(timezone.utc).isoformat() | |
| def write_status(payload: dict) -> None: | |
| STATUS.write_text(json.dumps(payload, indent=2) + "\n", encoding="utf-8") | |
| def main() -> None: | |
| report: dict[str, object] = {"status": "running", "started_at": now(), "datasets": {}} | |
| write_status(report) | |
| with LOG.open("w", encoding="utf-8") as log: | |
| for builder in BUILDERS: | |
| dataset = builder.parent.name | |
| process = subprocess.run( | |
| ["/opt/conda/bin/python", str(builder)], | |
| cwd=builder.parent, | |
| text=True, | |
| stdout=subprocess.PIPE, | |
| stderr=subprocess.STDOUT, | |
| ) | |
| log.write(f"===== {dataset} =====\n{process.stdout}\n") | |
| log.flush() | |
| item: dict[str, object] = {"returncode": process.returncode} | |
| try: | |
| item["validation"] = json.loads(process.stdout) | |
| except json.JSONDecodeError: | |
| item["output_tail"] = process.stdout[-4000:] | |
| report["datasets"][dataset] = item # type: ignore[index] | |
| if process.returncode: | |
| report.update({"status": "failed", "finished_at": now()}) | |
| write_status(report) | |
| raise SystemExit(process.returncode) | |
| report.update({"status": "complete", "finished_at": now()}) | |
| write_status(report) | |
| print(json.dumps(report, indent=2)) | |
| if __name__ == "__main__": | |
| main() | |