"""Checksummed acquisition; optional public lightweight 3D model.""" import argparse from baseball_batting.config import CONFIG_ROOT from baseball_batting.resources import fetch_artifact def main(): parser = argparse.ArgumentParser() parser.add_argument("--output", default="downloads") parser.add_argument("--with-3d", action="store_true") args = parser.parse_args() names = ["body_pose", "person_detector"] + (["body_pose_3d"] if args.with_3d else []) for name in names: record = fetch_artifact(name, CONFIG_ROOT / "resources.yaml", args.output) # Public .onnx downloads can have arbitrary filenames; worker paths are # fixed, just like extracted ZIP artifacts. from pathlib import Path from baseball_batting.storage import atomic_json model = Path(args.output)/name/"model.onnx" if Path(record["artifact_path"]).resolve() != model.resolve(): Path(record["artifact_path"]).replace(model) record["artifact_path"] = str(model.resolve()) atomic_json(model.parent/"resource.json", record) print(f"{name}: verified {record['sha256']}", flush=True) if __name__ == "__main__": main()