import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent)) import bench for name in ["355_p02_cellar", "355_p13_15th", "dean_p04", "dean_p06"]: p = Path(__file__).resolve().parent / "ground_truth" / (name + ".csv") gt = bench._load_boxes(p, is_gt=True) sc = bench._score(gt, gt) print(f"{name:18s} gt={sc['gt_count']:3d} F1={sc['f1']:.3f} " f"tag_acc={sc['tag_acc']:.3f} count_acc={sc['count_acc']:.3f}") # Perturbation check: drop one box + add a spurious one -> F1 < 1 gt = bench._load_boxes(Path(__file__).resolve().parent / "ground_truth" / "dean_p04.csv", is_gt=True) preds = gt[:-1] + [("AC-Z", 99999, 99999, 50, 50)] sc = bench._score(preds, gt) print(f"perturbed dean_p04 pred={sc['pred_count']} tp={sc['tp']} fp={sc['fp']} " f"fn={sc['fn']} F1={sc['f1']:.3f}")