File size: 1,095 Bytes
e1c08ca | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 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()
|