Download scripts/evaluate_iou.py from ureca07/lol_viewport: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/datasets/ureca07/lol_viewport/resolve/main/scripts/evaluate_iou.py
- Command line
-
hf download hf://datasets/ureca07/lol_viewport/scripts/evaluate_iou.py
-
curl -L -o evaluate_iou.py https://huggingface.co/datasets/ureca07/lol_viewport/resolve/main/scripts/evaluate_iou.py
1.1 kB
| from __future__ import annotations | |
| import argparse | |
| import sys | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| if str(ROOT) not in sys.path: | |
| sys.path.insert(0, str(ROOT)) | |
| from lol_viewport.metrics import evaluate_box_dir | |
| DEFAULT_REPLAYS = [ | |
| "241019_TESvsT1_3Set_cropped", | |
| "241020_GENvsFLY_3Set_cropped", | |
| "241026_WBGvsBLG_3Set_cropped", | |
| "241027_T1vsGEN_3Set_cropped", | |
| "241102_T1vsBLG_3Set_cropped", | |
| ] | |
| def main() -> None: | |
| parser = argparse.ArgumentParser(description="Evaluate viewport boxes with Mean IoU and IoU threshold rates.") | |
| parser.add_argument("--box-dir", required=True) | |
| parser.add_argument("--replays", nargs="+", default=DEFAULT_REPLAYS) | |
| args = parser.parse_args() | |
| summary = evaluate_box_dir(Path(args.box_dir), args.replays) | |
| print(f"Mean IoU: {summary.mean_iou:.4f}") | |
| print(f"IoU >= 0.3 (%): {summary.iou_ge_03:.2f}") | |
| print(f"IoU >= 0.5 (%): {summary.iou_ge_05:.2f}") | |
| print(f"IoU >= 0.7 (%): {summary.iou_ge_07:.2f}") | |
| print(f"Frames: {summary.frames}") | |
| if __name__ == "__main__": | |
| main() | |