Add publication-friendly run comparison
Browse files- summarize_runs.py +32 -1
summarize_runs.py
CHANGED
|
@@ -16,6 +16,8 @@ def summarize_manifest(manifest: dict, path: str | Path = "") -> dict:
|
|
| 16 |
metrics = manifest.get("metrics") or {}
|
| 17 |
reprojection = metrics.get("reprojection_consistency") or []
|
| 18 |
coverage = metrics.get("projection_coverage") or []
|
|
|
|
|
|
|
| 19 |
return {
|
| 20 |
"manifest": str(path),
|
| 21 |
"run_id": manifest.get("run_id"),
|
|
@@ -27,12 +29,40 @@ def summarize_manifest(manifest: dict, path: str | Path = "") -> dict:
|
|
| 27 |
"fused_point_count": metrics.get("fused_point_count"),
|
| 28 |
"projection_coverage_mean": _mean(coverage),
|
| 29 |
"reprojection_mae_mean": _mean(item.get("mean_absolute_error") for item in reprojection),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
"fallback_error": metrics.get("fallback_error"),
|
| 31 |
"failure_error": manifest.get("error"),
|
| 32 |
"claims": manifest.get("claims", {}),
|
| 33 |
}
|
| 34 |
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
def find_manifests(root: Path) -> list[Path]:
|
| 37 |
if root.is_file():
|
| 38 |
return [root]
|
|
@@ -42,6 +72,7 @@ def find_manifests(root: Path) -> list[Path]:
|
|
| 42 |
def main(argv: list[str] | None = None) -> int:
|
| 43 |
parser = argparse.ArgumentParser(description=__doc__)
|
| 44 |
parser.add_argument("path", type=Path, help="A run manifest or directory containing manifests")
|
|
|
|
| 45 |
args = parser.parse_args(argv)
|
| 46 |
rows = []
|
| 47 |
for path in find_manifests(args.path):
|
|
@@ -50,7 +81,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 50 |
rows.append(summarize_manifest(manifest, path))
|
| 51 |
except (OSError, json.JSONDecodeError) as exc:
|
| 52 |
print(f"warning: skipped {path}: {exc}")
|
| 53 |
-
print(json.dumps(rows, indent=2))
|
| 54 |
return 0 if rows else 1
|
| 55 |
|
| 56 |
|
|
|
|
| 16 |
metrics = manifest.get("metrics") or {}
|
| 17 |
reprojection = metrics.get("reprojection_consistency") or []
|
| 18 |
coverage = metrics.get("projection_coverage") or []
|
| 19 |
+
fusion = metrics.get("fusion") or {}
|
| 20 |
+
diversity = metrics.get("input_diversity") or {}
|
| 21 |
return {
|
| 22 |
"manifest": str(path),
|
| 23 |
"run_id": manifest.get("run_id"),
|
|
|
|
| 29 |
"fused_point_count": metrics.get("fused_point_count"),
|
| 30 |
"projection_coverage_mean": _mean(coverage),
|
| 31 |
"reprojection_mae_mean": _mean(item.get("mean_absolute_error") for item in reprojection),
|
| 32 |
+
"pose_source": metrics.get("pose_source"),
|
| 33 |
+
"confidence_source": metrics.get("confidence_source"),
|
| 34 |
+
"gaussian_source": metrics.get("gaussian_source"),
|
| 35 |
+
"fusion_support_status": fusion.get("support_status", metrics.get("fusion_support_status")),
|
| 36 |
+
"unique_input_view_count": diversity.get("unique_input_view_count"),
|
| 37 |
"fallback_error": metrics.get("fallback_error"),
|
| 38 |
"failure_error": manifest.get("error"),
|
| 39 |
"claims": manifest.get("claims", {}),
|
| 40 |
}
|
| 41 |
|
| 42 |
|
| 43 |
+
def markdown_summary(rows: list[dict]) -> str:
|
| 44 |
+
"""Render a compact comparison table suitable for an experiment note."""
|
| 45 |
+
lines = [
|
| 46 |
+
"| Run | Backend | Views | Coverage | Reprojection MAE | Fusion support | Gaussian source | Status |",
|
| 47 |
+
"| --- | --- | ---: | ---: | ---: | --- | --- | --- |",
|
| 48 |
+
]
|
| 49 |
+
for row in rows:
|
| 50 |
+
def value(key: str, fallback: str = "-") -> str:
|
| 51 |
+
item = row.get(key)
|
| 52 |
+
return fallback if item is None or item == "" else str(item)
|
| 53 |
+
|
| 54 |
+
coverage = row.get("projection_coverage_mean")
|
| 55 |
+
coverage_text = "-" if coverage is None else f"{float(coverage):.1%}"
|
| 56 |
+
mae = row.get("reprojection_mae_mean")
|
| 57 |
+
mae_text = "-" if mae is None else f"{float(mae):.4f}"
|
| 58 |
+
lines.append(
|
| 59 |
+
f"| {value('run_id')} | {value('backend')} | {value('view_count')} | "
|
| 60 |
+
f"{coverage_text} | {mae_text} | {value('fusion_support_status')} | "
|
| 61 |
+
f"{value('gaussian_source')} | {value('status')} |"
|
| 62 |
+
)
|
| 63 |
+
return "\n".join(lines)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
def find_manifests(root: Path) -> list[Path]:
|
| 67 |
if root.is_file():
|
| 68 |
return [root]
|
|
|
|
| 72 |
def main(argv: list[str] | None = None) -> int:
|
| 73 |
parser = argparse.ArgumentParser(description=__doc__)
|
| 74 |
parser.add_argument("path", type=Path, help="A run manifest or directory containing manifests")
|
| 75 |
+
parser.add_argument("--format", choices=("json", "markdown"), default="json")
|
| 76 |
args = parser.parse_args(argv)
|
| 77 |
rows = []
|
| 78 |
for path in find_manifests(args.path):
|
|
|
|
| 81 |
rows.append(summarize_manifest(manifest, path))
|
| 82 |
except (OSError, json.JSONDecodeError) as exc:
|
| 83 |
print(f"warning: skipped {path}: {exc}")
|
| 84 |
+
print(markdown_summary(rows) if args.format == "markdown" else json.dumps(rows, indent=2))
|
| 85 |
return 0 if rows else 1
|
| 86 |
|
| 87 |
|