Download examples/pilot.py from pytc/trackingBench: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/datasets/pytc/trackingBench/resolve/main/examples/pilot.py
- Command line
-
hf download hf://datasets/pytc/trackingBench/examples/pilot.py
-
curl -L -o pilot.py https://huggingface.co/datasets/pytc/trackingBench/resolve/main/examples/pilot.py
1.36 kB
| """Run the actual ASCENT pilot; accept either a local assembly or pinned Hub revision.""" | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| from cell_tracking.data.wormtrack_verify import BenchmarkClient | |
| from cell_tracking.evaluation.wormtrack_verify import ( | |
| association_metrics, | |
| corrupt_tracks, | |
| reference_residual_scores, | |
| verifier_metrics, | |
| ) | |
| def run(client): | |
| clean = client.load_tracks("ascent-opterra", label_source="human_corrected") | |
| cloud = client.load_reference_cloud("ascent-opterra") | |
| corrupt = corrupt_tracks( | |
| clean, kind="swap_recovery", seed=20261007, start_frame=300, stop_frame=700 | |
| ) | |
| scores = reference_residual_scores(corrupt, cloud) | |
| metrics = verifier_metrics(scores, corrupt.is_error, threshold=5.0) | |
| metrics.pop("risk_coverage") | |
| volume = client.load_volume("ascent-opterra", frame=0) | |
| print( | |
| json.dumps( | |
| { | |
| "volume_czyx": list(volume.shape), | |
| "association": association_metrics(clean, corrupt), | |
| "verifier": metrics, | |
| }, | |
| indent=2, | |
| ) | |
| ) | |
| if __name__ == "__main__": | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--root") | |
| parser.add_argument("--revision") | |
| args = parser.parse_args() | |
| run(BenchmarkClient(root=args.root, revision=args.revision)) | |