| """Aggregate densification_events.json across scenes/methods, emit Table 8 data.""" |
| import os |
| import json |
| import argparse |
|
|
|
|
| def main(): |
| ap = argparse.ArgumentParser() |
| ap.add_argument("--scenes", nargs="+", |
| default=["francis", "m60", "panther", "bonsai", "bicycle"]) |
| ap.add_argument("--methods", nargs="+", |
| default=["vanilla_logged", "vanillasgf_logged"]) |
| ap.add_argument("--outputs_root", default="/root/autodl-tmp/SplatAtlas/outputs") |
| args = ap.parse_args() |
|
|
| print(f"{'Method':<22} {'Scene':<10} {'#Events':>9} {'#Edge':>8} {'#Flat':>8} {'Edge/Flat':>10}") |
| print("-" * 72) |
|
|
| summary = {} |
| for method in args.methods: |
| agg_total = agg_edge = agg_flat = 0 |
| for scene in args.scenes: |
| log_path = os.path.join(args.outputs_root, f"{method}_{scene}", |
| "densification_events.json") |
| if not os.path.exists(log_path): |
| print(f"{method:<22} {scene:<10} {'(missing)':>9}") |
| continue |
| with open(log_path) as f: |
| events = json.load(f) |
| total = sum(e["n_will_densify"] for e in events) |
| edge = sum(e["n_edge"] for e in events) |
| flat = sum(e["n_flat"] for e in events) |
| ratio = edge / max(flat, 1) |
| agg_total += total; agg_edge += edge; agg_flat += flat |
| print(f"{method:<22} {scene:<10} {total:>9} {edge:>8} {flat:>8} {ratio:>10.2f}") |
| m_ratio = agg_edge / max(agg_flat, 1) |
| print(f"{method:<22} {'AVERAGE':<10} {agg_total:>9} {agg_edge:>8} {agg_flat:>8} {m_ratio:>10.2f}") |
| print("-" * 72) |
| summary[method] = {"total": agg_total, "edge": agg_edge, "flat": agg_flat, "ratio": m_ratio} |
|
|
| if "vanilla_logged" in summary and "vanillasgf_logged" in summary: |
| base_r = summary["vanilla_logged"]["ratio"] |
| sgf_r = summary["vanillasgf_logged"]["ratio"] |
| print(f"\nEdge/Flat ratio shift: baseline {base_r:.2f}x → SGF {sgf_r:.2f}x" |
| f" (Δ = {sgf_r - base_r:+.2f})") |
|
|
|
|
| if __name__ == "__main__": |
| main() |
|
|