Download scripts/analysis/compare_tracker_offline.py from ZenoNing/ConsDrive: direct link, hf CLI and curl.
- Browser
- Download file 1.83 kB
-
https://huggingface.co/ZenoNing/ConsDrive/resolve/main/scripts/analysis/compare_tracker_offline.py
- Command line
-
hf download hf://ZenoNing/ConsDrive/scripts/analysis/compare_tracker_offline.py
-
curl -L -o compare_tracker_offline.py https://huggingface.co/ZenoNing/ConsDrive/resolve/main/scripts/analysis/compare_tracker_offline.py
1.83 kB
| """Side-by-side offline tracker metrics (scripts/eval_tracker_offline.py) of several detector runs. | |
| python scripts/analysis/compare_tracker_offline.py eval_results/tracker_offline/det_v1_val eval_results/tracker_offline/sp_v1_val | |
| """ | |
| import json | |
| import sys | |
| from pathlib import Path | |
| runs = [(Path(p).name, json.load(open(Path(p) / "tracker_metrics.json"))) for p in sys.argv[1:]] | |
| names = [n for n, _ in runs] | |
| w = max(12, max(len(n) for n in names) + 2) | |
| print(f"{'':28s}" + "".join(f"{n:>{w}s}" for n in names)) | |
| print(f"{'frames':28s}" + "".join(f"{d['frames']:>{w}d}" for _, d in runs)) | |
| print(f"{'false tracks / s':28s}" + "".join(f"{d['false_tracks_per_s']:>{w}.3f}" for _, d in runs)) | |
| print(f"{'id switches / 100 matches':28s}" + "".join(f"{d['id_switches_per_100_matches']:>{w}.2f}" for _, d in runs)) | |
| for cls in ("car", "walker", "static"): | |
| for key in ("recall_visible", "pos_err_med", "vel_err_med"): | |
| for rb in ("0-10", "10-20", "20-30", "30-40", "40-50"): | |
| vals = [d[cls][rb].get(key) for _, d in runs] | |
| if all(v is None for v in vals): | |
| continue | |
| print(f"{cls + ' ' + key + ' ' + rb:28s}" + "".join(f"{v:>{w}.3f}" if v is not None else f"{'-':>{w}s}" | |
| for v in vals)) | |
| for sb in ("0-0.5", "0.5-5", "5-10", "10-20"): | |
| for key in ("vel_err_med", "vel_err_rms"): | |
| vals = [d["car_velocity_by_speed"].get(sb, {}).get(key) for _, d in runs] | |
| print(f"{'car ' + sb + ' m/s ' + key:28s}" + "".join(f"{v:>{w}.3f}" if v is not None else f"{'-':>{w}s}" | |
| for v in vals)) | |
| tgt = runs[0][1]["car_velocity_by_speed"].get(sb, {}).get("target_sigma") | |
| if tgt is not None: | |
| print(f"{' (target sigma)':28s}{tgt:>{w}.3f}") | |