Download code/tools/build_waymo_scenes.py from MRBSTUDIO/AGT: direct link, hf CLI and curl.
- Browser
- Download file 1.71 kB
-
https://huggingface.co/MRBSTUDIO/AGT/resolve/main/code/tools/build_waymo_scenes.py
- Command line
-
hf download hf://MRBSTUDIO/AGT/code/tools/build_waymo_scenes.py
-
curl -L -o build_waymo_scenes.py https://huggingface.co/MRBSTUDIO/AGT/resolve/main/code/tools/build_waymo_scenes.py
1.71 kB
| from __future__ import annotations | |
| import argparse | |
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parents[1])) | |
| from agt.dataset import build_scenes, waymo | |
| def main() -> int: | |
| parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter) | |
| parser.add_argument("--data-root", type=Path, required=True, help="AmodalDrive dataset root (scenes/ is written here)") | |
| parser.add_argument("--waymo-root", type=Path, required=True, help="Waymo v2.0.1 parquet root (read-only)") | |
| parser.add_argument("--split", action="append", choices=("val", "test"), help="evaluation split(s) to build") | |
| parser.add_argument("--segment", action="append", help="only these segments (repeatable)") | |
| parser.add_argument("--workers", type=int, default=3) | |
| parser.add_argument("--ffmpeg", default="ffmpeg", help="ffmpeg with libx265 (the reference build is ffmpeg 7.0.2 static, x265 3.5)") | |
| parser.add_argument("--ffprobe", default="ffprobe") | |
| args = parser.parse_args() | |
| segments = [] | |
| for split in args.split or []: | |
| segments += build_scenes.split_segments(args.data_root, split) | |
| if args.segment: | |
| known = dict((s, sp) for sp, s in segments) | |
| segments = [(known.get(s) or waymo.find_split(args.waymo_root, s), s) for s in args.segment] | |
| if not segments: | |
| parser.error("give --split and/or --segment") | |
| failed = build_scenes.build(args.data_root, args.waymo_root, segments, ffmpeg=args.ffmpeg, ffprobe=args.ffprobe, | |
| workers=args.workers) | |
| print(f"failed segments: {failed}", flush=True) | |
| return 1 if failed else 0 | |
| if __name__ == "__main__": | |
| sys.exit(main()) | |